From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PART1 RFC v2 10/10] svm: Manage vcpu load/unload when enable AVIC Date: Thu, 10 Mar 2016 15:01:42 +0100 Message-ID: <20160310140141.GA23501@potion.brq.redhat.com> References: <1457124368-2025-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1457124368-2025-11-git-send-email-Suravee.Suthikulpanit@amd.com> <20160309214629.GE19459@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: pbonzini@redhat.com, joro@8bytes.org, bp@alien8.de, gleb@kernel.org, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com To: Suravee Suthikulpanit Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34378 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751550AbcCJOBs (ORCPT ); Thu, 10 Mar 2016 09:01:48 -0500 Content-Disposition: inline In-Reply-To: <20160309214629.GE19459@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 2016-03-09 22:46+0100, Radim Kr=C4=8Dm=C3=A1=C5=99: > 2016-03-04 14:46-0600, Suravee Suthikulpanit: >> From: Suravee Suthikulpanit >>=20 >> When a vcpu is loaded/unloaded to a physical core, we need to update >> information in the Physical APIC-ID table accordingly. >>=20 >> Signed-off-by: Suravee Suthikulpanit >> --- >> +static int avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu, bool is_l= oad) >=20 > This function does a lot and there is only one thing that must be don= e > in svm_vcpu_load: change host physical APIC ID if the CPU changed. > The rest can be done elsewhere: > - is_running when blocking. Well, we haven't reached an agreement on is_running yet. The situation= : if we don't unset vcpu1.is_running when vcpu1 is scheduled out and vcpu= 2 gets scheduled on vcpu1's physical core, then vcpu2 would receive a doorbell intended to vcpu1. We'd like to keep is_running set when there is no reason to vmexit, but not if a guest can negatively affect other guests. How does receiving a stray doorbell affect the performance? Thanks. (Toggling is_running on load/put is definitely safer, so it's a good choice for first version.)