[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201711041743.GCG95335.OQFLJMFSHOVFtO@I-love.SAKURA.ne.jp>
Date: Sat, 4 Nov 2017 17:43:53 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: jhubbard@...dia.com, rostedt@...dmis.org
Cc: vbabka@...e.cz, linux-kernel@...r.kernel.org, peterz@...radead.org,
akpm@...ux-foundation.org, linux-mm@...ck.org,
xiyou.wangcong@...il.com, dave.hansen@...el.com,
hannes@...xchg.org, mgorman@...e.de, mhocko@...nel.org,
pmladek@...e.com, sergey.senozhatsky@...il.com,
yuwang.yuwang@...baba-inc.com, torvalds@...ux-foundation.org,
jack@...e.cz, mathieu.desnoyers@...icios.com,
penguin-kernel@...ove.SAKURA.ne.jp
Subject: Re: [PATCH v3] printk: Add console owner and waiter logic to loadbalance console writes
Tetsuo Handa wrote:
> John Hubbard wrote:
> > On 11/03/2017 02:46 PM, John Hubbard wrote:
> > > On 11/03/2017 04:54 AM, Steven Rostedt wrote:
> > >> On Fri, 3 Nov 2017 07:21:21 -0400
> > >> Steven Rostedt <rostedt@...dmis.org> wrote:
> > [...]
> > >>
> > >> I'll condense the patch to show what I mean:
> > >>
> > >> To become a waiter, a task must do the following:
> > >>
> > >> + printk_safe_enter_irqsave(flags);
> > >> +
> > >> + raw_spin_lock(&console_owner_lock);
> > >> + owner = READ_ONCE(console_owner);
> > >> + waiter = READ_ONCE(console_waiter);
>
> When CPU0 is writing to consoles after "console_owner = current;",
> what prevents from CPU1 and CPU2 concurrently reached this line from
> seeing waiter == false && owner != NULL && owner != current (which will
> concurrently set console_waiter = true and spin = true) without
> using atomic instructions?
Oops. I overlooked that console_owner_lock is held.
Powered by blists - more mailing lists