Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp22489pxb; Fri, 15 Jan 2021 06:50:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTrAHpCnM40OS+kkfwK3nPulJZEkm89N16faCoguHPgxUoMnwZtbYOi091WiyMJxPCW7U0 X-Received: by 2002:a50:d646:: with SMTP id c6mr9746577edj.177.1610722230887; Fri, 15 Jan 2021 06:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610722230; cv=none; d=google.com; s=arc-20160816; b=l2r9DWjOPMC4aIQOJqzEjoNM/E2HiLVVT/Pqme07AFslsXBO2kuOfStHsZmhDRaRm1 n+3BYCyJW4eYoBxS4fb9U6ghoqtkLZHdnM0mYNoqRkz4NgGUR4R8tlMQJQZ4peksggkb SOPzJmO1hQcX9VfCEFxa8m84pAyTcq3VQFMvhyty1asKUjGSe3BrVxIy5vcJIAE+xBoM iiaQOFf9pv4SsCrHlXG/WWA/vZHgVk5ClMiZl2dBkXouqxIqCOpDi/hmMyTGMk1/1Ysh QXjtHn2+YwXh++p0462EcUD4CRzHVbbPrpAD0dQL/282RGF8JTa4RDpJOje1/B2d00Eg BVJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nJTc/pAdfA38jUmc+xoUyUrdzRZSuGL4fw7w4qEDkgo=; b=f+WG+FSQBdP7HH1ecnhNANPj5v1VAZJwDyUKTsf0QDz2gzxrwyLSOQ6SNAbAp35xQK QjcV712EPan21C/6eW9FgtQfrFuwuUPhnb9x7jXJhqO5H3PjGtg+CJGYT8hwmo+3p4dU 6LEg3quu6XcztDrpFuH0KbmnlcffjrgDljpwJFHLdB3jdv1mLTjCtGK71qR8MGSIN945 U014n9n24d8Fd73qe65jlMxzZJdzzi8kiX5zKO5wx4mWYbHe9AD6Sy59h0bTdgLRSlQ7 YhEVhkRGeXeELCTteQ2mr2nfGNpMeLYBlGq1PI29DWaXbPOgmKExo0wE3bXUyFbDn8fw X+WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JwAZ9NHR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si2839583eds.172.2021.01.15.06.50.06; Fri, 15 Jan 2021 06:50:30 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JwAZ9NHR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732346AbhAOOsJ (ORCPT + 99 others); Fri, 15 Jan 2021 09:48:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730439AbhAOOsJ (ORCPT ); Fri, 15 Jan 2021 09:48:09 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A205C061793; Fri, 15 Jan 2021 06:47:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=nJTc/pAdfA38jUmc+xoUyUrdzRZSuGL4fw7w4qEDkgo=; b=JwAZ9NHR5n4Bsz2eU3EhYVhsdJ KSYfAK+6+e4uNW42H5ZjjkLVXZgswQn3vjNORESYccY5F49xqQKs5H+Xw8CW3Q5OqlkMwk13cBhZ8 rH/ptiHkeXnP0R8gUKlnTpByCacjh5sg9Y5FpvCu9hpQweSpOnn2OPOdVfe+i6QtC8EhfUtOx3h8r 9P/GOwjYO1xze3D1/kpQYO1pSxRzYjO6SG/ymVo4WaW0fEBoPisLJVAWCOBzfAjGKRgZMOcX68Wll jlKh5+nZLfC515ogtRE5JmZSgPlWR7vp5KTMbq5szhvBclKLPdMAfn1jsfTiG9CycNmIoUA2Nv22C 4pQrgoYQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l0QMX-0093Hd-E5; Fri, 15 Jan 2021 14:46:15 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AB3F7301324; Fri, 15 Jan 2021 15:46:04 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9CA3A20D6F7BA; Fri, 15 Jan 2021 15:46:04 +0100 (CET) Date: Fri, 15 Jan 2021 15:46:04 +0100 From: Peter Zijlstra To: Like Xu 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 Subject: Re: [PATCH v3 06/17] KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS Message-ID: References: <20210104131542.495413-1-like.xu@linux.intel.com> <20210104131542.495413-7-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210104131542.495413-7-like.xu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?