KDB: SMP locking problem
Keith Owens
kaos at sgi.com
Mon Jun 9 14:41:00 PDT 2003
On Mon, 9 Jun 2003 15:58:04 -0400 ,
"Sanders, Richard" <Richard.Sanders at stratus.com> 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.
More information about the kdb
mailing list