Re: [PATCH] firmware: wake all waiters

From: Linus Torvalds
Date: Mon Jun 26 2017 - 19:43:38 EST


On Mon, Jun 26, 2017 at 4:30 PM, Luis R. Rodriguez <mcgrof@xxxxxxxxxx> wrote:
>
> On Mon, Jun 26, 2017 at 02:44:17PM -0700, Linus Torvalds wrote:
> >
> > Among all the simplifications it has is exactly the fact that it wakes
> > up only one thing, because it is *so* specialized.
>
> Not sure I follow, it can wake up all items in queue with swake_up_all(), no?

You can, yes.

But it's like using assembly language to build a compiler. Sure, it's
possible, but it's the wrong thing to do.

The thing should just use regular wait/wakeup, which has sane
*default* behavior that people are used to.

> If indeed it cannot queue and wake all then surely this is buggered!

It's not that it cannot, but that it's much more limited than all our
normal waiting support (and it's *meant* for much more limited
situations).

For example, our regular waiting code can handle not just "wake up
one" and "wake up all", it can handle "wake up <n> exclusive waiters,
and whoever isn't exclusive".

And by default, normal wait queues just do the right thing, so you
don't have to specify the exact details of the behavior.

Sure, the firmware loader code doesn't _need_ that, but there also
isn't one of the users who really needs the very limited interface
that has odd semantics and odd default behavior that will trip you up.

The swait interface is so special and so undocumented, that I really
didn't expect anybody to even know about it unless they had very
specific needs, much less use it.

Linus