Re: [PATCH 01/21] x86: add methods for writing of an MSR on several CPUs

Mauro Carvalho Chehab
2009-05-04T20:53:01Z

Borislav Petkov escreveu:
> On Mon, May 04, 2009 at 10:25:12AM -0700, H. Peter Anvin wrote:
>
>> Borislav Petkov wrote:
>>
>>>> Please, for the love of God, no!
>>>>
>>>> Make it an array of u64s or (equivalently!) an array of (l,h)
>>>> structures, not separate arrays for the halves of the register.
>>>>
>>> how about something like the following then? If there's agreement I could
>>> convert all users to struct msr later.
>>>
>>>
>> I personally would prefer if you just used an array of u64s. The whole
>> l/h split for MSRs was a mistake in the first place.
>>
>
> ... on the other hand, the two u32s kinda resemble more the EDX:EAX
> register pair of rdmsr/wrmsr, hm...
>
> [..]
>
>
>> Or fancier, using gcc's anonymous structs/unions:
>>
>> struct msr {
>> union {
>> struct {
>> u32 l, h;
>> };
>> u64 q;
>> };
>> };
>>
>
> yeah, that sounds good:
>
> --
> From: Borislav Petkov <borislav.petkov@amd.com>
> Date: Wed, 29 Apr 2009 15:20:11 +0200
> Subject: [PATCH 1/2] x86: add methods for writing of an MSR on several CPUs
>
> Add a struct representing a 64bit MSR pair consisting of a low and high
> register part.
>
> Also, rename msr-on-cpu.c to msr.c accordingly.
>
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
>
>
That sounds good also to me.

Reviewed-by: Mauro Carvalho Chehab <mchehab@redhat.com>