mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: linux-next: Tree for December 16 (amd64_edac)
Date: Wed, 16 Dec 2009 22:54:11 +0100	[thread overview]
Message-ID: <20091216215411.GA27228@liondog.tnic> (raw)
In-Reply-To: <4B2928AC.3020807@zytor.com>

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 <petkovbb@gmail.com>
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 <randy.dunlap@oracle.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 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.

  parent reply	other threads:[~2009-12-16 21:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16  7:32 linux-next: Tree for December 16 Stephen Rothwell
2009-12-16 17:24 ` linux-next: Tree for December 16 (amd64_edac) Randy Dunlap
2009-12-16 17:32   ` H. Peter Anvin
2009-12-16 17:45     ` Borislav Petkov
2009-12-16 18:36       ` H. Peter Anvin
2009-12-16 21:51         ` [PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n Randy Dunlap
2009-12-16 21:58           ` Borislav Petkov
2009-12-16 22:02             ` Randy Dunlap
2009-12-16 22:41             ` H. Peter Anvin
2009-12-16 23:16               ` Borislav Petkov
2009-12-17  1:00                 ` [tip:x86/urgent] x86, msr: msrs_alloc/free " tip-bot for Borislav Petkov
2009-12-16 21:54         ` Borislav Petkov [this message]
2009-12-16 22:26 ` [PATCH -next] power: fix printk formats Randy Dunlap
2009-12-16 22:35   ` Rafael J. Wysocki

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=20091216215411.GA27228@liondog.tnic \
    --to=petkovbb@googlemail.com \
    --cc=borislav.petkov@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=sfr@canb.auug.org.au \
    /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

all inboxes | Powered by JetHome®