From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH 1/6] sched: Unbreak wakeups Date: Wed, 2 Jun 2021 15:58:04 +0200 Message-ID: References: <20210602131225.336600299@infradead.org> <20210602133040.271625424@infradead.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622642287; bh=dHpSABRDz/ACjiNwYplGY79xrERr0Xgmy3y4+S1hSB8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DyLYFBMg9k5l89eFjJpIxjBnu2FGj82B4XdXYxhPkhiK5M5yuGrI9d91r/PWv2LiV K/2h7mAR3azlB6I5M5ciHb74VYjP7zKuJQjACzKPP/OA2ba9LiDUk+xvlBhBE/gp12 vi5CNlvHSLUJYVKuxJf36nLKhtJxH/zOZTChLuKQ= Content-Disposition: inline In-Reply-To: <20210602133040.271625424@infradead.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Peter Zijlstra Cc: Thomas Gleixner , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Jens Axboe , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, "David S. Miller" , Jakub Kicinski , Felipe Balbi , Alexander Viro , Tejun Heo , Zefan Li On Wed, Jun 02, 2021 at 03:12:26PM +0200, Peter Zijlstra wrote: > 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(); ,-----> ,' (OoO load, observed !COND) > | | > | | COND = 1; > | `- if (t->state != RUNNING) > | wake_up_process(t); // not done > if (COND) ---------' > break; > schedule(); // forever waiting > } > t->state = TASK_RUNNING; > > Signed-off-by: Peter Zijlstra (Intel) > --- > drivers/net/ethernet/qualcomm/qca_spi.c | 6 ++---- > drivers/usb/gadget/udc/max3420_udc.c | 15 +++++---------- > drivers/usb/host/max3421-hcd.c | 3 +-- > kernel/softirq.c | 2 +- > 4 files changed, 9 insertions(+), 17 deletions(-) For USB stuff: Acked-by: Greg Kroah-Hartman