linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Levitsky <mlevitsk@redhat.com>
To: Sandipan Das <sandipan.das@amd.com>
Cc: linux-perf-users@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org
Subject: Small question about reserved bits in MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR
Date: Mon, 16 Sep 2024 14:54:58 -0400	[thread overview]
Message-ID: <5ddfb6576d751aa948069edc905626ca27e175ae.camel@redhat.com> (raw)

Hi!

We recently saw a failure in one of the aws VM instances that causes the following error during the guest boot:

 0.480051] unchecked MSR access error: WRMSR to 0xc0000302 (tried to write 0x040000000000001f) at rIP: 0xffffffff96c093e2 (amd_pmu_cpu_reset.constprop.0+0x42/0x80)


I investigated the issue and I see that the hypervisor does expose PerfmonV2, but not the LBRv2 support:

#  cpuid -1 -l 0x80000022 
CPU:
   Extended Performance Monitoring and Debugging (0x80000022):
      AMD performance monitoring V2         = true
      AMD LBR V2                            = false
      AMD LBR stack & PMC freezing          = false
      number of core perf ctrs              = 0x5 (5)
      number of LBR stack entries           = 0x0 (0)
      number of avail Northbridge perf ctrs = 0x0 (0)
      number of available UMC PMCs          = 0x0 (0)
      active UMCs bitmask                   = 0x0

I also verified that I can write 0x1f to 0xc0000302 but not 0x040000000000001f:

# wrmsr 0xc0000302 0x1f
# wrmsr 0xc0000302 0x040000000000001f
wrmsr: CPU 0 cannot set MSR 0xc0000302 to 0x040000000000001f
#

The AMD's APM is not clear on what should happen if unsupported bits are attempted to be cleared
using this MSR.

Also I noticed that amd_pmu_v2_handle_irq writes 0xffffffffffffffff to this msrs.
It has the following code:


	WARN_ON(status > 0);

	/* Clear overflow and freeze bits */
	amd_pmu_ack_global_status(~status);


This implies that it is OK to set all bits in this MSR.


Can you please take a look?


Thanks in advance,
   Best regards,
	Maxim Levitsky


             reply	other threads:[~2024-09-16 18:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16 18:54 Maxim Levitsky [this message]
2024-09-16 20:41 ` Small question about reserved bits in MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR dongli.zhang
2024-09-17  5:52   ` Sandipan Das
2024-09-17 12:54     ` Maxim Levitsky
2024-11-11 16:57       ` Josh Triplett

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=5ddfb6576d751aa948069edc905626ca27e175ae.camel@redhat.com \
    --to=mlevitsk@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sandipan.das@amd.com \
    --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).