Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp14177pxb; Wed, 30 Mar 2022 21:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+hBfmijOT/iAiPQrvs7Xt+jC4nl2l53eqTh4ehzhaR97N+sX6GdN7pcY8PTzfl7iXRFym X-Received: by 2002:a05:6a00:1145:b0:4f6:3ebc:a79b with SMTP id b5-20020a056a00114500b004f63ebca79bmr3280665pfm.41.1648700928298; Wed, 30 Mar 2022 21:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648700928; cv=none; d=google.com; s=arc-20160816; b=mhkWBj7NCtouvI020yLqHoOXZ8AA23vhScFL+MbxgVpalH886Eu4Vk17QLAeE4z7XC YsZxBkgUzLJYBs5U/DjzBVQ33TbtWYnCFO4LGiRaC++wKz6cyWg1IJVKIth5EFZusXMy S5Nqgz3MUUVPW3oxuIVtKenTKfAwHa2omhxKNLdp/5CPqGh6nJEtyO3Hd5luIQBilKjE 3G9TFlpLH6eC55rIFYGOtFupJf5sdLWX8gd5ibUkMkRO0Wws3iwFMcvxGUWfZwoasIh+ yPkxL8qZOL1F9hgA7e2KT9XaYOIHw0jc8g6b3NdCPzO+oIdvN2Zq/YnN7nXi/Jkt2MDf DfOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kQrI75ial2HzFi44gyAv6HVMt6I0q0X83U+KwrkLw8Y=; b=zCuW8l6MksAClxHcP6Jx1m823lR8Ttzlp7MNOMPEerODj16B3IlxP42nzN+doJQRp1 kTebNObEJJiW6/mfdsUrUBSBvdcbYbbGC40c4PiRiCxpGbpeDR/Ugkug2G3yF229PT9t /UozoIg+bBWHl/JTSdnAbcH5/OGZg4z8Y0u/Hg1XD9ut3zLuoGmE+M3zf+R20+m3y6uB SqM/wX5/Kz1OafyoDvyzYDdjmmmUiHrKj21j/3LxXJgY2uilhhMoVuzZUgN3Eqh7i0mP uJ2Ii7gwpMlk3BYXznzSBakBK8GBgd3YB84vHsED/pUrNeSOCDj04oRRqDZfDIrm6JQs WT8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1YpLTg7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r9-20020a63e509000000b003846511c111si22907807pgh.43.2022.03.30.21.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:28:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1YpLTg7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 563A71AFE8B; Wed, 30 Mar 2022 20:23:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344641AbiC3MBx (ORCPT + 99 others); Wed, 30 Mar 2022 08:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344655AbiC3LxW (ORCPT ); Wed, 30 Mar 2022 07:53:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A492D26B3B0; Wed, 30 Mar 2022 04:49:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39489B81ACC; Wed, 30 Mar 2022 11:49:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16F17C36AE3; Wed, 30 Mar 2022 11:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648640960; bh=NgsPTeGkD8F8eAlsIyJJJaUVdluFyLTrmkEIT4kwEvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1YpLTg7xRhr7zFmGowusGlH6Ym+JRI1MbOGMNQUPCi4pc/kGBz9Or5u//zHWeXho 3Sc5uLa2R7GyDbqFHZpItNKMRU56XTbBuoV+KKmdSg7MuZV+kS7fAdQ2GFdpol0f8s xWEmcr5lRor4uD/I+k2CzkgU0GuwGwXyj1fFSmDCp1XvA4He0sqOBSsiSBIQwHMSgD kgr+0yK3DGF9C+IzLNBnAsCucQLEam0XrtVSGoFP3YqfQtGI0wzgeaCoudZ05H8Tbi 1aIspoaQa/5McFmgA7rcyFYF5JXRPpeckMfjzlElO1WwpWyk181ilE0bKWowl8pg/+ dB5fslxH/LS3A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Brennan , Petr Mladek , Sergey Senozhatsky , Sasha Levin , gregkh@linuxfoundation.org, linux@roeck-us.net Subject: [PATCH AUTOSEL 5.16 31/59] printk: Add panic_in_progress helper Date: Wed, 30 Mar 2022 07:48:03 -0400 Message-Id: <20220330114831.1670235-31-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220330114831.1670235-1-sashal@kernel.org> References: <20220330114831.1670235-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 57b132b658e1..e3d986dd49a1 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -256,6 +256,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.34.1