Re: [RFC PATCH v1 01/15] x86/msr: Replace __wrmsr() with native_wrmsrl()

From: H. Peter Anvin
Date: Thu Apr 03 2025 - 02:04:01 EST


On April 2, 2025 10:09:21 PM PDT, Xin Li <xin@xxxxxxxxx> wrote:
>On 4/1/2025 12:52 AM, Ingo Molnar wrote:
>>> Should we rename the *msrl() functions to *msrq() as part of this
>>> overhaul?
>> Yeah, that's a good idea, and because talk is cheap I just implemented
>> this in the tip:WIP.x86/msr branch with a couple of other cleanups in
>> this area (see the shortlog & diffstat below), but the churn is high:
>>
>> 144 files changed, 1034 insertions(+), 1034 deletions(-)
>
>Hi Ingo,
>
>I noticed that you keep the type of MSR index in these patches as
>"unsigned int".
>
>I'm thinking would it be better to standardize it as "u32"?
>
>Because:
>1) MSR index is placed in ECX to execute MSR instructions, and the
> high-order 32 bits of RCX are ignored on 64-bit.
>2) MSR index is encoded as a 32-bit immediate in the new immediate form
> MSR instructions.
>
>Thanks!
> Xin

"unsigned int" and "u32" are synonymous, but the latter is more explicit and would be better.