Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp284497ybi; Fri, 31 May 2019 01:12:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzANARkzQ1f2s7O/A8x2np+f2rQ/oWmYikIxweF31cIVU14uUQJEVXS5Kziax47Gca+9tYa X-Received: by 2002:a17:90a:71cb:: with SMTP id m11mr7419391pjs.40.1559290363390; Fri, 31 May 2019 01:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559290363; cv=none; d=google.com; s=arc-20160816; b=GbyzoKCNOhZD1y+q654xnktMBK9mcc4JtssFQWBpLqCsVOGKpkfhYtvaMBkR/x7pEl jYNTjw+KkZZbjj/1KKg2G69c458sAU9JJw0xHHn3xbEoqClSRGcqWBNE1PeUj2yunWBu mu2Rvn4l8saI87eLhmI30V/OSushIrAqyJqTtPkJ9C2eeQSgR70JWG0ngFJavAs9VIxp DSTspvWljQ6tXOFn+A3U+i4n4Cbs8sHkcovBjUQxMfE1gR7KAlR/bMf3wfFJve8Qm2VC nOPTmxWG+Tc4Huiunqc9e+OhBL9X6UUGe/e/00eiTG0ckrMqblZ5/6lvkUijxZ6d1gos Pl/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=yURj/+gW0B0dxqen6UA/nPTPfSucMgxO/4ULgj8PMoc=; b=tg7bKAWdRX/qitiMhzHilksOYNu7u0xsDdkpZ4oD22XRq2kzNmEG5aPhlU3WC7BOgV 2OhO4Zv/zQsR4YBO25j4ByqX/dgONdY80WyCGdhubiXsGoBH1sKAmmmYmdmpWURApIo/ C2TfYKubrbzSycLPprAR9kHeWM1xiJqueyo1MTJvAdxAIETTZm6oOOklQgWaTM3Wwubr ETOSFspsWtNU4/Qo0qtxSofE22YJl2ZvgSkWTxxoZlPi/tYq7pmtHaxCxFST30RS3kzB G0mJ9JPxHNASaCS/bBSZXZMc8/i2SeP5M7VtJ/+PgiPDPXidDrHfaIbwXlWqgiORLyZg ofyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si5681901pfo.248.2019.05.31.01.12.26; Fri, 31 May 2019 01:12:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726724AbfEaILQ convert rfc822-to-8bit (ORCPT + 99 others); Fri, 31 May 2019 04:11:16 -0400 Received: from mga12.intel.com ([192.55.52.136]:16369 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbfEaILP (ORCPT ); Fri, 31 May 2019 04:11:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2019 01:11:14 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga008.jf.intel.com with ESMTP; 31 May 2019 01:11:14 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 31 May 2019 01:11:14 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 31 May 2019 01:11:13 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.98]) with mapi id 14.03.0415.000; Fri, 31 May 2019 16:11:12 +0800 From: "Kang, Luwei" To: "Christopherson, Sean J" CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "x86@kernel.org" Subject: RE: [PATCH] KVM: LAPIC: Do not mask the local interrupts when LAPIC is sw disabled Thread-Topic: [PATCH] KVM: LAPIC: Do not mask the local interrupts when LAPIC is sw disabled Thread-Index: AQHVD8I2LU4/pRFEgkiaWmh/P2D76KaDijsAgAFc1nA= Date: Fri, 31 May 2019 08:11:12 +0000 Message-ID: <82D7661F83C1A047AF7DC287873BF1E172DAE266@SHSMSX101.ccr.corp.intel.com> References: <1558435455-233679-1-git-send-email-luwei.kang@intel.com> <20190530184602.GD23930@linux.intel.com> In-Reply-To: <20190530184602.GD23930@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2FmMzQ1NDgtYzY0OS00MjI2LWE2YzktZTYyMmE1ODEyNjA1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZUdhM2R6MnlaWjFUVlFQS1pTdm10Z2F3RVVxTWdZVUVHVVZaSTJLWUdmdlh1TVkya1haUlg2Y1h6Rzk3ZE92RCJ9 dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Christopherson, Sean J > Sent: Friday, May 31, 2019 2:46 AM > To: Kang, Luwei > Cc: linux-kernel@vger.kernel.org; kvm@vger.kernel.org; pbonzini@redhat.com; rkrcmar@redhat.com; tglx@linutronix.de; > mingo@redhat.com; bp@alien8.de; hpa@zytor.com; x86@kernel.org > Subject: Re: [PATCH] KVM: LAPIC: Do not mask the local interrupts when LAPIC is sw disabled > > On Tue, May 21, 2019 at 06:44:15PM +0800, Luwei Kang wrote: > > The current code will mask all the local interrupts in the local > > vector table when the LAPIC is disabled by SVR (Spurious-Interrupt > > Vector Register) "APIC Software Enable/Disable" flag (bit8). > > This may block local interrupt be delivered to target vCPU even if > > LAPIC is enabled by set SVR (bit8 == 1) after. > > The current code aligns with the SDM, which states: > > Local APIC State After It Has Been Software Disabled > > When the APIC software enable/disable flag in the spurious interrupt > vector register has been explicitly cleared (as opposed to being cleared > during a power up or reset), the local APIC is temporarily disabled. > The operation and response of a local APIC while in this software- > disabled state is as follows: > > - The mask bits for all the LVT entries are set. Attempts to reset > these bits will be ignored. Thanks for Sean's reminder. I make this patch because I found the PMI from Intel PT can't be inject to target vCPU when there have multi vCPU in guest and the Intel PT interrupt happened on not the first vCPU (i.e. not vCPU0). The interrupt blocked in kvm_apic_local_deliver() function and can't pass the APIC_LVT_MASKED flag check (LVTPC is masked from start to end). The KVM Guest will enabled the LVTPC during LAPIC is software disabled and enabled LAPIC after during VM bootup, but LVTPC is still disabled. Guest PT driver didn't enabled LVTPC before enable PT as well. But the Guest performance monitor counter driver will enabled LVTPC in each time before using PMU. I will do more check on this. Thank you. Luwei Kang