From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PART1 RFC v2 07/10] svm: Add VMEXIT handlers for AVIC Date: Fri, 18 Mar 2016 02:44:24 +0700 Message-ID: <56EB0918.80709@amd.com> References: <1457124368-2025-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1457124368-2025-8-git-send-email-Suravee.Suthikulpanit@amd.com> <20160309205512.GD19459@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: , , , , , , , , To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mail-bl2on0093.outbound.protection.outlook.com ([65.55.169.93]:42614 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752721AbcCQToq (ORCPT ); Thu, 17 Mar 2016 15:44:46 -0400 In-Reply-To: <20160309205512.GD19459@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi, On 3/10/16 03:55, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2016-03-04 14:46-0600, Suravee Suthikulpanit: >> >From: Suravee Suthikulpanit >> > >> >Introduce VMEXIT handlers, avic_incp_ipi_interception() and >> >avic_noaccel_interception(). >> > >> >Signed-off-by: Suravee Suthikulpanit >> >--- >> >diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c >> >@@ -3690,6 +3690,264 @@ static int mwait_interception(struct vcpu_s= vm *svm) >> >+ case AVIC_INCMP_IPI_ERR_TARGET_NOT_RUN: { >> >+ kvm_for_each_vcpu(i, vcpu, kvm) { >> >+ if (!kvm_apic_match_dest(vcpu, apic, >> >+ icrl & APIC_SHORT_MASK, >> >+ GET_APIC_DEST_FIELD(icrh), >> >+ icrl & APIC_DEST_MASK)) >> >+ continue; >> >+ >> >+ kvm_vcpu_kick(vcpu); > KVM shouldn't kick VCPUs that are running. (Imagine a broadcast when > most VCPUs are in guest mode.) So, besides checking if the vcpu match the destination, I will add the=20 check to see if the is_running bit is set before calling kvm_vcpu_kick(= ) > I think a new helper might be useful here: we only want to wake up fr= om > wait queue, but never force VCPU out of guest mode ... kvm_vcpu_kick(= ) > does both. If I only kick non-running vcpu, do I still need this new helper functi= on? Thanks, Suravee