Messages in this thread | | | Subject | Re: [PATCH 01/23 -v6] printk - dont wakeup klogd with interrupts disabled | From | Peter Zijlstra <> | Date | Sat, 26 Jan 2008 10:50:17 +0100 |
| |
On Fri, 2008-01-25 at 23:21 -0500, Steven Rostedt wrote:
> @@ -1003,7 +1005,11 @@ void release_console_sem(void) > console_locked = 0; > up(&console_sem); > spin_unlock_irqrestore(&logbuf_lock, flags); > - if (wake_klogd) > + /* > + * If we try to wake up klogd while printing with the runqueue lock > + * held, this will deadlock. > + */ > + if (wake_klogd && !runqueue_is_locked()) > wake_up_klogd(); > } > EXPORT_SYMBOL(release_console_sem);
> +/** > + * runqueue_is_locked > + * > + * Returns true if the current cpu runqueue is locked. > + * This interface allows printk to be called with the runqueue lock > + * held and know whether or not it is OK to wake up the klogd. > + */ > +int runqueue_is_locked(void) > +{ > + int cpu = get_cpu(); > + struct rq *rq = cpu_rq(cpu); > + int ret; > + > + ret = spin_is_locked(&rq->lock); > + put_cpu(); > + return ret; > +}
Right, while this might appear to be sound, I hate to point out that we only want to exclude it when current holds the rq->lock. This could lead to spuriously missing klogd wakeups because other cpus hold our rq->lock.
Now, is this klogd thing only relevant for dumping stuff into the log, or also for writing stuff out to the serial line?
| |