Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2676880pxb; Mon, 31 Jan 2022 01:40:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK79Khobx9RN52oXdCGqoGJ+9l6QM8hm3UsbQbEzHl98gOucYiavZTENeOcGkG5IfJISq4 X-Received: by 2002:a05:6402:34c5:: with SMTP id w5mr20269671edc.226.1643622028633; Mon, 31 Jan 2022 01:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643622028; cv=none; d=google.com; s=arc-20160816; b=WVq01HWn1m2vbv5Ls0yim5UpRPtXeoqy9hvtPGSahPoVTCCuv2x9cUgFU9mnm9G/4k SycPR4ax5FO4p2f6AFQlSKYtryOOF1hugVFGQfjAnEZUBIfzYUAQnSDwbFyyNfV1OMR5 eLxHJiN1UCEJnTwlBHn55DhIVELzlq/mqKShfkg49XXl2OuglZybZKmo8JFMtYdSDn4B 4Tob9KAy5gHPFClxPHyNBjhDcZ2IouBOZOd/5+t9ZR/nw2kAmQyxzSpHHQEwWqvDQFTX 7PVKcut1YsIoRDghp2swQoKXTOAd+stdOpxqsbtKaRxNZdfOq4Iz/UtpN/B9iV9dmpMe 81Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=4QlCRjw6E8PPuKf1sx/O8EkHYVn/cqzsxsyQfUDKpXU=; b=OQZsWbkK5bMkzwOlWf/2m/JHH9dNGCKjv3LbaFnEUiycYV013R8fEeLCZuUG0ZVt0G aaCBJqyzwDATGVdkC9ss0iBTfZtzQy28iwzWxQvsaAxsUEsSAR5X7yJ/LGN7IJLAdwY2 chb9ETZHX7DR6ZrB3cG5YQBd7Oc39G9zciWZowVbP7Sd1ITTZnVGYAM1mrc4OYWpa+TF xbio64KzNIkZTpHE5mKukJY+pN4wNmBPeUFiB1I3bKQx4VnFn63S+tkWfaUpeRsTVUOv 9FFC7zJtwHBmP34syeSmmc+8I3S6E9U65xkVRD9vOpzSxbfTYSklFKFPJ2Z6iNDQXDFq aNYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si9561738edz.583.2022.01.31.01.39.44; Mon, 31 Jan 2022 01:40:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348164AbiA1Lm7 (ORCPT + 99 others); Fri, 28 Jan 2022 06:42:59 -0500 Received: from mail.loongson.cn ([114.242.206.163]:40650 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237714AbiA1Lml (ORCPT ); Fri, 28 Jan 2022 06:42:41 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxb+Kh1vNhREgFAA--.17556S6; Fri, 28 Jan 2022 19:42:27 +0800 (CST) From: Tiezhu Yang To: Baoquan He , Jonathan Corbet , Andrew Morton , Peter Zijlstra , Marco Elver Cc: kexec@lists.infradead.org, linux-doc@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] sched: unset panic_on_warn before calling panic() Date: Fri, 28 Jan 2022 19:42:24 +0800 Message-Id: <1643370145-26831-5-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1643370145-26831-1-git-send-email-yangtiezhu@loongson.cn> References: <1643370145-26831-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9Dxb+Kh1vNhREgFAA--.17556S6 X-Coremail-Antispam: 1UD129KBjvdXoW7Xw4kJF18XrW3KF15CFyDKFg_yoWDXwc_W3 4Uuw4DKF4ktayq9ayYganaqr92g3yjvF409a1DG39rt3yktryDXa98AFy8Zr95Jr4qgFZ8 JrZrXF4vkw48CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbgxYjsxI4VWkKwAYFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7 IE14v26r126s0DM28IrcIa0xkI8VCY1x0267AKxVW5JVCq3wA2ocxC64kIII0Yj41l84x0 c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2 IY6xkF7I0E14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280 aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzV Aqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S 6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7Mx kIecxEwVAFwVW8KwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s02 6c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw 0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvE c7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14 v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x 07bFKZAUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As done in the full WARN() handler, panic_on_warn needs to be cleared before calling panic() to avoid recursive panics. Signed-off-by: Tiezhu Yang --- kernel/sched/core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 848eaa0..f5b0886 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5524,8 +5524,17 @@ static noinline void __schedule_bug(struct task_struct *prev) pr_err("Preemption disabled at:"); print_ip_sym(KERN_ERR, preempt_disable_ip); } - if (panic_on_warn) + + if (panic_on_warn) { + /* + * This thread may hit another WARN() in the panic path. + * Resetting this prevents additional WARN() from panicking the + * system on this thread. Other threads are blocked by the + * panic_mutex in panic(). + */ + panic_on_warn = 0; panic("scheduling while atomic\n"); + } dump_stack(); add_taint(TAINT_WARN, LOCKDEP_STILL_OK); -- 2.1.0