Re: [PATCH] *(int*)0 = 0 & variations

Manfred Spraul (masp0008@stud.uni-sb.de)
Thu, 24 Jun 1999 17:11:37 +0200


From: Alan Cox <alan@lxorguk.ukuu.org.uk>
>Before re-inventing the wheel also take a look at the debugging macros
>used in the rpc and nfs layer. They include run time configuration so you
>can use sysctl to debug specific things.
Thanks, I'll look at it.

But I think that we currently re-invent the wheel:
every driver implements it's own version of assert(), #if 0, SMB_PRINTK(),
BUG(), PAGE_BUG(), ftape-tracing.c [a complete .c file just for trace
support], every other scsi-driver has itīs own do_trace,...

e.g. ncpfs always calls assert_kernel_locked(), but the function seems
to be a nop in release builds - just wasted CPU time.

I think that we should collect this code and add a new
#include <linux/kdebug.h>
perhaps <asm/kdebug.h> so that we have an implementation that every
driver can use (based on CONFIG_ASSERT for time critical operations
and/or a sys_ctl for the rest.)

So far I would include
kassert()

dprintk()
// test macros for syncronization objects
kassert_down(sem)
kassert_locked(spinlock)
kassert_kernel_locked()
into this file.

BTW, has anyone checked the missing synchronization I posted?
a simple kassert_kernel_locked() in the main ext2 entry points
would quickly eliminate such bugs.
> do_lo_request()
> ->create_missing_block()
> ->file->f_op->write();
> -> ext2_file_write()
> could be running without the kernel lock.

--
    Manfred

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