From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7285935CED4 for ; Fri, 5 Sep 2025 13:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757080156; cv=none; b=lIPzNUsLbOYVCrxV485LgHXhvJyCTdIpouBbxMJUyD7yyBFPCZZvWfrfTkZe9f7tj0vlHFdLxriAhXLygKxjh2VQOwdgZsN562+cptR1DwLYXQLVDFqz/dgxBIFc0rXqdvh1U2PQNG0LsX9B8I/c84qCTbvc0kMSiomAjrw9GGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757080156; c=relaxed/simple; bh=Hyij9GvnO9P7fewDJxzbJ5TTnNsqvSnXtJRP7mrBQQw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=gXy/PX7Nwk93nXZ8Ih9SlHbNfQTuRLH8MKCkUW6sFkrrsQLbcA1Om9JZMIM5R0xBdyuk/RMVKqtPp9s3kqTgxuOmb9Q6cq0ncUd+FztW0LcZI/zfRC8VZrDA4E2sj/V4luy7DbjRlJMjQu9TaDYO7NZJlo2EcYPwaG5cuaanOfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QXrSOSNc; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tUh6xKhO; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QXrSOSNc"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tUh6xKhO" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1757080152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+YCOhnbTUm+NTl9QRitDqMw0nh1plhowmudd5M+EQ1I=; b=QXrSOSNccIFlTMqWW1ERDYMTnWbq8ZNNx9oqnpZwVzm/gCYwRY9pZmcZ9Do4KDE9X3CzQJ G8isaTVc6tzOVAgd6h0Vz9jUItttnROkdwbOi7WiTj6qgf+7xL72gFMH26HA4cWDKBLIgA 7Qxw56JIzGN/u5kQw68mApfKn11AqWooVGrYAwMiKmovfxFMhydaGscseckbWPluGJrHlw 3kjFCKZZt7Oln7yNYhzPNvpnfYhN5A22KoKI5Hjmr3R0wg6su/lkCYu64Pm20Ecrf4XMTs PqOAKRwpYdPsWYO2g+U+xCMnCQ2gSyYZG0uaTJ0en7kWI/q4f/WwLfoKEdPK0Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1757080152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+YCOhnbTUm+NTl9QRitDqMw0nh1plhowmudd5M+EQ1I=; b=tUh6xKhOhRBa/pDd+9fCPnosUnBQUM0ZJPwjPT+gJ7tymJoh/gowRl553li8BCsisywYWH pNf5kN8KN/idUGBA== To: Petr Mladek , Sergey Senozhatsky , Andrew Morton Cc: Petr Mladek , Feng Tang , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] panic: Remove redundant panic-cpu backtrace In-Reply-To: <20250903100418.410026-1-pmladek@suse.com> References: <20250903100418.410026-1-pmladek@suse.com> Date: Fri, 05 Sep 2025 15:55:11 +0206 Message-ID: <844ithf1rc.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On 2025-09-03, Petr Mladek wrote: > From: Sergey Senozhatsky > > Backtraces from all CPUs are printed during panic() when > SYS_INFO_ALL_CPU_BT is set. It shows the backtrace for > the panic-CPU even when it has already been explicitly > printed before. > > Do not change the legacy code which prints the backtrace > in various context, for example, as part of Oops report, > right after panic message. It will always be visible in > the crash dump. > > Instead, remember when the backtrace was printed, and skip > it when dumping the optional backtraces on all CPUs. > > Signed-off-by: Sergey Senozhatsky > Link: https://lore.kernel.org/r/20250731030314.3818040-1-senozhatsky@chromium.org > [pmladek@suse.com: Handle situations when the backtrace was not printed for the panic CPU.] > Signed-off-by: Petr Mladek > --- > diff --git a/kernel/panic.c b/kernel/panic.c > index 72fcbb5a071b..e3cec9bc05ef 100644 > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -422,13 +432,15 @@ void vpanic(const char *fmt, va_list args) > buf[len - 1] = '\0'; > > pr_emerg("Kernel panic - not syncing: %s\n", buf); > -#ifdef CONFIG_DEBUG_BUGVERBOSE > /* > * Avoid nested stack-dumping if a panic occurs during oops processing > */ > - if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) > + if (test_taint(TAINT_DIE) || oops_in_progress > 1) { > + panic_this_cpu_backtrace_printed = true; > + } else if (IS_ENABLED(CONFIG_DEBUG_BUGVERBOSE)) { > dump_stack(); > -#endif > + panic_this_cpu_backtrace_printed = true; > + } It took me a while to wrap my brain around this new logic. I guess in part because the comment above only tells a part of the story. I tried to write a suggestion for the comment, but it ended up being just as confusing as the code. So, I guess we just leave it... It seems this patch has already been picked up in the mm-tree (with a patch on top), but if not: Reviewed-by: John Ogness