Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2575831lqp; Mon, 25 Mar 2024 03:13:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTfRoPZl7FKbP/BvyfEV73X5v8zpIG9YQhU8Ex5zkURhZo4mWFiR1ZFaYzAb96Y4XahMZdN3krNMLUjuAe4YtjATX0+PZj2Fn8xV63Sg== X-Google-Smtp-Source: AGHT+IGPiMoJEeGLz8lEvzAslUuaKh1Uoggblp3P3q+CVzg6EjTxX13b/or+WQYVop5eBu0Sku0j X-Received: by 2002:a25:ab2c:0:b0:dc7:4860:1214 with SMTP id u41-20020a25ab2c000000b00dc748601214mr5160365ybi.4.1711361629088; Mon, 25 Mar 2024 03:13:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711361629; cv=pass; d=google.com; s=arc-20160816; b=kX/KAOuvJepI52/xAb1NQPEs95HkN2uASiU86EleV2uT7kNQ2YLA62XDTcFJ4Iv1j6 ardMtv/ikEZN5QQJTfy4cApOLEhOyrIh+1cc8WNhckNmkQVJxs4jRjaHbItcxOHWq8/Q /K6FZAquU7+IGVzpM+aMsU09COrsc08SDlD/ays8VCW4diqPM90tL+WTyfKz8hKRRQYw xwT2XX3H1RYo+PEVP6hvKeFaCe6xL56MvWu96qDQTUylNuSNAzDb0VutyFS3NZkjf0iT yyudwRXLSXwHsLVkEpB5SK4eyEI4OJYj5ZFTWa0y04DH7we87qSjPz5KHGT+QY4LD9sg HTAg== 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=nnrFn2Ce+UaK7x4pe0KEm4vPvX1Na1nP9qd6mtgzJzs=; fh=yJxSnEwdhilIk+VzND6adzGC7IV1gIIfyrgLbFeSc3w=; b=OW5SZzq3x1PFvduXyTFESIf9XJS0f32eMvMAzbutbNxHD7cIfg1DjptABKs2QJBpcN ILrcNmdeEcCNNhepbIFUgiiwYTx0JpHKAwm6OiP9aZ3VjNqVUdxr3nVURhCfpXpGdAiC ybxcsZOxVZ91Ah0R+8KmnpmmgkkvpcQPyjmjUeJEQNMEuYvCTMdo+XFZtHatfi8Q6StG i3VotQFdmK3hAh+iN0kjXP48un3leGNXxoRXil07WWW8Spi9yo+LfcrP8SIdonq1vOof lwtI6BI+OvVSdDlqTo0JV5VuyCx9ePmHbRupqIbmXeBmuH/H8Dw+bBKgRQSU3xj5LcO0 u3wA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jSkINt1F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116141-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jo25-20020a056214501900b0068eeb0d26ddsi7809037qvb.229.2024.03.25.03.13.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jSkINt1F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116141-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C77081C329B6 for ; Mon, 25 Mar 2024 10:13:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0693418147C; Mon, 25 Mar 2024 03:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jSkINt1F" 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 1A9755C600; Sun, 24 Mar 2024 23:41:28 +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=1711323689; cv=none; b=cUEgSZTacsTptTY08dGpi45BD1adGdCciXXeFuqVvucndCZ4Q3QLAMdv2hrGTzdyQTFLKvSymN6ydhcQHJVLkrOQhSJW9gDvQ9kXeeF5P19FuVMjw/D8djsJVrYtntrL3RS+/Cklr/BM6mptkmMt0tCrVpS8UdeL8qrYiTTU4mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323689; c=relaxed/simple; bh=WpIpVWQpJ5OjInFNBU0qyU6PNSvlKenQXTz605Sz9kY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AnEUySkjbQPhaDWUL6PnGrxyazPN6r3k8+qsUZKhUyxIFYiwcT2uFXE7SK/FyHLKxzljyci7OB7sq0mDRxjyF+JuZN9PgW4esg3I/wq6wVAca+yDm2LrI7vLAZL0HSx7RygD/j7O5iY/Qln0uNLIR2dIOLaItRbQCpm6QqvAE3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jSkINt1F; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41DF8C433C7; Sun, 24 Mar 2024 23:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323688; bh=WpIpVWQpJ5OjInFNBU0qyU6PNSvlKenQXTz605Sz9kY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSkINt1Ffow3wKqTEyBqkdvOAQCdymNczqnQGYxGwiIY53MsZqFj/lJm/kXTKUxZi SggnJHvXKZ8jS0t94IohkzDzEboCzVVPkfKy2vOdaF0WOMA7v9B3ZNxQG2tJOlvLDW dvHo80ChkUCPk2YcgrF6obl67oi1SS4MT1sKTY9Dc8JVzdU9Ow05kwISfdtNRmDZ5L iA8kKlad/62n0lyF0XfpYxQGg8WeJDoc0vxcsxH96TkJqbMoMpcVSElqTfdEXb2+f6 lGzj6Iij3C3fB0OpekbcznV/K4jNF9Dv267ToUgpCb8OfZH5DPVXAt6NU+FDmRJ6QQ kl22OExkMuDCQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Brennan , Petr Mladek , Sergey Senozhatsky , Sasha Levin Subject: [PATCH 5.10 060/238] printk: Add panic_in_progress helper Date: Sun, 24 Mar 2024 19:37:28 -0400 Message-ID: <20240324234027.1354210-61-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 Content-Transfer-Encoding: 8bit From: Stephen Brennan [ Upstream commit 77498617857f68496b360081dde1a492d40c28b2 ] This will be used help avoid deadlocks during panics. Although it would be better to include this in linux/panic.h, it would require that header to include linux/atomic.h as well. On some architectures, this results in a circular dependency as well. So instead add the helper directly to printk.c. Suggested-by: Petr Mladek Signed-off-by: Stephen Brennan Reviewed-by: Petr Mladek Reviewed-by: Sergey Senozhatsky Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220202171821.179394-2-stephen.s.brennan@oracle.com Stable-dep-of: d04d5882cd67 ("printk: Disable passing console lock owner completely during panic()") Signed-off-by: Sasha Levin --- kernel/printk/printk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 17a310dcb6d96..94af80b7fa9b5 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -258,6 +258,11 @@ static void __up_console_sem(unsigned long ip) } #define up_console_sem() __up_console_sem(_RET_IP_) +static bool panic_in_progress(void) +{ + return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID); +} + /* * This is used for debugging the mess that is the VT code by * keeping track if we have the console semaphore held. It's -- 2.43.0