kdb
[Top] [All Lists]

Re: KDB: SMP locking problem

To: "Sanders, Richard" <Richard.Sanders@xxxxxxxxxxx>
Subject: Re: KDB: SMP locking problem
From: Keith Owens <kaos@xxxxxxx>
Date: Tue, 10 Jun 2003 07:41:00 +1000
Cc: "'kdb@xxxxxxxxxxx'" <kdb@xxxxxxxxxxx>
In-reply-to: Your message of "Mon, 09 Jun 2003 15:58:04 -0400." <CAC3BCBB443DEC439198F230B4BCC7E903EC9E0E@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: kdb-bounce@xxxxxxxxxxx
On Mon, 9 Jun 2003 15:58:04 -0400 , 
"Sanders, Richard" <Richard.Sanders@xxxxxxxxxxx> wrote:
>Here is a patch for  kdb/kdb_io.c which fixes a SMP race on the printf lock.
>Patch is against 4.2.
>--- linux/kdb/kdb_io.c.orig    Mon Jun  9 15:45:54 2003
>+++ linux/kdb/kdb_io.c Mon Jun  9 15:47:08 2003
>@@ -493,10 +493,11 @@
>        * But if any cpu goes recursive in kdb, just print the output,
>        * even if it is interleaved with any other text.
>        */
>-      if (!KDB_STATE(PRINTF_LOCK)) {
>+      spin_lock(&kdb_printf_lock);
>+      if (!KDB_STATE(PRINTF_LOCK)) 
>               KDB_STATE_SET(PRINTF_LOCK);
>-              spin_lock(&kdb_printf_lock);
>-      }
>+      else
>+              spin_unlock(&kdb_printf_lock);
> 
>       diag = kdbgetintenv("LINES", &linecount);
>       if (diag || linecount <= 1)
>@@ -592,8 +593,8 @@
>               console_loglevel = saved_loglevel;
>       }
>       if (KDB_STATE(PRINTF_LOCK)) {
>-              spin_unlock(&kdb_printf_lock);
>               KDB_STATE_CLEAR(PRINTF_LOCK);
>+              spin_unlock(&kdb_printf_lock);
>       }
>       if (do_longjmp)
> #ifdef KDB_HAVE_LONGJMP

Rejected.  Read the comments at the start of your patch, you just
introduced a recursion deadlock.

BTW, your patch was in quoted printable.  Like Linus, I tend to ignore
encoded patches unless they are so large that they have to be zipped.
Please send small patchs in plain text, not as encoded attachments.


<Prev in Thread] Current Thread [Next in Thread>