Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2668942ybk; Mon, 18 May 2020 05:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4VT8vP4+v8eEkFvB6s0+jJwYhQTjoqQzP7PHNlwnSg5oo7PGi6tOJlTEtRlp0ya3KTlec X-Received: by 2002:a17:906:528e:: with SMTP id c14mr14230614ejm.123.1589803878691; Mon, 18 May 2020 05:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589803878; cv=none; d=google.com; s=arc-20160816; b=ae0o0+DhBK31KE76JR1fF/YVjFVVwOuVzAy0Xs3MzF4/ZqU2gYzyGgJKpRxVggMrAK kl9+oYPLTQk9t9UQ2WVZCN0jksD6g17uXUJISSjYuRXAMryyOOxuxG6WQChvImzU8vhP Ok2zfkJHVcJtdlglgjxV6odGK+xemDmOL9jdVlfFhBJOJGxdOq9e16YtftuKlPv/76Ee u4H33tDMORUVISrIt2Vf4JF8gJk8xnIPAFZ0PTZJUP/i35t5r1GX10qjWhP+6uymhPiZ mNuAE4lqgVty4Rkj8nIiMGxl4lJzNJzFOWkFdmCxgtWzmbBVoIQPXHz07hyxukzWwH/G HnGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2VGBdxQS+aq5Aez0CmebGynNgZc/bdd+iTJZs2pkOaw=; b=lbDY7vz384UzXNQw5BJB40NfDT+/CLgX7yaNNjbn+LUHupjCcSGOzqzM9vjVAdgVyY iGrdsDkYZgLRTaIA4lYwbzBAiZ0Gia66KTT1lkDiddSEnFDen79vDNuRfu8XnmJ+1MkM M2tTVhvg/2wsWqKR2DGI/RBZi8NHVsYCJhf6DHo6taRlqJBHeI30UZke9BAT/pxKcDnW TP6lqq5UqqfqN+pO1plBOXh8ziS7X96QXkQAoKqIgE6IfalwoJzXP1OBvhrNcnc7nhSP ENp29vC60GU5Tj69oogE44r3F+iLINUWUajq5TkCWe6/lq9MhU1cPNamwq4k8hJnWE1D AOUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=g4W6H63Z; 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 d7si2266071edt.176.2020.05.18.05.10.55; Mon, 18 May 2020 05:11:18 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=g4W6H63Z; 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 S1727076AbgERMJM (ORCPT + 99 others); Mon, 18 May 2020 08:09:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46436 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgERMJK (ORCPT ); Mon, 18 May 2020 08:09:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=2VGBdxQS+aq5Aez0CmebGynNgZc/bdd+iTJZs2pkOaw=; b=g4W6H63ZwAfRo19i0iOUdrAmU0 8k3m9gA7ijSIm5dzuH8YEqIjrGjJFukLa1QKT7NlU0NtkMBMdkgvHy9ZPpi7FjAbQCWujfq3zStBL dqkmGDoUJYsfrqXLJUxOFJ6o8C/z0FsEp25I9zXP0qNghdPAuF4mKHFFtm/gKkJ42D4C5BAAP7iTf 1MeU224jjU7NfRAgtX+p13AW/+hbwtaEoJF80z95vaoT3jsEr7Gix2PjvGint6VBA0u+GE9gE+RAq PB/f6VXpvYGCCLuTSum2yzeAweOTBvJkJD2jmlc3PFsuYSXX2/o7J9kfqqfAPNylxayb/nY5MKNza /bT6fWgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jaeTH-0001Sh-5l; Mon, 18 May 2020 12:02: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 21AB23011E8; Mon, 18 May 2020 14:02:06 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0519C2B3D1C58; Mon, 18 May 2020 14:02:05 +0200 (CEST) Date: Mon, 18 May 2020 14:02:05 +0200 From: Peter Zijlstra To: Like Xu Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , ak@linux.intel.com, wei.w.wang@intel.com Subject: Re: [PATCH v11 05/11] perf/x86: Keep LBR stack unchanged in host context for guest LBR event Message-ID: <20200518120205.GF277222@hirez.programming.kicks-ass.net> References: <20200514083054.62538-1-like.xu@linux.intel.com> <20200514083054.62538-6-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514083054.62538-6-like.xu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 04:30:48PM +0800, Like Xu wrote: > @@ -544,7 +562,12 @@ void intel_pmu_lbr_enable_all(bool pmi) > { > struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); > > - if (cpuc->lbr_users) > + /* > + * When the LBR hardware is scheduled for a guest LBR event, > + * the guest will dis/enables LBR itself at the appropriate time, > + * including configuring MSR_LBR_SELECT. > + */ > + if (cpuc->lbr_users && !cpuc->guest_lbr_enabled) > __intel_pmu_lbr_enable(pmi); > } No!, that should be done through perf_event_attr::exclude_host, as I believe all the other KVM event do it.