From patchwork Thu Apr 11 01:03:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yang Z" X-Patchwork-Id: 2426201 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 04CC33FCA5 for ; Thu, 11 Apr 2013 01:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935547Ab3DKBDe (ORCPT ); Wed, 10 Apr 2013 21:03:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:36069 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935511Ab3DKBDe convert rfc822-to-8bit (ORCPT ); Wed, 10 Apr 2013 21:03:34 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 10 Apr 2013 18:03:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,451,1363158000"; d="scan'208";a="317470992" Received: from fmsmsx103.amr.corp.intel.com ([10.19.9.34]) by fmsmga001.fm.intel.com with ESMTP; 10 Apr 2013 18:03:33 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.19.17.7) by FMSMSX103.amr.corp.intel.com (10.19.9.34) with Microsoft SMTP Server (TLS) id 14.1.355.2; Wed, 10 Apr 2013 18:03:33 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX153.amr.corp.intel.com (10.19.17.7) with Microsoft SMTP Server (TLS) id 14.1.355.2; Wed, 10 Apr 2013 18:03:32 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.85]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.236]) with mapi id 14.01.0355.002; Thu, 11 Apr 2013 09:03:30 +0800 From: "Zhang, Yang Z" To: Gleb Natapov CC: "kvm@vger.kernel.org" , "mtosatti@redhat.com" , "Zhang, Xiantao" , "Nakajima, Jun" Subject: RE: [PATCH v9 0/7] KVM: VMX: Add Posted Interrupt supporting Thread-Topic: [PATCH v9 0/7] KVM: VMX: Add Posted Interrupt supporting Thread-Index: AQHONgDUf5+8dL2rJk6168Rj41LyOpjQMtVA Date: Thu, 11 Apr 2013 01:03:30 +0000 Message-ID: References: <1365600177-8506-1-git-send-email-yang.z.zhang@intel.com> <20130410153311.GK17919@redhat.com> In-Reply-To: <20130410153311.GK17919@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Gleb Natapov wrote on 2013-04-10: > On Wed, Apr 10, 2013 at 09:22:50PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> The follwoing patches are adding the Posted Interrupt supporting to KVM: >> The first patch enables the feature 'acknowledge interrupt on vmexit'.Since >> it is required by Posted interrupt, we need to enable it firstly. >> >> And the subsequent patches are adding the posted interrupt supporting: >> Posted Interrupt allows APIC interrupts to inject into guest directly >> without any vmexit. >> >> - When delivering a interrupt to guest, if target vcpu is running, >> update Posted-interrupt requests bitmap and send a notification event >> to the vcpu. Then the vcpu will handle this interrupt automatically, >> without any software involvemnt. >> - If target vcpu is not running or there already a notification event >> pending in the vcpu, do nothing. The interrupt will be handled by >> next vm entry >> Changes from v8 to v9: >> * Add tracing in PI case when deliver interrupt. >> * Scan ioapic when updating SPIV register. > Do not see it at the patch series. Have I missed it? The change is in forth patch: And I found recalculate_apic_map() doesn't track the enable/disable apic by software approach. So make_scan_ioapic_request in recalculate_apic_map() is not enough. We also should force rescan ioapic when apic state is changed via software approach(update spiv reg). > >> * Rebase on top of KVM upstream + RTC eoi tracking patch. >> >> Changes from v7 to v8: >> * Remove unused memeber 'on' from struct pi_desc. >> * Register a dummy function to sync_pir_to_irr is apicv is disabled. >> * Minor fixup. >> * Rebase on top of KVM upstream + RTC eoi tracking patch. >> >> Yang Zhang (7): >> KVM: VMX: Enable acknowledge interupt on vmexit >> KVM: VMX: Register a new IPI for posted interrupt >> KVM: VMX: Check the posted interrupt capability >> KVM: Call common update function when ioapic entry changed. >> KVM: Set TMR when programming ioapic entry >> KVM: VMX: Add the algorithm of deliver posted interrupt >> KVM: VMX: Use posted interrupt to deliver virtual interrupt >> arch/ia64/kvm/lapic.h | 6 - >> arch/x86/include/asm/entry_arch.h | 4 + >> arch/x86/include/asm/hardirq.h | 3 + >> arch/x86/include/asm/hw_irq.h | 1 + >> arch/x86/include/asm/irq_vectors.h | 5 + >> arch/x86/include/asm/kvm_host.h | 3 + arch/x86/include/asm/vmx.h >> | 4 + arch/x86/kernel/entry_64.S | 5 + >> arch/x86/kernel/irq.c | 22 ++++ >> arch/x86/kernel/irqinit.c | 4 + arch/x86/kvm/lapic.c >> | 66 ++++++++---- arch/x86/kvm/lapic.h | 7 >> ++ arch/x86/kvm/svm.c | 12 ++ arch/x86/kvm/vmx.c >> | 207 +++++++++++++++++++++++++++++++----- >> arch/x86/kvm/x86.c | 19 +++- >> include/linux/kvm_host.h | 4 +- virt/kvm/ioapic.c >> | 32 ++++-- virt/kvm/ioapic.h | 7 +- >> virt/kvm/irq_comm.c | 4 +- virt/kvm/kvm_main.c >> | 5 +- 20 files changed, 341 insertions(+), 79 deletions(-) > > -- > Gleb. > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Best regards, Yang --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 6796218..4ccdc94 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -134,11 +134,7 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) static_key_slow_inc(&apic_sw_disabled.key); } apic_set_reg(apic, APIC_SPIV, val); -} - -static inline int apic_enabled(struct kvm_lapic *apic) -{ - return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); + kvm_make_request(KVM_REQ_SCAN_IOAPIC, apic->vcpu); } As you mentioned, since it will call apic_enabled() to check whether apic is enabled in vcpu_scan_ioapic. So we must ensure rescan ioapic when apic state changed.