sched_rt: don't use first_cpu on cpumask created with cpumask_and
[pandora-kernel.git] / kernel / module.c
index f47cce9..e8b51d4 100644 (file)
@@ -43,7 +43,6 @@
 #include <linux/device.h>
 #include <linux/string.h>
 #include <linux/mutex.h>
-#include <linux/unwind.h>
 #include <linux/rculist.h>
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
@@ -51,6 +50,7 @@
 #include <asm/sections.h>
 #include <linux/tracepoint.h>
 #include <linux/ftrace.h>
+#include <linux/async.h>
 
 #if 0
 #define DEBUGP printk
@@ -743,8 +743,8 @@ static void wait_for_zero_refcount(struct module *mod)
        mutex_lock(&module_mutex);
 }
 
-asmlinkage long
-sys_delete_module(const char __user *name_user, unsigned int flags)
+SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
+               unsigned int, flags)
 {
        struct module *mod;
        char name[MODULE_NAME_LEN];
@@ -817,6 +817,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
                mod->exit();
        blocking_notifier_call_chain(&module_notify_list,
                                     MODULE_STATE_GOING, mod);
+       async_synchronize_full();
        mutex_lock(&module_mutex);
        /* Store the name of the last unloaded module for diagnostic purposes */
        strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
@@ -1449,8 +1450,6 @@ static void free_module(struct module *mod)
        remove_sect_attrs(mod);
        mod_kobject_remove(mod);
 
-       unwind_remove_table(mod->unwind_info, 0);
-
        /* Arch-specific cleanup. */
        module_arch_cleanup(mod);
 
@@ -1867,7 +1866,6 @@ static noinline struct module *load_module(void __user *umod,
        unsigned int symindex = 0;
        unsigned int strindex = 0;
        unsigned int modindex, versindex, infoindex, pcpuindex;
-       unsigned int unwindex = 0;
        unsigned int num_kp, num_mcount;
        struct kernel_param *kp;
        struct module *mod;
@@ -1957,9 +1955,6 @@ static noinline struct module *load_module(void __user *umod,
        versindex = find_sec(hdr, sechdrs, secstrings, "__versions");
        infoindex = find_sec(hdr, sechdrs, secstrings, ".modinfo");
        pcpuindex = find_pcpusec(hdr, sechdrs, secstrings);
-#ifdef ARCH_UNWIND_SECTION_NAME
-       unwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME);
-#endif
 
        /* Don't keep modinfo and version sections. */
        sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC;
@@ -1969,8 +1964,6 @@ static noinline struct module *load_module(void __user *umod,
        sechdrs[symindex].sh_flags |= SHF_ALLOC;
        sechdrs[strindex].sh_flags |= SHF_ALLOC;
 #endif
-       if (unwindex)
-               sechdrs[unwindex].sh_flags |= SHF_ALLOC;
 
        /* Check module struct version now, before we try to use module. */
        if (!check_modstruct_version(sechdrs, versindex, mod)) {
@@ -2267,11 +2260,6 @@ static noinline struct module *load_module(void __user *umod,
        add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
        add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
 
-       /* Size of section 0 is 0, so this works well if no unwind info. */
-       mod->unwind_info = unwind_add_table(mod,
-                                           (void *)sechdrs[unwindex].sh_addr,
-                                           sechdrs[unwindex].sh_size);
-
        /* Get rid of temporary copy */
        vfree(hdr);
 
@@ -2308,10 +2296,8 @@ static noinline struct module *load_module(void __user *umod,
 }
 
 /* This is where the real work happens */
-asmlinkage long
-sys_init_module(void __user *umod,
-               unsigned long len,
-               const char __user *uargs)
+SYSCALL_DEFINE3(init_module, void __user *, umod,
+               unsigned long, len, const char __user *, uargs)
 {
        struct module *mod;
        int ret = 0;
@@ -2366,11 +2352,12 @@ sys_init_module(void __user *umod,
        /* Now it's a first class citizen!  Wake up anyone waiting for it. */
        mod->state = MODULE_STATE_LIVE;
        wake_up(&module_wq);
+       blocking_notifier_call_chain(&module_notify_list,
+                                    MODULE_STATE_LIVE, mod);
 
        mutex_lock(&module_mutex);
        /* Drop initial reference. */
        module_put(mod);
-       unwind_remove_table(mod->unwind_info, 1);
        module_free(mod, mod->module_init);
        mod->module_init = NULL;
        mod->init_size = 0;
@@ -2405,7 +2392,7 @@ static const char *get_ksymbol(struct module *mod,
        unsigned long nextval;
 
        /* At worse, next value is at end of module */
-       if (within(addr, mod->module_init, mod->init_size))
+       if (within_module_init(addr, mod))
                nextval = (unsigned long)mod->module_init+mod->init_text_size;
        else
                nextval = (unsigned long)mod->module_core+mod->core_text_size;
@@ -2453,8 +2440,8 @@ const char *module_address_lookup(unsigned long addr,
 
        preempt_disable();
        list_for_each_entry_rcu(mod, &modules, list) {
-               if (within(addr, mod->module_init, mod->init_size)
-                   || within(addr, mod->module_core, mod->core_size)) {
+               if (within_module_init(addr, mod) ||
+                   within_module_core(addr, mod)) {
                        if (modname)
                                *modname = mod->name;
                        ret = get_ksymbol(mod, addr, size, offset);
@@ -2476,8 +2463,8 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
 
        preempt_disable();
        list_for_each_entry_rcu(mod, &modules, list) {
-               if (within(addr, mod->module_init, mod->init_size) ||
-                   within(addr, mod->module_core, mod->core_size)) {
+               if (within_module_init(addr, mod) ||
+                   within_module_core(addr, mod)) {
                        const char *sym;
 
                        sym = get_ksymbol(mod, addr, NULL, NULL);
@@ -2500,8 +2487,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
 
        preempt_disable();
        list_for_each_entry_rcu(mod, &modules, list) {
-               if (within(addr, mod->module_init, mod->init_size) ||
-                   within(addr, mod->module_core, mod->core_size)) {
+               if (within_module_init(addr, mod) ||
+                   within_module_core(addr, mod)) {
                        const char *sym;
 
                        sym = get_ksymbol(mod, addr, size, offset);
@@ -2720,7 +2707,7 @@ int is_module_address(unsigned long addr)
        preempt_disable();
 
        list_for_each_entry_rcu(mod, &modules, list) {
-               if (within(addr, mod->module_core, mod->core_size)) {
+               if (within_module_core(addr, mod)) {
                        preempt_enable();
                        return 1;
                }