From: Andrew Morton <akpm@linux-foundation.org>
To: Borislav Petkov <borislav.petkov@amd.com>
Cc: greg@kroah.com, linux-kernel@vger.kernel.org,
dougthompson@xmission.com, borislav.petkov@amd.com,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 14/21] amd64_edac: add msr accessors operating on all cpus
Date: Tue, 28 Apr 2009 11:21:07 -0700 [thread overview]
Message-ID: <20090428112107.af44e6db.akpm@linux-foundation.org> (raw)
In-Reply-To: <1240931173-17477-15-git-send-email-borislav.petkov@amd.com>
On Tue, 28 Apr 2009 17:06:06 +0200
Borislav Petkov <borislav.petkov@amd.com> wrote:
> From: Doug Thompson <dougthompson@xmission.com>
>
> Signed-off-by: Doug Thompson <dougthompson@xmission.com>
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
> drivers/edac/amd64_edac.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index ac4e265..49c0ce0 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -3121,4 +3121,46 @@ static struct pci_dev *pci_get_related_function(unsigned int vendor,
> return dev;
> }
>
> +/* 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.
> +struct msr_command {
> + int cpu;
> + int err;
> + u32 reg;
> + u32 data[2];
> +};
> +
> +static void smp_wrmsr(void *cmd_block)
> +{
> + struct msr_command *cmd = cmd_block;
> + wrmsr(cmd->reg, cmd->data[0], cmd->data[1]);
> +}
> +
> +static void smp_rdmsr(void *cmd_block)
> +{
> + struct msr_command *cmd = cmd_block;
> + rdmsr(cmd->reg, cmd->data[0], cmd->data[1]);
> +}
> +
> +static void do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
> +{
> + struct msr_command cmd;
> +
> + cmd.cpu = raw_smp_processor_id();
> + cmd.reg = reg;
> + cmd.data[0] = eax;
> + cmd.data[1] = edx;
> + on_each_cpu(smp_wrmsr, &cmd, 1);
> +}
> +
> +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?
next prev parent reply other threads:[~2009-04-28 18:26 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 [this message]
2009-04-28 18:31 ` H. Peter Anvin
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=20090428112107.af44e6db.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=borislav.petkov@amd.com \
--cc=dougthompson@xmission.com \
--cc=greg@kroah.com \
--cc=hpa@zytor.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