diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-06-11 11:28:11 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-06-18 12:43:06 +0300 |
commit | 37aadc687ab441bbcb693ddae613acf9afcea1ab (patch) | |
tree | 83a8142d60076d6742205e513fc0fac6c0435fa5 /drivers/usb/host/max3421-hcd.c | |
parent | b2c0931a07b7376c6291e0cfb347ad27f7b66263 (diff) | |
download | linux-37aadc687ab441bbcb693ddae613acf9afcea1ab.tar.xz |
sched: Unbreak wakeups
Remove broken task->state references and let wake_up_process() DTRT.
The anti-pattern in these patches breaks the ordering of ->state vs
COND as described in the comment near set_current_state() and can lead
to missed wakeups:
(OoO load, observes RUNNING)<-.
for (;;) { |
t->state = UNINTERRUPTIBLE; |
smp_mb(); ,-----> | (observes !COND)
| /
if (COND) ---------' | COND = 1;
break; `- if (t->state != RUNNING)
wake_up_process(t); // not done
schedule(); // forever waiting
}
t->state = TASK_RUNNING;
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Davidlohr Bueso <dbueso@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210611082838.160855222@infradead.org
Diffstat (limited to 'drivers/usb/host/max3421-hcd.c')
-rw-r--r-- | drivers/usb/host/max3421-hcd.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index afd9174d83b1..e7a8e0609853 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -1169,8 +1169,7 @@ max3421_irq_handler(int irq, void *dev_id) struct spi_device *spi = to_spi_device(hcd->self.controller); struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); - if (max3421_hcd->spi_thread && - max3421_hcd->spi_thread->state != TASK_RUNNING) + if (max3421_hcd->spi_thread) wake_up_process(max3421_hcd->spi_thread); if (!test_and_set_bit(ENABLE_IRQ, &max3421_hcd->todo)) disable_irq_nosync(spi->irq); |