Re: [PATCH v2 2/8] x86/msr: Consolidate rdmsr() definitions

From: Jürgen Groß

Date: Wed May 06 2026 - 07:09:32 EST


On 06.05.26 12:25, Yan Zhao wrote:
On Wed, May 06, 2026 at 10:03:26AM +0800, Yan Zhao wrote:
On Wed, Apr 29, 2026 at 11:45:21AM -0700, Dave Hansen wrote:
+/*
+ * Common paravirt and native helpers:
+ */
+#define rdmsr(msr, low, high) \
+do { \
+ u64 __val = paravirt_read_msr((msr)); \
+ (void)((low) = (u32)__val); \
+ (void)((high) = (u32)(__val >> 32)); \
+} while (0)
Rather than direct all (paravirt and native) invocations of rdmsr() to
paravirt_*(), does it make sense to first introduce the common version of
helpers and direct the common version of helpers to paravirt_* or native_*?
So, we can have

+/*
+ * Common paravirt and native helpers:
+ */
+#define rdmsr(msr, low, high) \
+do { \
+ u64 __val = common_read_msr((msr)); \
+ (void)((low) = (u32)__val); \
+ (void)((high) = (u32)(__val >> 32)); \
+} while (0)

Or maybe s/common/trampoline ?

I'd suggest __read_msr() and friends.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature