Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp29547lqz; Fri, 29 Mar 2024 07:38:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULDIcjjMazvEsZ+X4y+zv1BVPQ8o/75tv4wPOLXouhDeG/5U50LIDpBdMSDhLmfsLz3LL7kqmZlTjiOH3lOz5t0JdDM/THyG6NejYRqg== X-Google-Smtp-Source: AGHT+IHFNVD4axkyYExZFJbCrDZcv15Nv+jqhejtbo/XNhI0Mo3Rl4C0H2IWhVArHYmFrdXlHYlf X-Received: by 2002:a05:6512:3f2:b0:513:cc18:d4c6 with SMTP id n18-20020a05651203f200b00513cc18d4c6mr2000934lfq.41.1711723119238; Fri, 29 Mar 2024 07:38:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711723119; cv=pass; d=google.com; s=arc-20160816; b=nXk0HrDCdQ6DLZpDGBF4xOzz52wpjXlJk7wY/tSXplY+GcWwGTeetc9rTU966jdtoV mmcWanLo3H0XMEerAG/QA8AcN9BJYlOtK9xCb16tbokJrcRTxPNi8xXe/ruQiHIZBk9/ GmPPgPxHewS+Jv1bP2F3Vklj5ek/hIf1L6PpPi7h6daK/8meWKSQSRrsZ/1SWhMFj1YX szp32+60/XMMLReBpxGa6qCNJWNTArGQc0lJYeO4n2xMmfNObfYEhMGvcItTZJxnfy/W RVsT0KnPnbseol7vEFFIPqAW9ChcX686lHKjasX6Jcmw9oYcJbeKE60Zf8C9ZFcXVLkD aZaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DfX78AyNOS4AYwL+qcuiRO7mc2rO2g3OJrCRzg/4GfQ=; fh=gLO4E9YBHqvv1zZlSBBLRxOSvzDAkR7jZ6pCvYCck6E=; b=RZUmrVACRYyb3vVeChCUj0on8JDeYGW05z4IyCLYO06KzC7arUpKvGGzkL6XOWXDt2 0MKDqVnsCwwF39oGo0v7rE5LtHz2/3oyYg5X/hfN0gXrP/Q0XgCvvdmyZ0ETzbmPU6fA mXw/xcIs+gRf2tX4uosgfCKwi3GBuEnr6oWVpCapFD5UhFiX0qn8QatSjOyVC8vpSzVE m4dFgSOzOiByTBXti/xExxW6ZKkxyMr/5fRJpLM+kyAL+eJpudUaVw6/2llUq0jU1AzQ OUAhX2tcNx9PZItDUKz/V+WpESxabAUJYXv6GPbFiZgPVW7veZ4D04DNF83O/Gp0hrj+ PWjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EB3ryuA4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ka11-20020a170907990b00b00a4e3de05efdsi357022ejc.604.2024.03.29.07.38.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:38:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EB3ryuA4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1E06C1F2789A for ; Fri, 29 Mar 2024 14:20:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2C6C236594; Fri, 29 Mar 2024 12:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EB3ryuA4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 14078236585; Fri, 29 Mar 2024 12:46:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716385; cv=none; b=dPz7aAlgyoixWSmD/ZQdPewK1rI/gwsB0lY+MZT/kcq6qygv6wtBCNfmj2UFfJ9OwzAVprgBBv/f2vgMg1U182umCX2ZzMQHMce7oqLrvs2ikgNEsvQfGVIFOJChe6Ml3mPRLKJ8d8bXZ4dPB5wWetzpjbEtp+gbeUV+ITkbzhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716385; c=relaxed/simple; bh=/IAO9x4QWXDpJ70Imh29GszKpID44rNqtuEIGMATmHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bo1d24w5SpdjSnW7/282/IbM8m+UeKqzZQda+eLczRc2IxZ9cTUsaie/O7f7gaYI+0c0bFLpyB3cyUNoZKbssoFIg9OqLZj+wtmmGbWdcJWz2JOSp3Yq6EScy0Eu8okh/2nUtBdtnu4UknwYJzIYBRY0woMubu3bhjU42qRCEcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EB3ryuA4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92A9C433F1; Fri, 29 Mar 2024 12:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716384; bh=/IAO9x4QWXDpJ70Imh29GszKpID44rNqtuEIGMATmHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EB3ryuA4HKhkU0x7SC1jG7L1Bi5I2SJ/LLQxFFk5bdCVsDZh+BAQsBEB8OjEF3Zid mfIMwSPTe1ecZfyH9bhIfIz5C9nkL2yA9qeYLjzXNQNZyssmV9HoHfpD9sQ18bgUy4 Iaa5AGYaYByP1PE5udLicIKe1Hi0rSTtfipiTxASrudQ1UPa1P1N8NYCf9oXMaSWYp PDoW6xK5FEhckCEnU6roIDZqwZHsEu6xhyqLTxjGEEc4fX9iXgmeGAoQDuyuYs+F6i 45VfQPJ7UmeVZwkkPhiq5iva2eZ77wk6EfMfNqE/SUEEcA3nZ3V5F/lXoJyfonm41G FVRpw/FhkzOMQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: John Ogness , Petr Mladek , Sasha Levin , akpm@linux-foundation.org, jpoimboe@kernel.org, peterz@infradead.org, ubizjak@gmail.com, bhe@redhat.com, lukas@wunner.de, feng.tang@intel.com, arnd@arndb.de, wangkefeng.wang@huawei.com Subject: [PATCH AUTOSEL 6.1 11/52] panic: Flush kernel log buffer at the end Date: Fri, 29 Mar 2024 08:45:05 -0400 Message-ID: <20240329124605.3091273-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org> References: <20240329124605.3091273-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.83 Content-Transfer-Encoding: 8bit From: John Ogness [ Upstream commit d988d9a9b9d180bfd5c1d353b3b176cb90d6861b ] If the kernel crashes in a context where printk() calls always defer printing (such as in NMI or inside a printk_safe section) then the final panic messages will be deferred to irq_work. But if irq_work is not available, the messages will not get printed unless explicitly flushed. The result is that the final "end Kernel panic" banner does not get printed. Add one final flush after the last printk() call to make sure the final panic messages make it out as well. Signed-off-by: John Ogness Reviewed-by: Petr Mladek Link: https://lore.kernel.org/r/20240207134103.1357162-14-john.ogness@linutronix.de Signed-off-by: Petr Mladek Signed-off-by: Sasha Levin --- kernel/panic.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/panic.c b/kernel/panic.c index 63e94f3bd8dcd..e6c2bf04a32c0 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -441,6 +441,14 @@ void panic(const char *fmt, ...) /* Do not scroll important messages printed above */ suppress_printk = 1; + + /* + * The final messages may not have been printed if in a context that + * defers printing (such as NMI) and irq_work is not available. + * Explicitly flush the kernel log buffer one last time. + */ + console_flush_on_panic(CONSOLE_FLUSH_PENDING); + local_irq_enable(); for (i = 0; ; i += PANIC_TIMER_STEP) { touch_softlockup_watchdog(); -- 2.43.0