[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <KL1P15301MB0006432F17DE0DB6ABA80EDEBF930@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM>
Date: Tue, 15 May 2018 20:10:22 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Ingo Molnar <mingo@...nel.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rakib Mullick <rakib.mullick@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: for_each_cpu() is buggy for UP kernel?
> From: Linus Torvalds <torvalds@...ux-foundation.org>
> Sent: Tuesday, May 15, 2018 10:22
> To: Dexuan Cui <decui@...rosoft.com>
>
> On Mon, May 14, 2018 at 8:02 PM Dexuan Cui <decui@...rosoft.com> wrote:
>
> > If you're OK with the below fix (not tested yet), I'll submit a patch for it:
>
> > --- a/kernel/time/tick-broadcast.c
> > +++ b/kernel/time/tick-broadcast.c
> > @@ -616,6 +616,10 @@ static void tick_handle_oneshot_broadcast(struct
> clock_event_device *dev)
> > now = ktime_get();
> > /* Find all expired events */
> > for_each_cpu(cpu, tick_broadcast_oneshot_mask) {
> > +#ifndef CONFIG_SMP
> > + if (cpumask_empty(tick_broadcast_oneshot_mask))
> > + break;
> > +#endif
>
> I'm certainly ok with this. It's hacky, but maybe being explicitly hacky is
> good to "document" this gotcha.
>
> And I really do agree that this special UP case is nasty nasty and much too
> subtle, and I hope that some day we won't care about UP at all, and maybe
> kill it, or maybe just make for_each_cpu() generate the extra code to have
> the actual same semantics as the SMP case.
>
> Linus
Thanks! I submitted the patch just now: https://lkml.org/lkml/2018/5/15/866
Thanks,
-- Dexuan
Powered by blists - more mailing lists