Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1053474ioo; Sun, 22 May 2022 02:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnFyQh1fAvOQbRqmSWrlswO4oJV+F/eJFYeEMWgS0awpXSNplYg/uhJr3AvP48zbP6RwkP X-Received: by 2002:a63:84c3:0:b0:3fa:321e:4145 with SMTP id k186-20020a6384c3000000b003fa321e4145mr1809013pgd.528.1653210508761; Sun, 22 May 2022 02:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653210508; cv=none; d=google.com; s=arc-20160816; b=g1rf0T0znF6oPhwu5nrg5F2D2PXydUtA3J3TKFB2G2GUthcNdme+Zp9up1HwJtfQ+g uGR7qqmcl3SPF33DjO5uceNIv9W8E+wa8i/WgJym7MNFen+q5+64OkA8ljxTSQyGGHtA Kqw82OpUC2dsUpdT8TigGQfPI5RUAN6Y7gs8u0YYwmkjixWRQlb+bQ3+rU4KQd+L+UQo O9kYZcjhtJNU6CvrIGgWZ1/ScbSaJrWePaZQNkZPFo3gRDYn57O2pjnp0STfK+TljLcd wzugqGljho6FVb5jEWHjiYSLdb2l+W+Mq/KI3R2jsqMQWWwohusIU47TTbHI5fx3Nt0m Ytpg== 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=7fJ9ExdcjjMQQ8V9d8hANiOgdYItD7YLNbxTme23ZaE=; b=nLLy0wV/J+gdeBsBFhJ04bB9/EwtigfgcDP2XEIFJ36uCzdFRblK2R7MZKDBDGM/Zv iwmmP/753tqKy4qnm/HtY2wcrl4xtRKEZHI8pf4jLfsAbiUwK81yzpcLb4R7fxADk0Gt PjTo5Afje84MkU43EsaEPoQCb5Q95b8907DWknUP9Dvoa+2ac7R6P44H/Wt8Br/93fbS J+RzORLuWAR8imRijcvnxV6AJfcUG9EkWw7BYMKw3AQEUylIlu4soiucbo2nKUBp9pvG QC8Tm7ZTW6TFOi7jP+PRbyzc+E4VzKZm4pEaYTeUydrNDawjKoL1S87tv0UqmQVV0b0K q2Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jLgjd69z; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a170902cecf00b00158ec58e06csi7141599plg.519.2022.05.22.02.08.17; Sun, 22 May 2022 02:08:28 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=jLgjd69z; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232767AbiESQqZ (ORCPT + 99 others); Thu, 19 May 2022 12:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241854AbiESQqT (ORCPT ); Thu, 19 May 2022 12:46:19 -0400 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8F550014 for ; Thu, 19 May 2022 09:46:18 -0700 (PDT) Received: by mail-oi1-x229.google.com with SMTP id t144so3887539oie.7 for ; Thu, 19 May 2022 09:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7fJ9ExdcjjMQQ8V9d8hANiOgdYItD7YLNbxTme23ZaE=; b=jLgjd69zQsVPDeA1HfRulTSBId6Jel7vK3DYbGBFs4aCDwIeEjTqiBSVIbinXdZXSy H6pU66QyQhVlzK9Qgv5dzmsWXOTD+9v3ewdMTJMvAzQXYv0rHwO3CX+lZVlOb038Bawf aFIMEnkZSc600FwmQyzRcrHKJRkVIaSZk48fBNz3kJn7lvNXHIYYkYYQs8aB0zAWNCC8 lgr7dDbrs8t3EVZTh1TAft8M/f3q2eES9ZbaVFXTrZmaYDz0QSgsvFKAHAmpKSzlg2lA vsAE/JOrY5L0m62XoqemIFUOBLHyUS5+B0km8ca8ZcLtxyCYim6C4FZplB/7IoFdw/CC Gd7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7fJ9ExdcjjMQQ8V9d8hANiOgdYItD7YLNbxTme23ZaE=; b=Yvmmpm6yPRonh05HQEIDnEn4cqLvjZ7wgcbp3NFIgMfRv5RUwM28/PgrHQJ7V7bgNW B62qGsiStm0/BWTk+170vxyzQGY58doRWFqqSxUapEj2PlsTMtqfbqLRLYwf0JN5X9xI MiRfNQ/VR+9cqaCs/0g84Lf2FFtIIMBWaZEuQWs69XUv3FOvqQ0+fIxd94+QIix6dpqJ ns0ak5cfSg1+T11JBV/AZD65SWFGLTQZSP16915XIZ9db49x2R3L983j5AqCe7tCD+tG 62rgOaLetu8Pez7ibAAA5agZkMXrj4gDdfLaNfr1JXQuBfMVZ+au2BreotytZiLkmdvq 4kKA== X-Gm-Message-State: AOAM533OB3ah0kCStMAPCB7mpwijj/QPIF/Nis0R3ShSOci8W5MajWo5 lkGXboLCfS9yPQFSdhhwVDqC3zECTpno1w4lrJA= X-Received: by 2002:a05:6808:bd4:b0:326:c2e8:2d1e with SMTP id o20-20020a0568080bd400b00326c2e82d1emr3084544oik.52.1652978777294; Thu, 19 May 2022 09:46:17 -0700 (PDT) MIME-Version: 1.0 References: <20220519161125.41144-1-schspa@gmail.com> In-Reply-To: From: Schspa Shi Date: Fri, 20 May 2022 00:46:06 +0800 Message-ID: Subject: Re: [PATCH] sched: Dump stacktrace when some task failed to stop To: Valentin Schneider Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, Linux Kernel Mailing List 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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Valentin Schneider writes: > On 20/05/22 00:11, Schspa Shi wrote: >> Some processes may not be stopped, such as workqueue workers. >> >> Add this dump_stack to easily figure out which process caused the problems. >> >> Before this change: >> >> <4>[ 517.545889] ------------[ cut here ]------------ >> <4>[ 517.545901] Dying CPU not properly vacated! >> <4>[ 517.546366] ---[ end trace 0000000000000002 ]--- >> <4>[ 518.546831] CPU6 enqueued tasks (2 total): >> <4>[ 518.546855] pid: 49, name: migration/6 >> <4>[ 518.547010] pid: 6231, name: kworker/6:0 >> >> Signed-off-by: Schspa Shi >> --- >> kernel/sched/core.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> index 53596842f0d8..de6b5320e4d7 100644 >> --- a/kernel/sched/core.c >> +++ b/kernel/sched/core.c >> @@ -9416,7 +9416,14 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl) >> continue; >> >> printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm); >> + if (p != current) >> + sched_show_task(p); >> } >> + /* >> + * We need the stack of each cpu to analyze who is blocking the >> + * current cpu scheduling >> + */ >> + trigger_all_cpu_backtrace(); >> } >> > > Given you get a WARN() when this happens, can't you get the same thing with > > panic_on_warn=1 > panic_print=PANIC_PRINT_ALL_CPU_BT > > ? Yes, I can get the information with these two parameters set. But this is generally a difficult problem to reproduce, so wanted to print it here so that useful information can be obtained without turning on these switches. > >> int sched_cpu_dying(unsigned int cpu) >> -- >> 2.24.3 (Apple Git-128) -- BRs Schspa