public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <borislav.petkov@amd.com>,
	greg@kroah.com, linux-kernel@vger.kernel.org,
	dougthompson@xmission.com, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 14/21] amd64_edac: add msr accessors operating on all cpus
Date: Tue, 28 Apr 2009 11:31:58 -0700	[thread overview]
Message-ID: <49F74B9E.30105@zytor.com> (raw)
In-Reply-To: <20090428112107.af44e6db.akpm@linux-foundation.org>

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 = cmd.data[0];
>> +	*edx = cmd.data[1];
>> +}
> 
> I'm all confused.  We interrupt _all_ CPUs and get each one of them to
> write to cmd.data[0] and cmd.data[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.

	-hpa

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


  reply	other threads:[~2009-04-28 18:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 15:05 [RFC PATCH 00/21] amd64_edac: EDAC module for AMD64 Borislav Petkov
2009-04-28 15:05 ` [PATCH 01/21] amd64_edac: add PCI config register defines Borislav Petkov
2009-04-28 15:05 ` [PATCH 02/21] amd64_edac: add driver structs Borislav Petkov
2009-04-28 18:13   ` Andrew Morton
2009-04-28 19:02     ` Borislav Petkov
2009-04-28 15:05 ` [PATCH 03/21] amd64_edac: add memory scrubber interface Borislav Petkov
2009-04-28 15:05 ` [PATCH 04/21] amd64_edac: add sys addr to memory controller mapping helpers Borislav Petkov
2009-04-28 15:05 ` [PATCH 05/21] amd64_edac: add functionality to compute the DRAM hole Borislav Petkov
2009-04-28 15:05 ` [PATCH 06/21] amd64_edac: add DRAM address type conversion facilities Borislav Petkov
2009-04-28 15:05 ` [PATCH 07/21] amd64_edac: add helper to dump relevant registers Borislav Petkov
2009-04-28 15:06 ` [PATCH 08/21] amd64_edac: assign DRAM chip select base and mask in a family-specific way Borislav Petkov
2009-04-28 15:06 ` [PATCH 09/21] amd64_edac: add k8-specific methods Borislav Petkov
2009-04-28 15:06 ` [PATCH 10/21] amd64_edac: add f10-and-later methods-p1 Borislav Petkov
2009-04-28 15:06 ` [PATCH 11/21] amd64_edac: add f10-and-later methods-p2 Borislav Petkov
2009-04-28 15:06 ` [PATCH 12/21] amd64_edac: add f10-and-later methods-p3 Borislav Petkov
2009-04-28 15:06 ` [PATCH 13/21] amd64_edac: add per-family descriptors Borislav Petkov
2009-04-28 15:06 ` [PATCH 14/21] amd64_edac: add msr accessors operating on all cpus Borislav Petkov
2009-04-28 18:21   ` Andrew Morton
2009-04-28 18:31     ` H. Peter Anvin [this message]
2009-04-28 19:23     ` Borislav Petkov
2009-04-28 15:06 ` [PATCH 15/21] amd64_edac: add x4 chipkill syndrome mapping table Borislav Petkov
2009-04-28 15:06 ` [PATCH 16/21] amd64_edac: add error decoding logic Borislav Petkov
2009-04-28 15:06 ` [PATCH 17/21] amd64_edac: add EDAC core-related initializers Borislav Petkov
2009-04-28 15:06 ` [PATCH 18/21] amd64_edac: add ECC reporting initializers Borislav Petkov
2009-04-28 15:06 ` [PATCH 19/21] amd64_edac: add debugging/testing code Borislav Petkov
2009-04-28 18:30   ` Andrew Morton
2009-04-28 15:06 ` [PATCH 20/21] amd64_edac: add DRAM error injection logic using sysfs Borislav Petkov
2009-04-28 15:06 ` [PATCH 21/21] amd64_edac: add module registration routines Borislav Petkov
2009-04-28 15:58 ` [RFC PATCH 00/21] amd64_edac: EDAC module for AMD64 Greg KH
2009-04-28 16:06   ` Borislav Petkov
2009-04-28 18:34     ` Andrew Morton
2009-04-28 19:58       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49F74B9E.30105@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=borislav.petkov@amd.com \
    --cc=dougthompson@xmission.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox