From: Andrew Cooper <andrew.cooper3@citrix.com>
To: jmattson@google.com
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
bp@alien8.de, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, rafael@kernel.org, tglx@kernel.org,
viresh.kumar@linaro.org, x86@kernel.org, yosry@kernel.org
Subject: Re: [PATCH v2 0/3] Fix three racy updates to MSR_K7_HWCR
Date: Sat, 13 Jun 2026 00:01:33 +0100 [thread overview]
Message-ID: <ced074e6-0316-4e12-848f-52a15a4e0389@citrix.com> (raw)
In-Reply-To: <20260612215729.1532175-1-jmattson@google.com>
> hoists the HWCR update logic out
> into a new helper, amd_update_hwcr(), which performs the read-modify-write
> with interrupts disabled
Add some `perf` to your test scenario and these bugs will reappear, this
time caused by NMIs.
I don't have any good suggestions. Core scope MSRs are horrible because
you can't update them atomically.
At boot time you can fix it by ensuring the RMW will cause both threads
to write the same value (i.e. the modify is not dependent on the read
value, and that there is exactly one WRMSR in the entire kernel for this
MSR).
For runtime with multiple agendas going on, you need some kind of
spinlock because it's a plain concurrency problem.
~Andrew
next prev parent reply other threads:[~2026-06-12 23:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 21:53 [PATCH v2 0/3] Fix three racy updates to MSR_K7_HWCR Jim Mattson
2026-06-12 21:53 ` [PATCH v2 1/3] x86/CPU/AMD: Avoid racy updates to MSR_K7_HWCR in set_cpuid_faulting() Jim Mattson
2026-06-12 22:30 ` Yosry Ahmed
2026-06-16 21:54 ` Jim Mattson
2026-06-12 21:53 ` [PATCH v2 2/3] x86/mce/inject: Avoid racy updates to MSR_K7_HWCR in toggle_hw_mce_inject() Jim Mattson
2026-06-12 21:53 ` [PATCH v2 3/3] cpufreq: ACPI: Avoid racy updates to MSR_K7_HWCR in boost_set_msr() Jim Mattson
2026-06-12 23:01 ` Andrew Cooper [this message]
2026-06-12 23:21 ` [PATCH v2 0/3] Fix three racy updates to MSR_K7_HWCR Jim Mattson
-- strict thread matches above, loose matches on Subject: below --
2026-06-13 1:55 Christian Ludloff
2026-06-13 15:09 ` Jim Mattson
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=ced074e6-0316-4e12-848f-52a15a4e0389@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=jmattson@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=tglx@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=x86@kernel.org \
--cc=yosry@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