From patchwork Tue Sep 24 07:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenqiwu X-Patchwork-Id: 13810453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6DCBCF9C71 for ; Tue, 24 Sep 2024 07:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sveNCmO55zA73Cq65R0Q3qE+br1KOMYEKyeAeW0hpMA=; b=YKXBvkEg4Er+3YSmVFmVcTb1Tb ZCeiuuJcjFwvVGok2WTtOI63UxzGxhu8wQeCl5nQQhQq78sRiT8jQdTxxLzJYu9Gy+qBmaZBfrluY WAo/iqV7AYf4ltYjCF5k6B7J2Lx/tkExQbj7/K5yvbxK6M2ZrhgmFb2NJ2IXZFjN8LQBs5+9ipDTv bRXNondyiOiegRwrHqP1pzGV9tB3CXaxgV2+N/pRYv8B3VpDYMGmy/tp3cpshouw6LHTrL7kgsw+l NWNNTmr1uuNeBUOEG7bXBzKxOUH+rRgjJYtiyMbLBZpASP+5HZfLhhBJ5XavfYK1jzx4W2nZFbNI+ 33WwYKdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st0Mj-00000001Utp-4BGq; Tue, 24 Sep 2024 07:53:46 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st0DD-00000001T6R-2Q2w for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 07:43:57 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20688fbaeafso55220765ad.0 for ; Tue, 24 Sep 2024 00:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727163835; x=1727768635; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sveNCmO55zA73Cq65R0Q3qE+br1KOMYEKyeAeW0hpMA=; b=JBAauxVgS+HOXALjPg02+Jjtbwv9MQrSt9Q/MLXYVl+MOjo7iohHs8g108MYsKfV7t REjLbRQVpyu/5UU6X5SJlDei6axQqBeOV4LGdTBdlckK+Kqi30TU4s/authARDOEDbOQ R9xoo0akgKdgMIrwaGKp4IMyv6VuqZEehYPk4cxjZ7kT7qUDtMEhBLjbL9rMQ0Ruoh+t RWs2ybpQAr7CuGqNGaMISFvGyj5unbutmBaOTl68KLiDQtytiaM9YvVdsrgBOdYfFjuR CmwGT582o94iBt6sDgRjY9GeOvL1bs0/CCiZG9nNFSs36WjD7uCUoSAbdKa9S+I6H02a Mnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727163835; x=1727768635; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sveNCmO55zA73Cq65R0Q3qE+br1KOMYEKyeAeW0hpMA=; b=SQyTz7HRfbQkcIog6KzG8LLvFxOE2qaIZrzCdPYPx514ONL6sTNRgm96yne1NiQiav PwH/JV2KthTZM0heocGDNSuGnsetXTuPAmMuoELi73V6kU7n3h9VjhXh9cGJKtiFKygy 7cvvh01x4JBqItRzb8AjOAQMsxvATiHreyzVDwMdPwvsVrRmGtjNAciMKI1CPSQLAYZu Lgam+zO3yCn9gADmKJnPmZClmFYv6Kdf5quUce34KZFtlmaCVsc3CTdR7JLribbPOjjU xi/XUOSF94o/TvaUGfbieUZ8COEtTKUpqLX6+qkqFvIxRqQgkq4oejz4zg7JA+vI1zoE nd+A== X-Gm-Message-State: AOJu0YxcDfLu58SgZmuB+6FBxehk7HbOVjRT3JEanS8uk5y84ed5ZsAZ xEDqRshLC3h4fLI8CW6hBSUL2mQHKXLnGa9Z63i8nolPOn+I0o48 X-Google-Smtp-Source: AGHT+IGkboJEphLTV+FMa306u2HDfgQ+BFBgzuEmyLxUgIiH1SucNTTRvao0wYxNex2p4+02OD3TWg== X-Received: by 2002:a17:903:1c9:b0:206:99a8:525f with SMTP id d9443c01a7336-208d8338b2dmr265597905ad.4.1727163834623; Tue, 24 Sep 2024 00:43:54 -0700 (PDT) Received: from localhost ([183.226.245.34]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af1819289sm5672595ad.214.2024.09.24.00.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 00:43:54 -0700 (PDT) From: "qiwu.chen" X-Google-Original-From: "qiwu.chen" To: corbet@lwn.net, oleg@redhat.com, catalin.marinas@arm.com, will@kernel.org, paulmck@kernel.org, akpm@linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, "qiwu.chen" Subject: [PATCH v4 2/2] arm64: show signal info for global init Date: Tue, 24 Sep 2024 15:43:41 +0800 Message-Id: <20240924074341.37272-2-qiwu.chen@transsion.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240924074341.37272-1-qiwu.chen@transsion.com> References: <20240924074341.37272-1-qiwu.chen@transsion.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_004355_705120_88AA3E01 X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, it's hard to debug panic issues caused by kill init on arm64, since there is no debug info from user mode in current panic msg such as the user_regs and maps info. This patch shows signal info sent to the global init, which will be helpful for debugging kill init issue caused by unhandled exception from user mode. - changes history: v3: https://lore.kernel.org/all/20240922095504.7182-1-qiwu.chen@transsion.com/ https://lore.kernel.org/all/20240922095504.7182-2-qiwu.chen@transsion.com/ v2: https://lore.kernel.org/all/20231110031553.33186-1-qiwu.chen@transsion.com/ v1: https://lore.kernel.org/all/20231110022720.GA3087@rlk/ Signed-off-by: qiwu.chen --- arch/arm64/kernel/traps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 563cbce11126..3150fb84195f 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -247,12 +247,20 @@ static void arm64_show_signal(int signo, const char *str) unsigned long esr = tsk->thread.fault_code; struct pt_regs *regs = task_pt_regs(tsk); + /* + * The signal sent to the global init needs to be shown, + * which is useful for debugging kill init issue. + */ + if (unlikely(is_global_init(tsk))) + goto dump; + /* Leave if the signal won't be shown */ if (!show_unhandled_signals || !unhandled_signal(tsk, signo) || !__ratelimit(&rs)) return; +dump: pr_info("%s[%d]: unhandled exception: ", tsk->comm, task_pid_nr(tsk)); if (esr) pr_cont("%s, ESR 0x%016lx, ", esr_get_class_string(esr), esr);