Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21aa9280b9f4e9e68d3fa8990df6c9d7fd71f994
Commit:     21aa9280b9f4e9e68d3fa8990df6c9d7fd71f994
Parent:     5a52dd50091b6a6e710a1293db741028f8cc5aac
Author:     Arjan van de Ven <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 25 21:08:33 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 21:08:33 2008 +0100

    debug: show being-loaded/being-unloaded indicator for modules
    
    It's rather common that an oops/WARN_ON/BUG happens during the load or
    unload of a module. Unfortunatly, it's not always easy to see directly
    which module is being loaded/unloaded from the oops itself. Worse,
    it's not even always possible to ask the bug reporter, since there
    are so many components (udev etc) that auto-load modules that there's
    a good chance that even the reporter doesn't know which module this is.
    
    This patch extends the existing "show if it's tainting" print code,
    which is used as part of printing the modules in the oops/BUG/WARN_ON
    to include a "+" for "being loaded" and a "-" for "being unloaded".
    
    As a result this extension, the "taint_flags()" function gets renamed to
    "module_flags()" (and takes a module struct as argument, not a taint
    flags int).
    
    Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 kernel/module.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index dcb8a2c..5bbf225 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2357,21 +2357,30 @@ static void m_stop(struct seq_file *m, void *p)
        mutex_unlock(&module_mutex);
 }
 
-static char *taint_flags(unsigned int taints, char *buf)
+static char *module_flags(struct module *mod, char *buf)
 {
        int bx = 0;
 
-       if (taints) {
+       if (mod->taints ||
+           mod->state == MODULE_STATE_GOING ||
+           mod->state == MODULE_STATE_COMING) {
                buf[bx++] = '(';
-               if (taints & TAINT_PROPRIETARY_MODULE)
+               if (mod->taints & TAINT_PROPRIETARY_MODULE)
                        buf[bx++] = 'P';
-               if (taints & TAINT_FORCED_MODULE)
+               if (mod->taints & TAINT_FORCED_MODULE)
                        buf[bx++] = 'F';
                /*
                 * TAINT_FORCED_RMMOD: could be added.
                 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
                 * apply to modules.
                 */
+
+               /* Show a - for module-is-being-unloaded */
+               if (mod->state == MODULE_STATE_GOING)
+                       buf[bx++] = '-';
+               /* Show a + for module-is-being-loaded */
+               if (mod->state == MODULE_STATE_COMING)
+                       buf[bx++] = '+';
                buf[bx++] = ')';
        }
        buf[bx] = '\0';
@@ -2398,7 +2407,7 @@ static int m_show(struct seq_file *m, void *p)
 
        /* Taints info */
        if (mod->taints)
-               seq_printf(m, " %s", taint_flags(mod->taints, buf));
+               seq_printf(m, " %s", module_flags(mod, buf));
 
        seq_printf(m, "\n");
        return 0;
@@ -2493,7 +2502,7 @@ void print_modules(void)
 
        printk("Modules linked in:");
        list_for_each_entry(mod, &modules, list)
-               printk(" %s%s", mod->name, taint_flags(mod->taints, buf));
+               printk(" %s%s", mod->name, module_flags(mod, buf));
        printk("\n");
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to