RFC x86/msr: Rename MSR access functions
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 16 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | x86/msr: Rename msr_read() and msr_write()arch/ arch/ | +12 | 0 replies | |
| 2/6 | x86/msr: Create a new minimal set of local MSR access functionsarch/ | +38 | 0 replies | |
| 3/6 | x86/msr: Create a new minimal set of inter-CPU MSR access functionsarch/ | +32 | 0 replies | |
| 4/6 | x86/msr: Rename the *_safe_regs[_on_cpu]() MSR functionsarch/ arch/ arch/ +3 more | +32 | 0 replies | |
| 5/6 | x86/events: Switch core parts to use new MSR access functionsarch/ arch/ arch/ +2 more | +40 | 0 replies | |
| 6/6 | x86/cpu/mce: Switch code to use new MSR access functionsarch/ arch/ arch/ +3 more | +109 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH RFC 0/6] x86/msr: Rename MSR access functions
This is a RFC for renaming the main MSR access functions. The main motivations for doing that are:
- Prepare for wide spread use cases of WRMSRNS by making it easily visible whether a MSR write is serializing or not. This has the advantage that new use cases of MSR writes would need to decide whether a serializing MSR write is needed or not. Using today's MSR write interfaces would probably result in most new use cases to use the serializing form, having a negative performance impact.
- Use functions instead of macros for accessing MSRs, which will drop modifying variables passed as a parameter.
- Eliminate multiple accessors doing exactly the same thing (e.g. rdmsrl() and rdmsrq()).
- Instead of having function names based on the underlying instruction mnemonics, have functions of a common name space (msr_*()).
This series is containing only a needed prerequisite patch removing a name collision with the new access functions, 3 patches introducing the new access functions, and 2 example patches adapting users to use the new functions instead the old ones.
I have selected the 2 example patches based on the needed code changes:
Patch 5 is very simple, because all the changes are really trivial. While using a mixture of serializing and non-serializing MSR writes, the non-serializing form is used only in case another MSR write is following in the same function, resulting in each function doing MSR writes having still serializing semantics (it might be possible to change that later, but I wanted to be conservative just in case).
Patch 6 is a little bit less simple, as there are a couple of cases where the new functions are no direct replacements of the old interfaces. The new functions only work on 64-bit values, so in cases where 2 32-bit values are needed, "struct msr" is used as a conversion layer. I thought about adding macros for the same purpose, but in the end this seemed to be a more simple and readable solution.
In case the general idea is accepted, I'd do the conversion of the rest of the users (this will be probably a rather large, but mostly trivial series).
As this series is RFC, I have done only basic compile testing.
Juergen Gross (6):
x86/msr: Rename msr_read() and msr_write()
x86/msr: Create a new minimal set of local MSR access functions x86/msr: Create a new minimal set of inter-CPU MSR access functions x86/msr: Rename the *_safe_regs[_on_cpu]() MSR functions x86/events: Switch core parts to use new MSR access functions x86/cpu/mce: Switch code to use new MSR access functions
arch/x86/events/core.c | 42 ++++++------- arch/x86/events/msr.c | 2 +- arch/x86/events/perf_event.h | 26 ++++---- arch/x86/events/probe.c | 2 +- arch/x86/events/rapl.c | 8 +-- arch/x86/include/asm/msr.h | 87 ++++++++++++++++++++++--- arch/x86/kernel/cpu/amd.c | 4 +- arch/x86/kernel/cpu/mce/amd.c | 101 +++++++++++++++--------------- arch/x86/kernel/cpu/mce/core.c | 18 +++--- arch/x86/kernel/cpu/mce/inject.c | 40 ++++++------ arch/x86/kernel/cpu/mce/intel.c | 32 +++++----- arch/x86/kernel/cpu/mce/p5.c | 16 ++--- arch/x86/kernel/cpu/mce/winchip.c | 10 +-- arch/x86/kernel/msr.c | 16 ++--- arch/x86/lib/msr-reg-export.c | 4 +- arch/x86/lib/msr-reg.S | 16 ++--- arch/x86/lib/msr-smp.c | 20 +++--- arch/x86/lib/msr.c | 12 ++-- 18 files changed, 263 insertions(+), 193 deletions(-)
Signature · 1 line
2.53.0