lkml.org 
[lkml]   [2008]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 01/23 -v6] printk - dont wakeup klogd with interrupts disabled
From
Date

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?



\
 
 \ /
  Last update: 2008-01-26 10:55    [W:0.180 / U:4.588 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site