From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PART1 RFC v2 06/10] svm: Add interrupt injection via AVIC Date: Mon, 14 Mar 2016 16:50:13 +0700 Message-ID: <56E68955.5060401@amd.com> References: <1457124368-2025-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1457124368-2025-7-git-send-email-Suravee.Suthikulpanit@amd.com> <56DD9FF5.7010201@redhat.com> <20160308215424.GA31328@potion.brq.redhat.com> <56E004A2.70702@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , , , , , To: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mail-bl2on0093.outbound.protection.outlook.com ([65.55.169.93]:10569 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752107AbcCNJui (ORCPT ); Mon, 14 Mar 2016 05:50:38 -0400 In-Reply-To: <56E004A2.70702@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi, On 03/09/2016 06:10 PM, Paolo Bonzini wrote: >>>> + >>>> >>>+ if (vcpu->mode == IN_GUEST_MODE) { >>>> >>>+ wrmsrl(SVM_AVIC_DOORBELL, >>>> >>>+ __default_cpu_present_to_apicid(vcpu->cpu)); >>>> >>>+ } else { >>>> >>>+ kvm_vcpu_kick(vcpu); >>>> >>>+ } >> > >> >And what about >> > [...] >> > else if (!vcpu->...->is_running) >> > kvm_vcpu_kick(vcpu); >> > >> >? >> >The kick isn't needed unless the VCPU is scheduled out. >> >Or maybe just >> > if (vcpu->...->is_running) >> > wrmsrl() >> > else >> > kvm_vcpu_kick(); >> >? >> >Which doesn't use the information we have on top AVIC, making our logic >> >a bit simpler. > Yes, both of this should work. I like the latter. Ok, I'll modify this to check the is_running bit of the AVIC Physical APIC ID table entry to determine if we should kick vcpu. Thanks, Suravee