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

Keith Owens
2002-07-27T00:16:27Z

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.