x86, msr: Add support for non-contiguous cpumasks
commiteb21839600f406f76a63e6da241db7f361f7ff52
authorBorislav Petkov <borislav.petkov@amd.com>
Fri, 11 Dec 2009 17:14:40 +0000 (11 18:14 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jan 2010 23:05:11 +0000 (6 15:05 -0800)
treef7efefa0768f35354927d6f0e33277e0f23e1c4a
parent26eb2ac67f9296d5b66533e55e9a28a2edd05b48
x86, msr: Add support for non-contiguous cpumasks

commit 505422517d3f126bb939439e9d15dece94e11d2c upstream.

The current rd/wrmsr_on_cpus helpers assume that the supplied
cpumasks are contiguous. However, there are machines out there
like some K8 multinode Opterons which have a non-contiguous core
enumeration on each node (e.g. cores 0,2 on node 0 instead of 0,1), see
http://www.gossamer-threads.com/lists/linux/kernel/1160268.

This patch fixes out-of-bounds writes (see URL above) by adding per-CPU
msr structs which are used on the respective cores.

Additionally, two helpers, msrs_{alloc,free}, are provided for use by
the callers of the MSR accessors.

Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Aristeu Rozanski <aris@redhat.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <20091211171440.GD31998@aftab>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/msr.h
arch/x86/lib/msr.c
drivers/edac/amd64_edac.c