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

On Fri, 1 Apr 2022 15:06:27 +0200, Peter Zijlstra wrote:
> If SVM enter/exit don't twiddle with counter EN bits, how is all this
> supposed to work consistently then?

Since KVM currently does not support the "Host/Guest Only" bits (41:40),
CPU wide events created on L1 HV will always count L1 HV and L2, so no
twiddle counter EN bits are needed when {dis,en}abling SVM on L1 HV.

This #GP warning is because KVM does not allow guest to set HO/GO bit,
It has been fixed in this commit 9b026073db2f
("KVM: x86/svm: Clear reserved bits written to PerfEvtSeln MSRs")
and has been merged to 5.18-rc1.

Because the commit df51fe7ea1c1c
("perf/x86/amd: Don't touch the AMD64_EVENTSEL_HOSTONLY bit inside the guest")
is to fix a very similar problem caused by the same reason,
I think it should be revert now, it make things obscure.

And perf_ctr_virt_mask is used to mask Host-Only bit when SVM is disabled,
Using it on a guest doesn't make sense and make things obscure.

I wrote a patch to clarifies what perf_ctr_virt_mask does.

Regards,
Dongli

      reply	other threads:[~2022-04-11 13:41 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
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 [this message]

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=20220411134053.738799-1-sidongli1997@gmail.com \
    --to=kvmx86@gmail.com \
    --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=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=peterz@infradead.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).