lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090428112107.af44e6db.akpm@linux-foundation.org>
Date:	Tue, 28 Apr 2009 11:21:07 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Borislav Petkov <borislav.petkov@....com>
Cc:	greg@...ah.com, linux-kernel@...r.kernel.org,
	dougthompson@...ssion.com, borislav.petkov@....com,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 14/21] amd64_edac: add msr accessors operating on all
 cpus

On Tue, 28 Apr 2009 17:06:06 +0200
Borislav Petkov <borislav.petkov@....com> wrote:

> From: Doug Thompson <dougthompson@...ssion.com>
> 
> Signed-off-by: Doug Thompson <dougthompson@...ssion.com>
> Signed-off-by: Borislav Petkov <borislav.petkov@....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?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ