2009-12-16 07:32:22

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: Tree for December 16

Hi all,

My usual call for calm: please do not put stuff destined for 2.6.34 into
linux-next trees until after 2.6.33-rc1.

Changes since 20091215:

The origin tree lost its build failure.

The avr32 tree lost its conflict.

The microblaze tree lost its conflict.

The mips tree lost 4 of its conflicts.

The acpi tree still has its build failure so I used the version from
next-20091211. It also gained a conflict against Linus' tree.

The voltage tree lost its conflicts but gained a build failure that
required the revert of 5 commits.

The hwpoison tree gained a conflict against Linus' tree.

The hwpoison tree gained a build failure for which I applied a merge
fixup patch.

----------------------------------------------------------------------------

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/v2.6/next/ ). If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one. You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source. There are also quilt-import.log and merge.log files
in the Next directory. Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64. After the
final fixups (if any), it is also built with powerpc allnoconfig (32 and
64 bit), ppc44x_defconfig and allyesconfig (minus
CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc
and sparc64 defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

We are up to 155 trees (counting Linus' and 22 trees of patches pending
for Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Jan Dittmer for adding the linux-next tree to his build tests
at http://l4x.org/k/ , the guys at http://test.kernel.org/ and Randy
Dunlap for doing many randconfig builds.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ . Thanks to Frank Seidel.

--
Cheers,
Stephen Rothwell [email protected]

$ git checkout master
$ git reset --hard stable
Merging origin/master
Merging fixes/fixes
Merging arm-current/master
Merging m68k-current/for-linus
Merging powerpc-merge/merge
Merging sparc-current/master
Merging scsi-rc-fixes/master
Merging net-current/master
Merging sound-current/for-linus
Merging pci-current/for-linus
Merging wireless-current/master
Merging kbuild-current/for-linus
Merging quilt/driver-core.current
Merging quilt/tty.current
Merging quilt/usb.current
Merging quilt/staging.current
Merging cpufreq-current/fixes
Merging input-current/for-linus
Merging md-current/for-linus
Merging audit-current/for-linus
Merging crypto-current/master
Merging ide-curent/master
Merging dwmw2/master
Merging arm/devel
Merging davinci/davinci-next
Merging msm/for-next
Merging omap/for-next
Merging pxa/for-next
Merging samsung/next-samsung
Merging avr32/avr32-arch
Merging blackfin/for-linus
Merging cris/for-next
Merging ia64/test
Merging m68k/for-next
Merging m68knommu/for-next
CONFLICT (content): Merge conflict in arch/m68k/include/asm/ptrace.h
Merging microblaze/next
Merging mips/mips-for-linux-next
CONFLICT (content): Merge conflict in drivers/pcmcia/Makefile
CONFLICT (content): Merge conflict in scripts/recordmcount.pl
Merging parisc/next
Merging powerpc/next
Merging 4xx/next
Merging 52xx-and-virtex/next
CONFLICT (content): Merge conflict in arch/powerpc/mm/fsl_booke_mmu.c
Merging galak/next
Merging s390/features
Merging sh/master
Merging sparc/master
Merging xtensa/master
Merging ceph/for-next
Merging cifs/master
Merging configfs/linux-next
Merging ecryptfs/next
Merging ext3/for_next
Merging ext4/next
Merging fatfs/master
Merging fuse/for-next
Merging gfs2/master
Merging jfs/next
Merging logfs/master
Merging nfs/linux-next
Merging nfsd/nfsd-next
Merging nilfs2/for-next
Merging ocfs2/linux-next
Merging squashfs/master
Merging udf/for_next
Merging v9fs/for-next
CONFLICT (add/add): Merge conflict in fs/9p/cache.c
Merging ubifs/linux-next
Merging xfs/master
Merging reiserfs-bkl/reiserfs/kill-bkl
Merging vfs/for-next
Merging pci/linux-next
Merging hid/for-next
Merging quilt/i2c
Merging bjdooks-i2c/next-i2c
Merging quilt/jdelvare-hwmon
Merging quilt/kernel-doc
Merging v4l-dvb/master
Merging kbuild/for-next
Merging kconfig/for-next
Merging ide/master
Merging libata/NEXT
Merging infiniband/for-next
Merging acpi/test
CONFLICT (content): Merge conflict in Documentation/feature-removal-schedule.txt
CONFLICT (content): Merge conflict in drivers/platform/x86/eeepc-laptop.c
CONFLICT (content): Merge conflict in include/acpi/processor.h
$ git reset --hard HEAD^
Merging refs/next/20091211/acpi
CONFLICT (content): Merge conflict in Documentation/feature-removal-schedule.txt
CONFLICT (content): Merge conflict in drivers/platform/x86/eeepc-laptop.c
CONFLICT (content): Merge conflict in include/acpi/processor.h
Merging ieee1394/for-next
CONFLICT (content): Merge conflict in drivers/media/dvb/firewire/firedtv-1394.c
CONFLICT (content): Merge conflict in drivers/media/dvb/firewire/firedtv-avc.c
CONFLICT (add/add): Merge conflict in drivers/media/dvb/firewire/firedtv-fw.c
CONFLICT (content): Merge conflict in drivers/media/dvb/firewire/firedtv.h
Merging ubi/linux-next
Merging kvm/linux-next
Merging dlm/next
Merging scsi/master
Merging async_tx/next
Merging net/master
Merging wireless/master
Merging mtd/master
CONFLICT (content): Merge conflict in drivers/mtd/devices/m25p80.c
CONFLICT (content): Merge conflict in drivers/mtd/maps/pcmciamtd.c
CONFLICT (delete/modify): drivers/mtd/nand/excite_nandflash.c deleted in HEAD and modified in mtd/master. Version mtd/master of drivers/mtd/nand/excite_nandflash.c left in tree.
CONFLICT (content): Merge conflict in drivers/mtd/nand/pxa3xx_nand.c
CONFLICT (content): Merge conflict in kernel/printk.c
$ git rm -f drivers/mtd/nand/excite_nandflash.c
Merging crypto/master
Merging sound/for-next
Merging cpufreq/next
Merging quilt/rr
Applying: modpost: autoconf.h has moved to include/generated
Applying: rr: cpufreq: fix up for api name change
Merging mmc/next
Merging tmio-mmc/linux-next
Merging input/next
Merging lsm/for-next
Merging block/for-next
Merging quilt/device-mapper
Merging embedded/master
Merging firmware/master
Merging pcmcia/master
Merging battery/master
Merging leds/for-mm
Merging backlight/for-mm
CONFLICT (content): Merge conflict in drivers/platform/x86/thinkpad_acpi.c
Merging kgdb/kgdb-next
Merging slab/for-next
Merging uclinux/for-next
Merging md/for-next
Merging mfd/for-next
Merging hdlc/hdlc-next
Merging drm/drm-next
CONFLICT (content): Merge conflict in drivers/gpu/drm/drm_fb_helper.c
Merging voltage/for-next
Merging security-testing/next
Merging lblnet/master
Merging agp/agp-next
Merging uwb/for-upstream
Merging watchdog/master
Merging bdev/master
Merging dwmw2-iommu/master
Merging cputime/cputime
Merging osd/linux-next
Merging jc_docs/docs-next
Merging nommu/master
Merging trivial/for-next
Merging audit/for-next
Merging quilt/aoe
Merging suspend/linux-next
Merging bluetooth/master
Merging fsnotify/for-next
CONFLICT (content): Merge conflict in arch/x86/ia32/ia32entry.S
CONFLICT (content): Merge conflict in arch/x86/include/asm/unistd_32.h
CONFLICT (content): Merge conflict in arch/x86/include/asm/unistd_64.h
CONFLICT (content): Merge conflict in arch/x86/kernel/syscall_table_32.S
CONFLICT (content): Merge conflict in fs/afs/write.c
CONFLICT (content): Merge conflict in fs/cifs/dir.c
CONFLICT (content): Merge conflict in fs/ubifs/file.c
CONFLICT (content): Merge conflict in include/asm-generic/fcntl.h
CONFLICT (content): Merge conflict in include/net/compat.h
CONFLICT (content): Merge conflict in net/compat.c
CONFLICT (content): Merge conflict in net/socket.c
Merging irda/for-next
CONFLICT (content): Merge conflict in drivers/net/irda/irda-usb.c
Merging hwlat/for-linus
CONFLICT (content): Merge conflict in drivers/misc/Makefile
Merging drbd/for-jens
Merging catalin/for-next
Merging alacrity/linux-next
CONFLICT (content): Merge conflict in include/linux/Kbuild
CONFLICT (content): Merge conflict in lib/Kconfig
Merging i7core_edac/linux_next
Merging devicetree/next-devicetree
Merging spi/next-spi
Merging limits/writable_limits
CONFLICT (content): Merge conflict in arch/x86/ia32/ia32entry.S
CONFLICT (content): Merge conflict in arch/x86/include/asm/unistd_32.h
CONFLICT (content): Merge conflict in arch/x86/include/asm/unistd_64.h
CONFLICT (content): Merge conflict in arch/x86/kernel/syscall_table_32.S
Merging omap_dss2/for-next
Merging tip/auto-latest
Merging edac-amd/for-next
Merging oprofile/for-next
Merging percpu/for-next
Merging workqueues/for-next
Merging sfi/sfi-test
Merging asm-generic/next
Merging hwpoison/hwpoison
CONFLICT (content): Merge conflict in MAINTAINERS
CONFLICT (content): Merge conflict in mm/memcontrol.c
Applying: hwpoison: fix for migrate_pages API change
Merging sysctl/master
Merging quilt/driver-core
Merging quilt/tty
Merging quilt/usb
Merging quilt/staging
Merging scsi-post-merge/master
[master 2bbac8a] Revert "twl4030-regulator: Fixes VAUX1-3 exclusion introduced"
[master 7b9fa19] Revert "Reset REMAP configuration in regulator probe"
[master e9fcc36] Revert "Define critical regulators as always_on"
[master 572df07] Revert "twl4030-regulator: Add all TWL regulators to twreg_info"
[master e890b10] Revert "twl4030-regulator: Remove regulator from all groups when disabling"


Attachments:
(No filename) (9.78 kB)
(No filename) (198.00 B)
Download all attachments

2009-12-16 17:24:53

by Randy Dunlap

[permalink] [raw]
Subject: Re: linux-next: Tree for December 16 (amd64_edac)

On Wed, 16 Dec 2009 18:32:12 +1100 Stephen Rothwell wrote:

> Hi all,
>
> My usual call for calm: please do not put stuff destined for 2.6.34 into
> linux-next trees until after 2.6.33-rc1.
>
> Changes since 20091215:


When CONFIG_SMP=n, CONFIG_X86_MSR=m:

ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!


Should EDAC_AMD64 also depend on SMP?

---
~Randy

2009-12-16 17:33:02

by H. Peter Anvin

[permalink] [raw]
Subject: Re: linux-next: Tree for December 16 (amd64_edac)

On 12/16/2009 09:24 AM, Randy Dunlap wrote:
> On Wed, 16 Dec 2009 18:32:12 +1100 Stephen Rothwell wrote:
>
>> Hi all,
>>
>> My usual call for calm: please do not put stuff destined for 2.6.34 into
>> linux-next trees until after 2.6.33-rc1.
>>
>> Changes since 20091215:
>
>
> When CONFIG_SMP=n, CONFIG_X86_MSR=m:
>
> ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
> ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!
>
>
> Should EDAC_AMD64 also depend on SMP?
>

That seems absurd... more likely msrs_free/msrs_alloc should not be
SMP-specific, or stubs need to be provided.

-hpa

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

Subject: Re: linux-next: Tree for December 16 (amd64_edac)

On Wed, Dec 16, 2009 at 09:32:45AM -0800, H. Peter Anvin wrote:
> On 12/16/2009 09:24 AM, Randy Dunlap wrote:
> > On Wed, 16 Dec 2009 18:32:12 +1100 Stephen Rothwell wrote:
> >
> >> Hi all,
> >>
> >> My usual call for calm: please do not put stuff destined for 2.6.34 into
> >> linux-next trees until after 2.6.33-rc1.
> >>
> >> Changes since 20091215:
> >
> >
> > When CONFIG_SMP=n, CONFIG_X86_MSR=m:
> >
> > ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
> > ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!
> >
> >
> > Should EDAC_AMD64 also depend on SMP?
> >
>
> That seems absurd... more likely msrs_free/msrs_alloc should not be
> SMP-specific, or stubs need to be provided.

see <arch/x86/lib/Makefile>:

obj-$(CONFIG_SMP) := msr.o

--
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
System | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. M?nchen, Germany
Research | Gesch?ftsf?hrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis M?nchen
(OSRC) | Registergericht M?nchen, HRB Nr. 43632

2009-12-16 18:38:49

by H. Peter Anvin

[permalink] [raw]
Subject: Re: linux-next: Tree for December 16 (amd64_edac)

On 12/16/2009 09:45 AM, Borislav Petkov wrote:
>>>
>>> Should EDAC_AMD64 also depend on SMP?
>>
>> That seems absurd... more likely msrs_free/msrs_alloc should not be
>> SMP-specific, or stubs need to be provided.
>
> see <arch/x86/lib/Makefile>:
>
> obj-$(CONFIG_SMP) := msr.o
>

Yes, because the stubs live as inlines in arch/x86/include/asm/msr.h.

This needs to be fixed ASAP.

-hpa

2009-12-16 21:51:27

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n

From: Randy Dunlap <[email protected]>

Rearrange arch/x86/lib/msr.c so that alloc/free are built and
usable when CONFIG_SMP=n. Fixes build of amd64_edac.

ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!

---
arch/x86/lib/Makefile | 2 -
arch/x86/lib/msr.c | 42 ++++++++++++++++++++--------------------
2 files changed, 23 insertions(+), 21 deletions(-)

--- linux-next-20091216.orig/arch/x86/lib/Makefile
+++ linux-next-20091216/arch/x86/lib/Makefile
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c

clean-files := inat-tables.c

-obj-$(CONFIG_SMP) := msr.o
+obj-$(CONFIG_X86_MSR) := msr.o

lib-y := delay.o
lib-y += thunk_$(BITS).o
--- linux-next-20091216.orig/arch/x86/lib/msr.c
+++ linux-next-20091216/arch/x86/lib/msr.c
@@ -10,6 +10,7 @@ struct msr_info {
int err;
};

+#ifdef CONFIG_SMP
static void __rdmsr_on_cpu(void *info)
{
struct msr_info *rv = info;
@@ -118,26 +119,6 @@ void wrmsr_on_cpus(const struct cpumask
}
EXPORT_SYMBOL(wrmsr_on_cpus);

-struct msr *msrs_alloc(void)
-{
- struct msr *msrs = NULL;
-
- msrs = alloc_percpu(struct msr);
- if (!msrs) {
- pr_warning("%s: error allocating msrs\n", __func__);
- return NULL;
- }
-
- return msrs;
-}
-EXPORT_SYMBOL(msrs_alloc);
-
-void msrs_free(struct msr *msrs)
-{
- free_percpu(msrs);
-}
-EXPORT_SYMBOL(msrs_free);
-
/* These "safe" variants are slower and should be used when the target MSR
may not actually exist. */
static void __rdmsr_safe_on_cpu(void *info)
@@ -234,3 +215,24 @@ int wrmsr_safe_regs_on_cpu(unsigned int
return err ? err : rv.err;
}
EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
+#endif
+
+struct msr *msrs_alloc(void)
+{
+ struct msr *msrs = NULL;
+
+ msrs = alloc_percpu(struct msr);
+ if (!msrs) {
+ pr_warning("%s: error allocating msrs\n", __func__);
+ return NULL;
+ }
+
+ return msrs;
+}
+EXPORT_SYMBOL(msrs_alloc);
+
+void msrs_free(struct msr *msrs)
+{
+ free_percpu(msrs);
+}
+EXPORT_SYMBOL(msrs_free);

2009-12-16 21:54:24

by Borislav Petkov

[permalink] [raw]
Subject: Re: linux-next: Tree for December 16 (amd64_edac)

On Wed, Dec 16, 2009 at 10:36:28AM -0800, H. Peter Anvin wrote:
> On 12/16/2009 09:45 AM, Borislav Petkov wrote:
> >>>
> >>> Should EDAC_AMD64 also depend on SMP?
> >>
> >> That seems absurd... more likely msrs_free/msrs_alloc should not be
> >> SMP-specific, or stubs need to be provided.
> >
> > see <arch/x86/lib/Makefile>:
> >
> > obj-$(CONFIG_SMP) := msr.o
> >
>
> Yes, because the stubs live as inlines in arch/x86/include/asm/msr.h.
>
> This needs to be fixed ASAP.

Well, how about something in the likes of below:

---
From: Borislav Petkov <[email protected]>
Date: Wed, 16 Dec 2009 22:49:18 +0100
Subject: [PATCH] x86, msr: fix CONFIG_SMP=n build

Randy Dunlap reported the following build error:

"When CONFIG_SMP=n, CONFIG_X86_MSR=m:

ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!"

This is due to the fact that <arch/x86/lib/msr.c> is conditioned on
CONFIG_SMP and in the UP case we have only the stubs in the header. Pull
CONFIG_SMP into the aforementioned file and make msrs_{alloc,free} build
unconditionally.

Cc: Randy Dunlap <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
---
arch/x86/lib/Makefile | 4 +---
arch/x86/lib/msr.c | 44 ++++++++++++++++++++++++--------------------
2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 45b20e4..1a0e470 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -14,15 +14,13 @@ $(obj)/inat.o: $(obj)/inat-tables.c

clean-files := inat-tables.c

-obj-$(CONFIG_SMP) := msr.o
-
lib-y := delay.o
lib-y += thunk_$(BITS).o
lib-y += usercopy_$(BITS).o getuser.o putuser.o
lib-y += memcpy_$(BITS).o
lib-$(CONFIG_KPROBES) += insn.o inat.o

-obj-y += msr-reg.o msr-reg-export.o
+obj-y += msr.o msr-reg.o msr-reg-export.o

ifeq ($(CONFIG_X86_32),y)
obj-y += atomic64_32.o
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 8728341..542fbb4 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -10,6 +10,7 @@ struct msr_info {
int err;
};

+#ifdef CONFIG_SMP
static void __rdmsr_on_cpu(void *info)
{
struct msr_info *rv = info;
@@ -118,26 +119,6 @@ void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
}
EXPORT_SYMBOL(wrmsr_on_cpus);

-struct msr *msrs_alloc(void)
-{
- struct msr *msrs = NULL;
-
- msrs = alloc_percpu(struct msr);
- if (!msrs) {
- pr_warning("%s: error allocating msrs\n", __func__);
- return NULL;
- }
-
- return msrs;
-}
-EXPORT_SYMBOL(msrs_alloc);
-
-void msrs_free(struct msr *msrs)
-{
- free_percpu(msrs);
-}
-EXPORT_SYMBOL(msrs_free);
-
/* These "safe" variants are slower and should be used when the target MSR
may not actually exist. */
static void __rdmsr_safe_on_cpu(void *info)
@@ -234,3 +215,26 @@ int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
return err ? err : rv.err;
}
EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
+#endif /* CONFIG_SMP */
+
+struct msr *msrs_alloc(void)
+{
+ struct msr *msrs = NULL;
+
+ msrs = alloc_percpu(struct msr);
+ if (!msrs) {
+ pr_warning("%s: error allocating msrs\n", __func__);
+ return NULL;
+ }
+
+ return msrs;
+}
+EXPORT_SYMBOL(msrs_alloc);
+
+void msrs_free(struct msr *msrs)
+{
+ free_percpu(msrs);
+}
+EXPORT_SYMBOL(msrs_free);
+
+
--
1.6.5


--
Regards/Gruss,
Boris.

2009-12-16 21:58:20

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n

On Wed, Dec 16, 2009 at 01:51:19PM -0800, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
> Rearrange arch/x86/lib/msr.c so that alloc/free are built and
> usable when CONFIG_SMP=n. Fixes build of amd64_edac.
>
> ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
> ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!
>
> ---
> arch/x86/lib/Makefile | 2 -
> arch/x86/lib/msr.c | 42 ++++++++++++++++++++--------------------
> 2 files changed, 23 insertions(+), 21 deletions(-)

Haha, I just sent a very similar one :)

>
> --- linux-next-20091216.orig/arch/x86/lib/Makefile
> +++ linux-next-20091216/arch/x86/lib/Makefile
> @@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
>
> clean-files := inat-tables.c
>
> -obj-$(CONFIG_SMP) := msr.o
> +obj-$(CONFIG_X86_MSR) := msr.o

however, CONFIG_X86_MSR is the x86 MSR access module and the <lib/msr.c>
is the library of MSR accessing functions which is always in. So this
should be unconditional as in my version or Peter might have a better
idea...?

--
Regards/Gruss,
Boris.

2009-12-16 22:02:23

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n

On Wed, 16 Dec 2009 22:58:08 +0100 Borislav Petkov wrote:

> On Wed, Dec 16, 2009 at 01:51:19PM -0800, Randy Dunlap wrote:
> > From: Randy Dunlap <[email protected]>
> >
> > Rearrange arch/x86/lib/msr.c so that alloc/free are built and
> > usable when CONFIG_SMP=n. Fixes build of amd64_edac.
> >
> > ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
> > ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!
> >
> > ---
> > arch/x86/lib/Makefile | 2 -
> > arch/x86/lib/msr.c | 42 ++++++++++++++++++++--------------------
> > 2 files changed, 23 insertions(+), 21 deletions(-)
>
> Haha, I just sent a very similar one :)

Yes, I noticed.

> >
> > --- linux-next-20091216.orig/arch/x86/lib/Makefile
> > +++ linux-next-20091216/arch/x86/lib/Makefile
> > @@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
> >
> > clean-files := inat-tables.c
> >
> > -obj-$(CONFIG_SMP) := msr.o
> > +obj-$(CONFIG_X86_MSR) := msr.o
>
> however, CONFIG_X86_MSR is the x86 MSR access module and the <lib/msr.c>
> is the library of MSR accessing functions which is always in. So this
> should be unconditional as in my version or Peter might have a better
> idea...?

Sure, whichever is OK with me.

---
~Randy

2009-12-16 22:26:23

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH -next] power: fix printk formats

From: Randy Dunlap <[email protected]>

Fix printk format warnings:

drivers/base/power/main.c:398:warning: format '%Lu' expects type 'long long unsigned int', but argument 5 has type 'long int'
drivers/base/power/main.c:398:warning: format '%03Lu' expects type 'long long unsigned int', but argument 6 has type 'long int'

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/base/power/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20091216.orig/drivers/base/power/main.c
+++ linux-next-20091216/drivers/base/power/main.c
@@ -395,7 +395,7 @@ static void dpm_show_time(ktime_t startt
usecs = usecs64;
if (usecs == 0)
usecs = 1;
- pr_info("PM: %s%s%s of devices complete after %Lu.%03Lu msecs\n",
+ pr_info("PM: %s%s%s of devices complete after %lu.%03lu msecs\n",
info ?: "", info ? " " : "", pm_verb(state.event),
usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC);
}

2009-12-16 22:34:44

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH -next] power: fix printk formats

On Wednesday 16 December 2009, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
> Fix printk format warnings:
>
> drivers/base/power/main.c:398:warning: format '%Lu' expects type 'long long unsigned int', but argument 5 has type 'long int'
> drivers/base/power/main.c:398:warning: format '%03Lu' expects type 'long long unsigned int', but argument 6 has type 'long int'
>
> Signed-off-by: Randy Dunlap <[email protected]>

Already fixed in my tree.

Rafael


> ---
> drivers/base/power/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-next-20091216.orig/drivers/base/power/main.c
> +++ linux-next-20091216/drivers/base/power/main.c
> @@ -395,7 +395,7 @@ static void dpm_show_time(ktime_t startt
> usecs = usecs64;
> if (usecs == 0)
> usecs = 1;
> - pr_info("PM: %s%s%s of devices complete after %Lu.%03Lu msecs\n",
> + pr_info("PM: %s%s%s of devices complete after %lu.%03lu msecs\n",
> info ?: "", info ? " " : "", pm_verb(state.event),
> usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC);
> }
>
>

2009-12-16 22:41:32

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n

On 12/16/2009 01:58 PM, Borislav Petkov wrote:
>
>>
>> --- linux-next-20091216.orig/arch/x86/lib/Makefile
>> +++ linux-next-20091216/arch/x86/lib/Makefile
>> @@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
>>
>> clean-files := inat-tables.c
>>
>> -obj-$(CONFIG_SMP) := msr.o
>> +obj-$(CONFIG_X86_MSR) := msr.o
>
> however, CONFIG_X86_MSR is the x86 MSR access module and the <lib/msr.c>
> is the library of MSR accessing functions which is always in. So this
> should be unconditional as in my version or Peter might have a better
> idea...?
>

Both are wrong.

CONFIG_X86_MSR has nothing at all to do with this and is a complete red
herring. Involving CONFIG_X86_MSR is just totally bogus.

Including msr.o unconditionally is also wrong, but for a more subtle
reason: msr.c is written to contain functions that apply to SMP only;
with UP replacement stubs written as inlines in
arch/x86/include/asm/msr.h.

Putting most of the file inside a big #ifdef of course works, but is a
pretty bad case of beating it with the ugly stick. My preference would
be to move the SMP-specific functions to a new file, call it msr-smp.c,
and then leave only the functions that should be included
unconditionally in msr.c (I believe it is cleaner to do it that way than
the opposite.)

-hpa

2009-12-16 23:16:41

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n

On Wed, Dec 16, 2009 at 02:41:13PM -0800, H. Peter Anvin wrote:
> My preference would be to move the SMP-specific functions to a new
> file, call it msr-smp.c, and then leave only the functions that should
> be included unconditionally in msr.c (I believe it is cleaner to do it
> that way than the opposite.)

v2:

---
From: Borislav Petkov <[email protected]>
Date: Wed, 16 Dec 2009 22:49:18 +0100
Subject: [PATCH] x86, msr: fix CONFIG_SMP=n build

Randy Dunlap reported the following build error:

"When CONFIG_SMP=n, CONFIG_X86_MSR=m:

ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!"

This is due to the fact that <arch/x86/lib/msr.c> is conditioned on
CONFIG_SMP and in the UP case we have only the stubs in the header.
Fork off SMP functionality into a new file (msr-smp.c) and build
msrs_{alloc,free} unconditionally.

Cc: Randy Dunlap <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
---
arch/x86/include/asm/msr.h | 12 +++
arch/x86/lib/Makefile | 4 +-
arch/x86/lib/msr-smp.c | 204 ++++++++++++++++++++++++++++++++++++++++++
arch/x86/lib/msr.c | 213 --------------------------------------------
4 files changed, 218 insertions(+), 215 deletions(-)
create mode 100644 arch/x86/lib/msr-smp.c

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 2d228fc..a0157f2 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -27,6 +27,18 @@ struct msr {
};
};

+struct msr_info {
+ u32 msr_no;
+ struct msr reg;
+ struct msr *msrs;
+ int err;
+};
+
+struct msr_regs_info {
+ u32 *regs;
+ int err;
+};
+
static inline unsigned long long native_read_tscp(unsigned int *aux)
{
unsigned long low, high;
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 45b20e4..cffd754 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c

clean-files := inat-tables.c

-obj-$(CONFIG_SMP) := msr.o
+obj-$(CONFIG_SMP) += msr-smp.o

lib-y := delay.o
lib-y += thunk_$(BITS).o
@@ -22,7 +22,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o
lib-y += memcpy_$(BITS).o
lib-$(CONFIG_KPROBES) += insn.o inat.o

-obj-y += msr-reg.o msr-reg-export.o
+obj-y += msr.o msr-reg.o msr-reg-export.o

ifeq ($(CONFIG_X86_32),y)
obj-y += atomic64_32.o
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
new file mode 100644
index 0000000..a6b1b86
--- /dev/null
+++ b/arch/x86/lib/msr-smp.c
@@ -0,0 +1,204 @@
+#include <linux/module.h>
+#include <linux/preempt.h>
+#include <linux/smp.h>
+#include <asm/msr.h>
+
+static void __rdmsr_on_cpu(void *info)
+{
+ struct msr_info *rv = info;
+ struct msr *reg;
+ int this_cpu = raw_smp_processor_id();
+
+ if (rv->msrs)
+ reg = per_cpu_ptr(rv->msrs, this_cpu);
+ else
+ reg = &rv->reg;
+
+ rdmsr(rv->msr_no, reg->l, reg->h);
+}
+
+static void __wrmsr_on_cpu(void *info)
+{
+ struct msr_info *rv = info;
+ struct msr *reg;
+ int this_cpu = raw_smp_processor_id();
+
+ if (rv->msrs)
+ reg = per_cpu_ptr(rv->msrs, this_cpu);
+ else
+ reg = &rv->reg;
+
+ wrmsr(rv->msr_no, reg->l, reg->h);
+}
+
+int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
+{
+ int err;
+ struct msr_info rv;
+
+ memset(&rv, 0, sizeof(rv));
+
+ rv.msr_no = msr_no;
+ err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
+ *l = rv.reg.l;
+ *h = rv.reg.h;
+
+ return err;
+}
+EXPORT_SYMBOL(rdmsr_on_cpu);
+
+int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
+{
+ int err;
+ struct msr_info rv;
+
+ memset(&rv, 0, sizeof(rv));
+
+ rv.msr_no = msr_no;
+ rv.reg.l = l;
+ rv.reg.h = h;
+ err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
+
+ return err;
+}
+EXPORT_SYMBOL(wrmsr_on_cpu);
+
+static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
+ struct msr *msrs,
+ void (*msr_func) (void *info))
+{
+ struct msr_info rv;
+ int this_cpu;
+
+ memset(&rv, 0, sizeof(rv));
+
+ rv.msrs = msrs;
+ rv.msr_no = msr_no;
+
+ this_cpu = get_cpu();
+
+ if (cpumask_test_cpu(this_cpu, mask))
+ msr_func(&rv);
+
+ smp_call_function_many(mask, msr_func, &rv, 1);
+ put_cpu();
+}
+
+/* rdmsr on a bunch of CPUs
+ *
+ * @mask: which CPUs
+ * @msr_no: which MSR
+ * @msrs: array of MSR values
+ *
+ */
+void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
+{
+ __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
+}
+EXPORT_SYMBOL(rdmsr_on_cpus);
+
+/*
+ * wrmsr on a bunch of CPUs
+ *
+ * @mask: which CPUs
+ * @msr_no: which MSR
+ * @msrs: array of MSR values
+ *
+ */
+void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
+{
+ __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
+}
+EXPORT_SYMBOL(wrmsr_on_cpus);
+
+/* These "safe" variants are slower and should be used when the target MSR
+ may not actually exist. */
+static void __rdmsr_safe_on_cpu(void *info)
+{
+ struct msr_info *rv = info;
+
+ rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
+}
+
+static void __wrmsr_safe_on_cpu(void *info)
+{
+ struct msr_info *rv = info;
+
+ rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
+}
+
+int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
+{
+ int err;
+ struct msr_info rv;
+
+ memset(&rv, 0, sizeof(rv));
+
+ rv.msr_no = msr_no;
+ err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
+ *l = rv.reg.l;
+ *h = rv.reg.h;
+
+ return err ? err : rv.err;
+}
+EXPORT_SYMBOL(rdmsr_safe_on_cpu);
+
+int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
+{
+ int err;
+ struct msr_info rv;
+
+ memset(&rv, 0, sizeof(rv));
+
+ rv.msr_no = msr_no;
+ rv.reg.l = l;
+ rv.reg.h = h;
+ err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
+
+ return err ? err : rv.err;
+}
+EXPORT_SYMBOL(wrmsr_safe_on_cpu);
+
+/*
+ * These variants are significantly slower, but allows control over
+ * the entire 32-bit GPR set.
+ */
+static void __rdmsr_safe_regs_on_cpu(void *info)
+{
+ struct msr_regs_info *rv = info;
+
+ rv->err = rdmsr_safe_regs(rv->regs);
+}
+
+static void __wrmsr_safe_regs_on_cpu(void *info)
+{
+ struct msr_regs_info *rv = info;
+
+ rv->err = wrmsr_safe_regs(rv->regs);
+}
+
+int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
+{
+ int err;
+ struct msr_regs_info rv;
+
+ rv.regs = regs;
+ rv.err = -EIO;
+ err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
+
+ return err ? err : rv.err;
+}
+EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
+
+int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
+{
+ int err;
+ struct msr_regs_info rv;
+
+ rv.regs = regs;
+ rv.err = -EIO;
+ err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
+
+ return err ? err : rv.err;
+}
+EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 8728341..8f8eebd 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -1,123 +1,7 @@
#include <linux/module.h>
#include <linux/preempt.h>
-#include <linux/smp.h>
#include <asm/msr.h>

-struct msr_info {
- u32 msr_no;
- struct msr reg;
- struct msr *msrs;
- int err;
-};
-
-static void __rdmsr_on_cpu(void *info)
-{
- struct msr_info *rv = info;
- struct msr *reg;
- int this_cpu = raw_smp_processor_id();
-
- if (rv->msrs)
- reg = per_cpu_ptr(rv->msrs, this_cpu);
- else
- reg = &rv->reg;
-
- rdmsr(rv->msr_no, reg->l, reg->h);
-}
-
-static void __wrmsr_on_cpu(void *info)
-{
- struct msr_info *rv = info;
- struct msr *reg;
- int this_cpu = raw_smp_processor_id();
-
- if (rv->msrs)
- reg = per_cpu_ptr(rv->msrs, this_cpu);
- else
- reg = &rv->reg;
-
- wrmsr(rv->msr_no, reg->l, reg->h);
-}
-
-int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
- *l = rv.reg.l;
- *h = rv.reg.h;
-
- return err;
-}
-EXPORT_SYMBOL(rdmsr_on_cpu);
-
-int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- rv.reg.l = l;
- rv.reg.h = h;
- err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
-
- return err;
-}
-EXPORT_SYMBOL(wrmsr_on_cpu);
-
-static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
- struct msr *msrs,
- void (*msr_func) (void *info))
-{
- struct msr_info rv;
- int this_cpu;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msrs = msrs;
- rv.msr_no = msr_no;
-
- this_cpu = get_cpu();
-
- if (cpumask_test_cpu(this_cpu, mask))
- msr_func(&rv);
-
- smp_call_function_many(mask, msr_func, &rv, 1);
- put_cpu();
-}
-
-/* rdmsr on a bunch of CPUs
- *
- * @mask: which CPUs
- * @msr_no: which MSR
- * @msrs: array of MSR values
- *
- */
-void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
-{
- __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
-}
-EXPORT_SYMBOL(rdmsr_on_cpus);
-
-/*
- * wrmsr on a bunch of CPUs
- *
- * @mask: which CPUs
- * @msr_no: which MSR
- * @msrs: array of MSR values
- *
- */
-void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
-{
- __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
-}
-EXPORT_SYMBOL(wrmsr_on_cpus);
-
struct msr *msrs_alloc(void)
{
struct msr *msrs = NULL;
@@ -137,100 +21,3 @@ void msrs_free(struct msr *msrs)
free_percpu(msrs);
}
EXPORT_SYMBOL(msrs_free);
-
-/* These "safe" variants are slower and should be used when the target MSR
- may not actually exist. */
-static void __rdmsr_safe_on_cpu(void *info)
-{
- struct msr_info *rv = info;
-
- rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
-}
-
-static void __wrmsr_safe_on_cpu(void *info)
-{
- struct msr_info *rv = info;
-
- rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
-}
-
-int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
- *l = rv.reg.l;
- *h = rv.reg.h;
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(rdmsr_safe_on_cpu);
-
-int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- rv.reg.l = l;
- rv.reg.h = h;
- err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(wrmsr_safe_on_cpu);
-
-/*
- * These variants are significantly slower, but allows control over
- * the entire 32-bit GPR set.
- */
-struct msr_regs_info {
- u32 *regs;
- int err;
-};
-
-static void __rdmsr_safe_regs_on_cpu(void *info)
-{
- struct msr_regs_info *rv = info;
-
- rv->err = rdmsr_safe_regs(rv->regs);
-}
-
-static void __wrmsr_safe_regs_on_cpu(void *info)
-{
- struct msr_regs_info *rv = info;
-
- rv->err = wrmsr_safe_regs(rv->regs);
-}
-
-int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
-{
- int err;
- struct msr_regs_info rv;
-
- rv.regs = regs;
- rv.err = -EIO;
- err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
-
-int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
-{
- int err;
- struct msr_regs_info rv;
-
- rv.regs = regs;
- rv.err = -EIO;
- err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
--
1.6.5


--
Regards/Gruss,
Boris.

2009-12-17 01:01:51

by Borislav Petkov

[permalink] [raw]
Subject: [tip:x86/urgent] x86, msr: msrs_alloc/free for CONFIG_SMP=n

Commit-ID: 6ede31e03084ee084bcee073ef3d1136f68d0906
Gitweb: http://git.kernel.org/tip/6ede31e03084ee084bcee073ef3d1136f68d0906
Author: Borislav Petkov <[email protected]>
AuthorDate: Thu, 17 Dec 2009 00:16:25 +0100
Committer: H. Peter Anvin <[email protected]>
CommitDate: Wed, 16 Dec 2009 15:36:32 -0800

x86, msr: msrs_alloc/free for CONFIG_SMP=n

Randy Dunlap reported the following build error:

"When CONFIG_SMP=n, CONFIG_X86_MSR=m:

ERROR: "msrs_free" [drivers/edac/amd64_edac_mod.ko] undefined!
ERROR: "msrs_alloc" [drivers/edac/amd64_edac_mod.ko] undefined!"

This is due to the fact that <arch/x86/lib/msr.c> is conditioned on
CONFIG_SMP and in the UP case we have only the stubs in the header.
Fork off SMP functionality into a new file (msr-smp.c) and build
msrs_{alloc,free} unconditionally.

Reported-by: Randy Dunlap <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
---
arch/x86/include/asm/msr.h | 12 ++
arch/x86/lib/Makefile | 4 +-
arch/x86/lib/{msr.c => msr-smp.c} | 32 ------
arch/x86/lib/msr.c | 213 -------------------------------------
4 files changed, 14 insertions(+), 247 deletions(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index cf985aa..c5bc4c2 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -27,6 +27,18 @@ struct msr {
};
};

+struct msr_info {
+ u32 msr_no;
+ struct msr reg;
+ struct msr *msrs;
+ int err;
+};
+
+struct msr_regs_info {
+ u32 *regs;
+ int err;
+};
+
static inline unsigned long long native_read_tscp(unsigned int *aux)
{
unsigned long low, high;
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index a2d6472..706be8b 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c

clean-files := inat-tables.c

-obj-$(CONFIG_SMP) := msr.o
+obj-$(CONFIG_SMP) += msr-smp.o

lib-y := delay.o
lib-y += thunk_$(BITS).o
@@ -22,7 +22,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o
lib-y += memcpy_$(BITS).o
lib-y += insn.o inat.o

-obj-y += msr-reg.o msr-reg-export.o
+obj-y += msr.o msr-reg.o msr-reg-export.o

ifeq ($(CONFIG_X86_32),y)
obj-y += atomic64_32.o
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr-smp.c
similarity index 90%
copy from arch/x86/lib/msr.c
copy to arch/x86/lib/msr-smp.c
index 8728341..a6b1b86 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr-smp.c
@@ -3,13 +3,6 @@
#include <linux/smp.h>
#include <asm/msr.h>

-struct msr_info {
- u32 msr_no;
- struct msr reg;
- struct msr *msrs;
- int err;
-};
-
static void __rdmsr_on_cpu(void *info)
{
struct msr_info *rv = info;
@@ -118,26 +111,6 @@ void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
}
EXPORT_SYMBOL(wrmsr_on_cpus);

-struct msr *msrs_alloc(void)
-{
- struct msr *msrs = NULL;
-
- msrs = alloc_percpu(struct msr);
- if (!msrs) {
- pr_warning("%s: error allocating msrs\n", __func__);
- return NULL;
- }
-
- return msrs;
-}
-EXPORT_SYMBOL(msrs_alloc);
-
-void msrs_free(struct msr *msrs)
-{
- free_percpu(msrs);
-}
-EXPORT_SYMBOL(msrs_free);
-
/* These "safe" variants are slower and should be used when the target MSR
may not actually exist. */
static void __rdmsr_safe_on_cpu(void *info)
@@ -190,11 +163,6 @@ EXPORT_SYMBOL(wrmsr_safe_on_cpu);
* These variants are significantly slower, but allows control over
* the entire 32-bit GPR set.
*/
-struct msr_regs_info {
- u32 *regs;
- int err;
-};
-
static void __rdmsr_safe_regs_on_cpu(void *info)
{
struct msr_regs_info *rv = info;
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 8728341..8f8eebd 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -1,123 +1,7 @@
#include <linux/module.h>
#include <linux/preempt.h>
-#include <linux/smp.h>
#include <asm/msr.h>

-struct msr_info {
- u32 msr_no;
- struct msr reg;
- struct msr *msrs;
- int err;
-};
-
-static void __rdmsr_on_cpu(void *info)
-{
- struct msr_info *rv = info;
- struct msr *reg;
- int this_cpu = raw_smp_processor_id();
-
- if (rv->msrs)
- reg = per_cpu_ptr(rv->msrs, this_cpu);
- else
- reg = &rv->reg;
-
- rdmsr(rv->msr_no, reg->l, reg->h);
-}
-
-static void __wrmsr_on_cpu(void *info)
-{
- struct msr_info *rv = info;
- struct msr *reg;
- int this_cpu = raw_smp_processor_id();
-
- if (rv->msrs)
- reg = per_cpu_ptr(rv->msrs, this_cpu);
- else
- reg = &rv->reg;
-
- wrmsr(rv->msr_no, reg->l, reg->h);
-}
-
-int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
- *l = rv.reg.l;
- *h = rv.reg.h;
-
- return err;
-}
-EXPORT_SYMBOL(rdmsr_on_cpu);
-
-int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- rv.reg.l = l;
- rv.reg.h = h;
- err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
-
- return err;
-}
-EXPORT_SYMBOL(wrmsr_on_cpu);
-
-static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
- struct msr *msrs,
- void (*msr_func) (void *info))
-{
- struct msr_info rv;
- int this_cpu;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msrs = msrs;
- rv.msr_no = msr_no;
-
- this_cpu = get_cpu();
-
- if (cpumask_test_cpu(this_cpu, mask))
- msr_func(&rv);
-
- smp_call_function_many(mask, msr_func, &rv, 1);
- put_cpu();
-}
-
-/* rdmsr on a bunch of CPUs
- *
- * @mask: which CPUs
- * @msr_no: which MSR
- * @msrs: array of MSR values
- *
- */
-void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
-{
- __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
-}
-EXPORT_SYMBOL(rdmsr_on_cpus);
-
-/*
- * wrmsr on a bunch of CPUs
- *
- * @mask: which CPUs
- * @msr_no: which MSR
- * @msrs: array of MSR values
- *
- */
-void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
-{
- __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
-}
-EXPORT_SYMBOL(wrmsr_on_cpus);
-
struct msr *msrs_alloc(void)
{
struct msr *msrs = NULL;
@@ -137,100 +21,3 @@ void msrs_free(struct msr *msrs)
free_percpu(msrs);
}
EXPORT_SYMBOL(msrs_free);
-
-/* These "safe" variants are slower and should be used when the target MSR
- may not actually exist. */
-static void __rdmsr_safe_on_cpu(void *info)
-{
- struct msr_info *rv = info;
-
- rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
-}
-
-static void __wrmsr_safe_on_cpu(void *info)
-{
- struct msr_info *rv = info;
-
- rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
-}
-
-int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
- *l = rv.reg.l;
- *h = rv.reg.h;
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(rdmsr_safe_on_cpu);
-
-int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
-{
- int err;
- struct msr_info rv;
-
- memset(&rv, 0, sizeof(rv));
-
- rv.msr_no = msr_no;
- rv.reg.l = l;
- rv.reg.h = h;
- err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(wrmsr_safe_on_cpu);
-
-/*
- * These variants are significantly slower, but allows control over
- * the entire 32-bit GPR set.
- */
-struct msr_regs_info {
- u32 *regs;
- int err;
-};
-
-static void __rdmsr_safe_regs_on_cpu(void *info)
-{
- struct msr_regs_info *rv = info;
-
- rv->err = rdmsr_safe_regs(rv->regs);
-}
-
-static void __wrmsr_safe_regs_on_cpu(void *info)
-{
- struct msr_regs_info *rv = info;
-
- rv->err = wrmsr_safe_regs(rv->regs);
-}
-
-int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
-{
- int err;
- struct msr_regs_info rv;
-
- rv.regs = regs;
- rv.err = -EIO;
- err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
-
-int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
-{
- int err;
- struct msr_regs_info rv;
-
- rv.regs = regs;
- rv.err = -EIO;
- err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
-
- return err ? err : rv.err;
-}
-EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);