Re: [PATCH] firmware: wake all waiters

From: Linus Torvalds
Date: Wed Jul 05 2017 - 12:33:54 EST


On Wed, Jul 5, 2017 at 9:18 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> So swait should be capable of most things people want from a waitqueue.

But what's the point?

Regular wait-queues work fine. The advantages of swait aren't huge
even if you fix the crap it does now.

And the disadvantages of "another interface to do the same thing" are
big indeed.

Keep it specialized.

> Right, so we need the raw_spinlock in order to run from non-preemptible
> code on RT. And we then also need bounded runtimes on stuff.
>
> The only function which is affected by that is swake_up_all(),

No.

The fact is, "swake_up()" needs to do that "wake up all" for this
interface to be even *REMOTELY* acceptable for general use.

Seriously. If the regular "swake_up()" doesn't do what people expect
from a wakeup, then it damn well should not be used, and not be taught
to people. It's a very specialized interface for only two users, and
right now it looks like one of those two users shouldn't have used it
in the first place.

> In any case, I'm not seeing why you call it idiotic.

Have you read the problems?

There were originally three users:

- one of them is firmware loading, and it was actively *buggy* due to
using hat shit interface, and it's going away

- one of them is kvm, and for kvm that interface was shit.

- the final one is RCU, and even there it is very questionable.

There is no question: swait() is a mistake and should not be used. And
you're apparently still in denial about how completely broken it is to
have "swake_up()" have different semantics from "swake_up_all()".

Linus