Messages in this thread | | | Subject | Re: [PATCH v3] printk: Add console owner and waiter logic to loadbalance console writes | From | Tetsuo Handa <> | Date | Sat, 4 Nov 2017 17:43:53 +0900 |
| |
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@goodmis.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.
| |