linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dongli Si <kvmx86@gmail.com>
Cc: joro@8bytes.org, liam.merwick@oracle.com, kim.phillips@amd.com,
	mingo@kernel.org, acme@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] perf/x86/amd: Don't touch the Host-only bit inside the guest hypervisor
Date: Thu, 24 Mar 2022 11:42:17 +0100	[thread overview]
Message-ID: <20220324104217.GE8939@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220320002106.1800166-1-sidongli1997@gmail.com>

On Sun, Mar 20, 2022 at 08:21:06AM +0800, Dongli Si wrote:

> @@ -1027,7 +1028,8 @@ void amd_pmu_enable_virt(void)
>  {
>  	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
>  
> -	cpuc->perf_ctr_virt_mask = 0;
> +	if (hypervisor_is_type(X86_HYPER_NATIVE))
> +		cpuc->perf_ctr_virt_mask = 0;

So I had to go and read the original commit to figure out wth this code
is supposed to be doing. I'm thinking this all can use a wee comment.

Also, the above is very ambiguous as to what it does. Specifically if we
don't set perf_ctr_virt_mask, then what is the actual value (yes, I
know, but its not very clear is it). Also, if we don't in fact change
perf_ctr_virt_mask then these following two lines:

>  
>  	/* Reload all events */
>  	amd_pmu_disable_all();
	amd_pmu_enable_all(0);

are somewhat completely pointless, no?

So can we please get a patch that clarifies things instead of making
things even more obscure?

  reply	other threads:[~2022-03-24 10:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20  0:21 [PATCH v4] perf/x86/amd: Don't touch the Host-only bit inside the guest hypervisor Dongli Si
2022-03-24 10:42 ` Peter Zijlstra [this message]
2022-03-27 10:56   ` Dongli Si
2022-03-28 14:03     ` Peter Zijlstra
2022-04-01  8:29       ` Dongli Si
2022-04-01 13:06         ` Peter Zijlstra
2022-04-11 13:40           ` Dongli Si

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220324104217.GE8939@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=joro@8bytes.org \
    --cc=kim.phillips@amd.com \
    --cc=kvmx86@gmail.com \
    --cc=liam.merwick@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).