On Thu, 17 Feb 2005 12:54:54 -0800, 
Adrian Caceres <[EMAIL PROTECTED]> wrote:
>1. I keep getting Debug linux kernel messages when I enter KDB.  I am 
>doing it over
>a serial driver:
>"Debug: sleeping function called from invalid context at ..."
>Most of the time I get to a kdb console but sometimes I hang on an 
>endless loop:
>The stack always seems to indicate the problem comes from 
>kdb_getarea_size():

Sorry for the delay in replying - not waving, drowning ...

You have CONFIG_DEBUG_SPINLOCK_SLEEP=y so the kdb use of __copy_to_user
is generating false positives.  When kdb uses that function, the
parameters are such that the call cannot sleep, but __copy_to_user does
not know that.  Replace it with __copy_to_user_inatomic.

Does this patch fix your problem?  Compiled but not tested.

Index: linux/include/asm-i386/kdb.h
===================================================================
--- linux.orig/include/asm-i386/kdb.h   2005-02-05 13:56:12.000000000 +1100
+++ linux/include/asm-i386/kdb.h        2005-03-03 17:14:04.000000000 +1100
@@ -68,7 +68,7 @@ __kdba_putarea_size(unsigned long to_xxx
        }
 
        set_fs(KERNEL_DS);
-       r = __copy_to_user((void *)to_xxx, from, size);
+       r = __copy_to_user_inatomic((void *)to_xxx, from, size);
        set_fs(oldfs);
        return r;
 }
@@ -88,19 +88,19 @@ __kdba_getarea_size(void *to, unsigned l
        set_fs(KERNEL_DS);
        switch (size) {
        case 1:
-               r = __copy_to_user(to, (void *)from_xxx, 1);
+               r = __copy_to_user_inatomic(to, (void *)from_xxx, 1);
                break;
        case 2:
-               r = __copy_to_user(to, (void *)from_xxx, 2);
+               r = __copy_to_user_inatomic(to, (void *)from_xxx, 2);
                break;
        case 4:
-               r = __copy_to_user(to, (void *)from_xxx, 4);
+               r = __copy_to_user_inatomic(to, (void *)from_xxx, 4);
                break;
        case 8:
-               r = __copy_to_user(to, (void *)from_xxx, 8);
+               r = __copy_to_user_inatomic(to, (void *)from_xxx, 8);
                break;
        default:
-               r = __copy_to_user(to, (void *)from_xxx, size);
+               r = __copy_to_user_inatomic(to, (void *)from_xxx, size);
                break;
        }
        set_fs(oldfs);


---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.

Reply via email to