lkml.org 
[lkml]   [2009]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH -next] x86 msrs: alloc/free for CONFIG_SMP=n
    From: Randy Dunlap <randy.dunlap@oracle.com>

    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);

    \
     
     \ /
      Last update: 2009-12-16 22:53    [W:5.127 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site