lkml.org 
[lkml]   [2017]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCHv2 1/8] printk: move printk_pending out of per-cpu
On Fri, Mar 31, 2017 at 03:09:50PM +0200, Petr Mladek wrote:
> On Wed 2017-03-29 18:25:04, Sergey Senozhatsky wrote:

> > if (waitqueue_active(&log_wait)) {
> > - this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP);
> > + set_bit(PRINTK_PENDING_WAKEUP, &printk_pending);
>
> We should add here a write barrier:
>
> /*
> * irq_work_queue() uses cmpxchg() and implies the memory
> * barrier only when the work is queued. An explicit barrier
> * is needed here to make sure that wake_up_klogd_work_func()
> * sees printk_pending set even when the work was already queued
> * because of an other pending event.
> */
> smp_wmb();
>
> > irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> > }
> > preempt_enable();

smp_mb__after_atomic() is probably better, because if you're not
ordering with the cmpxchg, you're ordering against a load done by
cmpxchg to see it doesn't need to do anything.

\
 
 \ /
  Last update: 2017-03-31 15:34    [W:0.994 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site