]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branches 'x86/cleanups', 'x86/mm', 'x86/setup' and 'linus' into x86/core
authorIngo Molnar <mingo@elte.hu>
Fri, 20 Mar 2009 09:34:22 +0000 (10:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 20 Mar 2009 09:34:22 +0000 (10:34 +0100)
1  2  3  4 
Makefile
kernel/module.c

diff --combined Makefile
index 46c04c546ee2d4676693289f54270391fb15ad97,46c04c546ee2d4676693289f54270391fb15ad97,46c04c546ee2d4676693289f54270391fb15ad97,a2c2efe9e82edd7b9df112ce3aad7e76b8cb9501..828028d4a448094a36ee98f7e422177eed49a7f0
+++ b/Makefile
@@@@@ -533,9 -533,9 -533,9 -533,8 +533,9 @@@@@ KBUILD_CFLAGS += $(call cc-option,-Wfra
    endif
    
    # Force gcc to behave correct even for buggy distributions
   -# Arch Makefiles may override this setting
   +ifndef CONFIG_CC_STACKPROTECTOR
    KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
   +endif
    
    ifdef CONFIG_FRAME_POINTER
    KBUILD_CFLAGS       += -fno-omit-frame-pointer -fno-optimize-sibling-calls
@@@@@ -567,6 -567,6 -567,6 -566,9 +567,9 @@@@@ KBUILD_CFLAGS += $(call cc-option,-Wdec
    # disable pointer signed / unsigned warnings in gcc 4.0
    KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
    
+++ # disable invalid "can't wrap" optimzations for signed / pointers
+++ KBUILD_CFLAGS       += $(call cc-option,-fwrapv)
+++ 
    # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
    # But warn user when we do so
    warn-assign = \
diff --combined kernel/module.c
index f0e04d6b67d8cb325526dce1fdb456265ba3f926,f0e04d6b67d8cb325526dce1fdb456265ba3f926,f0e04d6b67d8cb325526dce1fdb456265ba3f926,1196f5d117002face7e8424f87024e94df9e8add..29f2d7b33dd4ba388a8c681f5a65f925582ff441
    #include <linux/tracepoint.h>
    #include <linux/ftrace.h>
    #include <linux/async.h>
   +#include <linux/percpu.h>
    
    #if 0
    #define DEBUGP printk
@@@@@ -367,34 -367,34 -367,34 -366,6 +367,34 @@@@@ static struct module *find_module(cons
    }
    
    #ifdef CONFIG_SMP
   +
   +#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
   +
   +static void *percpu_modalloc(unsigned long size, unsigned long align,
   +                         const char *name)
   +{
   +    void *ptr;
   +
   +    if (align > PAGE_SIZE) {
   +            printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n",
   +                   name, align, PAGE_SIZE);
   +            align = PAGE_SIZE;
   +    }
   +
   +    ptr = __alloc_reserved_percpu(size, align);
   +    if (!ptr)
   +            printk(KERN_WARNING
   +                   "Could not allocate %lu bytes percpu data\n", size);
   +    return ptr;
   +}
   +
   +static void percpu_modfree(void *freeme)
   +{
   +    free_percpu(freeme);
   +}
   +
   +#else /* ... !CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */
   +
    /* Number of blocks used and allocated. */
    static unsigned int pcpu_num_used, pcpu_num_allocated;
    /* Size of each block.  -ve means used. */
@@@@@ -509,6 -509,6 -509,6 -480,21 +509,6 @@@@@ static void percpu_modfree(void *freeme
        }
    }
    
   -static unsigned int find_pcpusec(Elf_Ehdr *hdr,
   -                             Elf_Shdr *sechdrs,
   -                             const char *secstrings)
   -{
   -    return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
   -}
   -
   -static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
   -{
   -    int cpu;
   -
   -    for_each_possible_cpu(cpu)
   -            memcpy(pcpudest + per_cpu_offset(cpu), from, size);
   -}
   -
    static int percpu_modinit(void)
    {
        pcpu_num_used = 2;
        return 0;
    }
    __initcall(percpu_modinit);
   +
   +#endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */
   +
   +static unsigned int find_pcpusec(Elf_Ehdr *hdr,
   +                             Elf_Shdr *sechdrs,
   +                             const char *secstrings)
   +{
   +    return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
   +}
   +
   +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
   +{
   +    int cpu;
   +
   +    for_each_possible_cpu(cpu)
   +            memcpy(pcpudest + per_cpu_offset(cpu), from, size);
   +}
   +
    #else /* ... !CONFIG_SMP */
   +
    static inline void *percpu_modalloc(unsigned long size, unsigned long align,
                                    const char *name)
    {
@@@@@ -568,7 -568,7 -568,7 -535,6 +568,7 @@@@@ static inline void percpu_modcopy(void 
        /* pcpusec should be 0, and size of that section should be 0. */
        BUG_ON(size != 0);
    }
   +
    #endif /* CONFIG_SMP */
    
    #define MODINFO_ATTR(field) \
@@@@@ -2049,14 -2049,14 -2049,14 -2015,6 +2049,6 @@@@@ static noinline struct module *load_mod
        if (err < 0)
                goto free_mod;
    
--- #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
---     mod->refptr = percpu_modalloc(sizeof(local_t), __alignof__(local_t),
---                                   mod->name);
---     if (!mod->refptr) {
---             err = -ENOMEM;
---             goto free_mod;
---     }
--- #endif
        if (pcpuindex) {
                /* We have a special allocation for this section. */
                percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
                                         mod->name);
                if (!percpu) {
                        err = -ENOMEM;
---                     goto free_percpu;
+++                     goto free_mod;
                }
                sechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC;
                mod->percpu = percpu;
        /* Module has been moved. */
        mod = (void *)sechdrs[modindex].sh_addr;
    
+++ #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+++     mod->refptr = percpu_modalloc(sizeof(local_t), __alignof__(local_t),
+++                                   mod->name);
+++     if (!mod->refptr) {
+++             err = -ENOMEM;
+++             goto free_init;
+++     }
+++ #endif
        /* Now we've moved module, initialize linked lists, etc. */
        module_unload_init(mod);
    
        ftrace_release(mod->module_core, mod->core_size);
     free_unload:
        module_unload_free(mod);
+++  free_init:
+++ #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+++     percpu_modfree(mod->refptr);
+++ #endif
        module_free(mod, mod->module_init);
     free_core:
        module_free(mod, mod->module_core);
+++     /* mod will be freed with core. Don't access it beyond this line! */
     free_percpu:
        if (percpu)
                percpu_modfree(percpu);
--- #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
---     percpu_modfree(mod->refptr);
--- #endif
     free_mod:
        kfree(args);
     free_hdr: