From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] x86/pmu: Explicitly zero PERF_GLOBAL_CTRL at start of PMU test
Date: Tue, 10 Jun 2025 17:15:57 +0800 [thread overview]
Message-ID: <7ea62c73-e568-4481-a498-c565103bc39f@linux.intel.com> (raw)
In-Reply-To: <20250529210157.3791397-1-seanjc@google.com>
On 5/30/2025 5:01 AM, Sean Christopherson wrote:
> Explicitly zero PERF_GLOBAL_CTRL at the start of the PMU test as the
> architectural RESET value of PERF_GLOBAL_CTRL is to set all enable bits
> for general purpose counters (for backwards compatibility with software
> that was written for v1 PMUs). Leaving PERF_GLOBAL_CTRL set can result in
> false failures due to counters unexpectedly being left active.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> x86/pmu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/x86/pmu.c b/x86/pmu.c
> index 8cf26b12..9bd0c186 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -905,9 +905,6 @@ static void set_ref_cycle_expectations(void)
> if (!pmu.nr_gp_counters || !pmu_gp_counter_is_available(2))
> return;
>
> - if (this_cpu_has_perf_global_ctrl())
> - wrmsr(pmu.msr_global_ctl, 0);
> -
> t0 = fenced_rdtsc();
> start_event(&cnt);
> t1 = fenced_rdtsc();
> @@ -956,6 +953,9 @@ int main(int ac, char **av)
> handle_irq(PMI_VECTOR, cnt_overflow);
> buf = malloc(N*64);
>
> + if (this_cpu_has_perf_global_ctrl())
> + wrmsr(pmu.msr_global_ctl, 0);
> +
> check_invalid_rdpmc_gp();
>
> if (pmu.is_intel) {
>
> base-commit: 72d110d8286baf1b355301cc8c8bdb42be2663fb
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
next prev parent reply other threads:[~2025-06-10 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 21:01 [kvm-unit-tests PATCH] x86/pmu: Explicitly zero PERF_GLOBAL_CTRL at start of PMU test Sean Christopherson
2025-06-10 9:15 ` Mi, Dapeng [this message]
2025-06-10 19:42 ` Sean Christopherson
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=7ea62c73-e568-4481-a498-c565103bc39f@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.