Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp56844pxb; Fri, 15 Jan 2021 07:32:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTzUXjlTVpeLNxeM2YuOajROxKpKv9J4kNCQtTMYzRevPGLsfgoozhGbdt+rb/yo9AZiIQ X-Received: by 2002:a17:907:3f29:: with SMTP id hq41mr9340292ejc.227.1610724747464; Fri, 15 Jan 2021 07:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610724747; cv=none; d=google.com; s=arc-20160816; b=eeF2qK99HmEgeUPaMdgXd8WzKjw44Q8KWMBltd8Qfl+rPnHJLlusV6F5UzwKBUyDuf 2nlCy104DkFlcfLfJu2AWbM6tzJwzlpYqOTplWlEsPSf36s97wGAvp4QJiDUSJhxgPYg JJxHPnTt9SnyqGgN78Uh/3moJ5m+0k4FJgMWZrQp8mH1EYuXkl5oYXA7/UReApHTbVPn mNY0S3wXd3NoT9fgjCp8jLXJRM0xz0FOA/N3IA4Xzo5VYEwUwV660FNf0tg6WSumndNk 41W+6BGen76cHVhp1a0b0AnT51dFoa6K6zGJ4k/RJSDBk0wYwMj8Pry98/7zJiuIT9Nt C//Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=NeB786J36BW5+Pkb5e5KsMgmkm0n38PTaAjYiEEzBUw=; b=jZnALVC1VhFDpQ3Ly+CtSJIKfL1eEd0QXst4pdf5uDgDtZsnQXTVpa9Cx/LLtsKmgq 5W7se1+4XER0TlurQySWCYaO6t7vlRkkFPDJDjL2ySyi2CkqPQ198BiZpggAGtB5aBEV oVUTzBlyZK6jRexhpzr742fHp91CReJiN1r/c7BRQs61Ac9VZ2ScSoKQgGNXVEdsdZBB hexATepuhL5VS3xSae4IwkDMhm4E7MiPf4Gq+sjCyG+66FkKQjHHMDup/TJY4rSPJtse K4ZTro3G2X5sEasHp4RnUqzxw7Wv2+8ZwJ/68OyhE3yeLGMIoWvxc+9ObzABGD733ViS PSAQ== 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 qx12si3305201ejb.375.2021.01.15.07.32.03; Fri, 15 Jan 2021 07:32:27 -0800 (PST) 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 S1732711AbhAOPaK (ORCPT + 99 others); Fri, 15 Jan 2021 10:30:10 -0500 Received: from mga11.intel.com ([192.55.52.93]:4719 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731683AbhAOPaJ (ORCPT ); Fri, 15 Jan 2021 10:30:09 -0500 IronPort-SDR: xthGdTZlG4BvzfTAX0ZJhQY69vCRu9XcuPlfVP/Gm4rRaimJkQBa9S/bW20YDFM0WPvV1o8PTQ hVjj4ODyOuMg== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="175058065" X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="175058065" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 07:29:29 -0800 IronPort-SDR: Ixg0JjW8VZZZzXk+jB1PStwoRSX9tGBJLAATnjowIqeKWkevJpQ6ocy0moGpwOtqUM7r0REw7l uF8thNaTqmDg== X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="382699941" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.249.174.174]) ([10.249.174.174]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 07:29:24 -0800 Subject: Re: [PATCH v3 06/17] KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS To: Peter Zijlstra Cc: Paolo Bonzini , eranian@google.com, kvm@vger.kernel.org, Ingo Molnar , Sean Christopherson , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Andi Kleen , Kan Liang , wei.w.wang@intel.com, luwei.kang@intel.com, linux-kernel@vger.kernel.org References: <20210104131542.495413-1-like.xu@linux.intel.com> <20210104131542.495413-7-like.xu@linux.intel.com> From: "Xu, Like" Message-ID: Date: Fri, 15 Jan 2021 23:29:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/1/15 22:46, Peter Zijlstra wrote: > On Mon, Jan 04, 2021 at 09:15:31PM +0800, Like Xu wrote: > >> + if (cpuc->pebs_enabled & ~cpuc->intel_ctrl_host_mask) { >> + arr[1].msr = MSR_IA32_PEBS_ENABLE; >> + arr[1].host = cpuc->pebs_enabled & ~cpuc->intel_ctrl_guest_mask; >> + arr[1].guest = cpuc->pebs_enabled & ~cpuc->intel_ctrl_host_mask; >> + /* >> + * The guest PEBS will be disabled once the host PEBS is enabled >> + * since the both enabled case may brings a unknown PMI to >> + * confuse host and the guest PEBS overflow PMI would be missed. >> + */ >> + if (arr[1].host) >> + arr[1].guest = 0; >> + arr[0].guest |= arr[1].guest; >> + *nr = 2; > Elsewhere you write: > >> When we have a PEBS PMI due to guest workload and vm-exits, >> the code path from vm-exit to the host PEBS PMI handler may also >> bring PEBS PMI and mark the status bit. The current PMI handler >> can't distinguish them and would treat the later one as a suspicious >> PMI and output a warning. > So the reason isn't that spurious PMIs are tedious, but that the > hardware is actually doing something weird. > > Or am I not reading things straight? I think the PEBS facility works as expected because in the both enabled case, the first PEBS PMI is generated from host counter 1 based on guest interrupt_threshold and the later PEBS PMI could be generated from host counter 2 based on host interrupt_threshold. Therefore, if we adjust the overflow value to a small value, so that the number of instructions from vm-exit to global ctrl disabling could be enough big to trigger PEBS PMI. Do you think this is weird, or do you see other possibilities ?