From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 851FBC47092 for ; Wed, 2 Jun 2021 13:58:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62E2D613E4 for ; Wed, 2 Jun 2021 13:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbhFBOAD (ORCPT ); Wed, 2 Jun 2021 10:00:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:45766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhFBOAC (ORCPT ); Wed, 2 Jun 2021 10:00:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 09B1D60FE3; Wed, 2 Jun 2021 13:58:06 +0000 (UTC) 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= Date: Wed, 2 Jun 2021 15:58:04 +0200 From: Greg Kroah-Hartman 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 , Johannes Weiner , Jason Wessel , Daniel Thompson , Douglas Anderson , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , "Rafael J. Wysocki" , Pavel Machek , Will Deacon , Waiman Long , Boqun Feng , Oleg Nesterov , Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , John Stultz , Stephen Boyd , Andrew Morton , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, linux-perf-users@vger.kernel.org, linux-pm@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org Subject: Re: [PATCH 1/6] sched: Unbreak wakeups Message-ID: References: <20210602131225.336600299@infradead.org> <20210602133040.271625424@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210602133040.271625424@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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