Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp405153ybt; Fri, 19 Jun 2020 04:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhVfY/4QI/jJCWbLR8zDZ00I9z8hATHSmOCXjT3I36cLykw/oO8hR2PB0xTxuV72BRIMWp X-Received: by 2002:a50:d7de:: with SMTP id m30mr2800204edj.183.1592567466429; Fri, 19 Jun 2020 04:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592567466; cv=none; d=google.com; s=arc-20160816; b=niJCTfkjw0el4mEDxnYpyCL2eve31ZXY1GTOQDxAuNSj28g8+3wbaY+wcSAxjkB4I8 LuxI2DwLs4YlChhlcwwPHuoaBvgf/uHl+MQpldZy3VHeg2tSMKb+Gw7nZsyMhhdRS1y3 J6PQ4nAg7jmFhcZr6CAfMRLiVWMLu2P1Yq08ZUYTCYz87RIMSPTQYwae7nmCBPa5QuLz zEL6dpOI8mpRhiX/wEC32/vWLprt2cdrEB8362mTBWUsFRXXqiRy/r45C8u3ZFklnA0A ZoZaqIaN2vAZ6jiArDLMtHuroUfOlGBI27sNZbtaLhQRO0GM2VGXgQz+lPHxW6uuvVTT 9uFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:reply-to :ironport-sdr:ironport-sdr; bh=8KOI8Nd56dW3EUFN8j0q4vnB/b7CaU5etJeI0QXT/8I=; b=x9hp9nuRQJi28IeFiVHluASqxztnylrzODW9uP6n1M/clw9B+zMmIPN8nLAfrK9HsG 2rsJhOofvdL/cctf/medeBlm9L4RQP4vZGwqiPdULkjdXXZLninGq3T2NLdkQNHVZDqx Z4VJ+CfYykai0bEJzXOSuXZqLI/kKl9akI8i59ApduiIfDQRiBEhJwXPDXtQ4ti7oGRr cqpnfk0gYYomwlYeDO+iJRBtw0JeI+gCAOnQ3iV1tp+86geEJMR6lk376i0oT3M8P1+m /p5HDT1Fm7Iy3JVc+TH3rC7dUC7kQfI/30Spf8OPneCNnIAyF19NqKiVeN8KE0Ba2SzD v6XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id pg21si3669454ejb.349.2020.06.19.04.50.43; Fri, 19 Jun 2020 04:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1732293AbgFSKDF (ORCPT + 99 others); Fri, 19 Jun 2020 06:03:05 -0400 Received: from mga01.intel.com ([192.55.52.88]:18257 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729195AbgFSKDE (ORCPT ); Fri, 19 Jun 2020 06:03:04 -0400 IronPort-SDR: 4to/IEYMSY4TSEg8MNW5daXTpjaVgP77zPtvTdeoRcO9Z8dm/3CMsb+y43+5tdEdYZhZ1CdUTs JcIaO1c3buvQ== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="161013894" X-IronPort-AV: E=Sophos;i="5.75,254,1589266800"; d="scan'208";a="161013894" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 03:03:04 -0700 IronPort-SDR: pwydFauFi3ZcSoRd+Qs3/m0yEZWFELl3NTmx7KYbU/AoEPSaxRPCc/8RFYTX3fvpI1Z8Ts6Is7 i+MMANSk4MzA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,254,1589266800"; d="scan'208";a="263307868" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.249.173.249]) ([10.249.173.249]) by orsmga007.jf.intel.com with ESMTP; 19 Jun 2020 03:03:01 -0700 Reply-To: like.xu@intel.com Subject: Re: [PATCH RFC] Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU" To: Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Wanpeng Li Cc: Jim Mattson , Maxime Coquelin , linux-kernel@vger.kernel.org References: <20200619094046.654019-1-vkuznets@redhat.com> From: "Xu, Like" Organization: Intel OTC Message-ID: <2c7d6849-7fac-b9f6-7bcb-5509863564f3@intel.com> Date: Fri, 19 Jun 2020 18:03:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200619094046.654019-1-vkuznets@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/6/19 17:40, Vitaly Kuznetsov wrote: > Guest crashes are observed on a Cascade Lake system when 'perf top' is > launched on the host, e.g. Interesting, is it specific to Cascade Lake? Would you mind sharing the output of "cpuid -r -l 1 -1" and "cat /proc/cpuinfo| grep microcode | uniq" with us ? Thanks, Like Xu > > BUG: unable to handle kernel paging request at fffffe0000073038 > PGD 7ffa7067 P4D 7ffa7067 PUD 7ffa6067 PMD 7ffa5067 PTE ffffffffff120 > Oops: 0000 [#1] SMP PTI > CPU: 1 PID: 1 Comm: systemd Not tainted 4.18.0+ #380 > ... > Call Trace: > serial8250_console_write+0xfe/0x1f0 > call_console_drivers.constprop.0+0x9d/0x120 > console_unlock+0x1ea/0x460 > > Call traces are different but the crash is imminent. The problem was > blindly bisected to the commit 041bc42ce2d0 ("KVM: VMX: Micro-optimize > vmexit time when not exposing PMU"). It was also confirmed that the > issue goes away if PMU is exposed to the guest. > > With some instrumentation of the guest we can see what is being switched > (when we do atomic_switch_perf_msrs()): > > vmx_vcpu_run: switching 2 msrs > vmx_vcpu_run: switching MSR38f guest: 70000000d host: 70000000f > vmx_vcpu_run: switching MSR3f1 guest: 0 host: 2 > > The current guess is that PEBS (MSR_IA32_PEBS_ENABLE, 0x3f1) is to blame. > Regardless of whether PMU is exposed to the guest or not, PEBS needs to > be disabled upon switch. > > This reverts commit 041bc42ce2d0efac3b85bbb81dea8c74b81f4ef9. > > Reported-by: Maxime Coquelin > Signed-off-by: Vitaly Kuznetsov > --- > - Perf/KVM interractions are a mystery to me, thus RFC. > --- > arch/x86/kvm/vmx/vmx.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 36c771728c8c..b1a23ad986ff 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6728,8 +6728,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu) > > pt_guest_enter(vmx); > > - if (vcpu_to_pmu(vcpu)->version) > - atomic_switch_perf_msrs(vmx); > + atomic_switch_perf_msrs(vmx); > atomic_switch_umwait_control_msr(vmx); > > if (enable_preemption_timer)