Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9238903rwl; Sat, 31 Dec 2022 22:56:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhlxO/6oF2+Sg0FRr6ff50Yja2VB/wNHcKn5nf52dN1d5o9DHPEmxlsVtBU5Rdw7fHdnLE X-Received: by 2002:a17:907:a782:b0:7c1:6430:e5d0 with SMTP id vx2-20020a170907a78200b007c16430e5d0mr32579168ejc.4.1672556200654; Sat, 31 Dec 2022 22:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672556200; cv=none; d=google.com; s=arc-20160816; b=kQKPKkIce1vqVfJa1i5Zh+KsErpIo3+T27GL+K57P5oQBOU48NWVSvxpSRXINYZ94k +GB8Ed9MB9cyN52rIkEm8JvbCoIMZEpgB6tu9ji01WtVQHDnwh/1Mb2BxfkmoIRB9kFA AQ4RwaDyq+1v3Bnnq65HfraUo0NzbLH2atx///7EuqCTOUkOsIn6w7Kzv4pUmz+UN7M0 RWoDs3vryJkC+SJuY6eMGAsAIe4tppzPZOZfTZz99Cfn58elfhdrKyz57Tvd6iYjw2Rr ZuVWRE/aU3AR4ESXt1i+VnkKFMatNU1U22i3CN00qhr2eIcVjqOPMSa6mgqEedSYJeiD 49DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FtfnZ0V05BlgjlWPLYPsWqRel3QPXIplFXSje5Bb4hw=; b=rxUJ62o3UZVr1Er9lrX/ketZM6/NuPNbh9BmQVNRJLtMW4GdQ/CMwAml42ub0jgJpD wBTPkX0NudXAvlk+CtDznPhdohO7kWKh4o6t3Onm+IU7knyvkp0KGSfap2WJB797Wrbo 2HpR0A16dfaEL0xqY95xqqX7Mdm9BTLHAPMhbDUBr/NKolf+s6oJ1cT4sCyLkHyEiqLi z4kC2iFrqK8tcDfIa3ufKlZJrHwm1s5u0V4r+EzG6OT7atcka6gkm8B/p3YyuFam0oHo onodDIdctEY3JxJaqwAF8nyoFIW32/XuTtbNY1SsZrXLSaKH1qEYlqFxnbSsJw0I3GF9 aLbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RC4NYnMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc2-20020a170907074200b007ae30b550e5si21952522ejb.854.2022.12.31.22.56.26; Sat, 31 Dec 2022 22:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RC4NYnMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbjAAGUO (ORCPT + 60 others); Sun, 1 Jan 2023 01:20:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjAAGUM (ORCPT ); Sun, 1 Jan 2023 01:20:12 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC211080 for ; Sat, 31 Dec 2022 22:20:11 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id p36so37446977lfa.12 for ; Sat, 31 Dec 2022 22:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FtfnZ0V05BlgjlWPLYPsWqRel3QPXIplFXSje5Bb4hw=; b=RC4NYnMMBtpX2MC8xx996T5hNhz+g6ifNsUbCZgsKO+bXJJkUlGj0p5OPv+fDSw6tl jO0riEpZi+l6lsRMuyPUfV8SP7YuWLqDmo9bAeMJhsh4RQgCSVog/j2G7FuFdSEU3yR1 n1ZU9yZ119GmgY7XwU6EMeE0X+DKHgdJ70bJc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FtfnZ0V05BlgjlWPLYPsWqRel3QPXIplFXSje5Bb4hw=; b=pEM/gkOlSh+GwXcoIwhadqaluY+bwE2oL40hd6K90GgdqhclIeeG6L0/UBKLH9JCcY t7qD1c1rjrqyKJsNf028QQZKnBKBz3IIYWHIivILODLXucUR3v1s+TOGONI526YlEb5i 5UYiTu5TAqCkFWHrQt6XzSa9WdxwAh0zjxfeigsDV6SOPXvIOzTZF7GP36k8GpJBUBYB DkH4qI4F5Ga/EdnVIS8CR8WI3Cbi0aFbe5tTAVM6OsbVkGUmIQn5aH1VuWDVmh8qkmLR TN4/LlOKMq4h8NMx82Bl1eABU4BTWBkFGLo+XTDYrRgaCzyHtIGZIYGcjnZc1GRH+fps qooA== X-Gm-Message-State: AFqh2krjDERdcMw90FcjuwnZXPGfxsNV1AvLGvwOYcqEtSM/G+yseNQy wpuhs/cGFsF9jJK9Qja4wkBmBI5UPJaZE5YvFNPdoMFJ5I+GxA== X-Received: by 2002:a05:6512:e90:b0:4aa:148d:5168 with SMTP id bi16-20020a0565120e9000b004aa148d5168mr1779729lfb.561.1672554009126; Sat, 31 Dec 2022 22:20:09 -0800 (PST) MIME-Version: 1.0 References: <20230101061555.278129-1-joel@joelfernandes.org> In-Reply-To: <20230101061555.278129-1-joel@joelfernandes.org> From: Joel Fernandes Date: Sun, 1 Jan 2023 01:20:01 -0500 Message-ID: Subject: Re: [PATCH] torture: Fix hang during kthread shutdown phase To: linux-kernel@vger.kernel.org Cc: Paul McKenney , Frederic Weisbecker , Zhouyi Zhou , stable@vger.kernel.org, Davidlohr Bueso , Josh Triplett Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 1, 2023 at 1:16 AM Joel Fernandes (Google) wrote: > > During shutdown of rcutorture, the shutdown thread in > rcu_torture_cleanup() calls torture_cleanup_begin() which sets fullstop > to FULLSTOP_RMMOD. This is enough to cause the rcutorture threads for > readers and fakewriters to breakout of their main while loop and start > shutting down. > > Once out of their main loop, they then call torture_kthread_stopping() > which in turn waits for kthread_stop() to be called, however > rcu_torture_cleanup() has not even called kthread_stop() on those > threads yet, it does that a bit later. However, before it gets a chance > to do so, torture_kthread_stopping() calls > schedule_timeout_interruptible(1) in a tight loop. Tracing confirmed > this makes the timer softirq constantly execute timer callbacks, while > never returning back to the softirq exit path and is essentially "locked > up" because of that. If the softirq preempts the shutdown thread, > kthread_stop() may never be called. > > This commit improves the situation dramatically, by increasing timeout > passed to schedule_timeout_interruptible() 1/20th of a second. This > causes the timer softirq to not lock up a CPU and everything works fine. > Testing has shown 100 runs of TREE07 passing reliably, which was not the > case before because of RCU stalls. > > Cc: Paul McKenney > Cc: Frederic Weisbecker > Cc: Zhouyi Zhou > Cc: # 6.0.x Question for stable maintainers: This patch is for mainline and 6.0 stable. However, it should also go to 6.1 stable. How do we tag it to do that? I did not know how to tag 2 stable versions. I guess the above implies > 6.0 ? Thanks, - Joel