[lkml]   [2009]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 14/21] amd64_edac: add msr accessors operating on all cpus
Andrew Morton wrote:
>> +/* stolen from msr.c - the calls in msr.c could be exported */
> It would be preferable to export the functions from msr.c! We do have a number
> of exported MSR manipulation functions in x86.

Even better would be to add these functions to lib/msr.c.

>> +
>> +static void do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
>> +{
>> + struct msr_command cmd;
>> +
>> + cmd.cpu = raw_smp_processor_id();
>> + cmd.reg = reg;
>> + on_each_cpu(smp_rdmsr, &cmd, 1);
>> + *eax =[0];
>> + *edx =[1];
>> +}
> I'm all confused. We interrupt _all_ CPUs and get each one of them to
> write to[0] and[1]. So what we end up returning is
> the result which was provided by the last CPU which got there,
> whichever CPU that was.
> Am I mising something, or is this all totally screwy?

For reads, certainly... the only sane way to do this would be to return
this into a array with per-CPU slots (since it's transient I don't think
we want to use a percpu varaible.)

For writes, what is there is fine, although perhaps less flexible than
it needs to be.


H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

 \ /
  Last update: 2009-04-28 20:35    [W:0.081 / U:7.440 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site