Re: module oops tracking [Re: [PATCH] cheap lookup of symbol names on oops()]

Keith Owens (kaos@ocs.com.au)
Sat, 27 Jul 2002 10:19:31 +1000


On Sat, 27 Jul 2002 00:37:50 +0200,
Andrea Arcangeli <andrea@suse.de> wrote:
>I implemented what I need to track down oopses with modules. ksymoops
>should learn about it too. This will also allow us to recognize
>immediatly the kernel image used.
>+#define MODULE_OOPS_TRACKING_NR_LONGS 10
>+#define MODULE_OOPS_TRACKING_NR_BITS (BITS_PER_LONG * MODULE_OOPS_TRACKING_NR_LONGS)
>+static unsigned long module_oops_tracking[MODULE_OOPS_TRACKING_NR_LONGS];
>+void module_oops_tracking_mark(int nr)
>+{
>+ if (nr < MODULE_OOPS_TRACKING_NR_BITS)
>+ set_bit(nr, module_oops_tracking);
>+}
>+
>+static void __module_oops_tracking_print(int nr)
>+{
>+ struct module *mod;
>+
>+ for (mod = module_list; mod != &kernel_module; mod = mod->next) {
>+ if (!nr--)
>+ printk(" [(%s:<%p>:<%p>)]\n",
>+ mod->name,
>+ (char *) mod + mod->size_of_struct,
>+ (char *) mod + mod->size);
>+ }
>+
>+}

Instead of adding a separate bit map and scanning the module chain to
convert a bit number to a module entry, add a new entry to mod->flags.

#define MOD_OOPS_PRINTED 128

That simplifies the code and reduces the number of times you have to
scan the module list.

Beware if Rusty's idea of discarding init code/data from modules ever
takes off. Then the text will not be contiguous, nor will it be at the
start of the module.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/