From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D918C41535 for ; Mon, 7 Feb 2022 19:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240906AbiBGTpS (ORCPT ); Mon, 7 Feb 2022 14:45:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239957AbiBGTn3 (ORCPT ); Mon, 7 Feb 2022 14:43:29 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BD63C0401E4 for ; Mon, 7 Feb 2022 11:43:28 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1644263006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YeoQK9icCZQHqxjTMXztaF3pNjld+IRlJPuqBw66sL4=; b=hxkII20lpD34X3CtBuHp0CCV19hqTdEWFnxIE5rW4TLI34jRq/J67CNh5e4+3zDXTBLSKX ZGvj+VV6gesck38MmRndRSBkyFNywpPs4q0oJpdExUBfdTKSpOGEdN52XBeRDmehsVKx+A n451bPzMFczXFfkN5j4OCPOXRgMJ1xv9CrQMIxejRmtoaMTYIuz+DHiC0wlc5VGxDlC7fs nUutZecadPcS0xzYsrZawVhhTontfdlHboTCl6zinMlYZTzb6CkP6iP6zHuRJzs7wfI6Af R42Sf06HJt/gS/xMEXFABJGYI7IEUwBBsqxBnfXKmXGxzu4kDpWYofX+kkzcoA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1644263006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YeoQK9icCZQHqxjTMXztaF3pNjld+IRlJPuqBw66sL4=; b=nVSx6zvM/ianRuZFzFAUSAoY9g0kHDH5KgIleQqCyOf3LLx4Zlas+Cwvz+Wb0pPCQkZFHu sJpkZzB1vWIqg9CA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v1 02/13] printk: cpu sync always disable interrupts Date: Mon, 7 Feb 2022 20:49:12 +0106 Message-Id: <20220207194323.273637-3-john.ogness@linutronix.de> In-Reply-To: <20220207194323.273637-1-john.ogness@linutronix.de> References: <20220207194323.273637-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CPU sync functions are a NOP for !CONFIG_SMP. But for !CONFIG_SMP they still need to disable interrupts in order to preserve context within the CPU sync sections. Signed-off-by: John Ogness --- include/linux/printk.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 780408b29c13..cd8192e611a1 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -285,9 +285,16 @@ extern int __printk_cpu_sync_try_get(void); extern void __printk_cpu_sync_wait(void); extern void __printk_cpu_sync_put(void); +#else + +#define __printk_cpu_sync_try_get() true +#define __printk_cpu_sync_wait() +#define __printk_cpu_sync_put() +#endif /* CONFIG_SMP */ + /** - * printk_cpu_sync_get_irqsave() - Acquire the printk cpu-reentrant spinning - * lock and disable interrupts. + * printk_cpu_sync_get_irqsave() - Disable interrupts and acquire the printk + * cpu-reentrant spinning lock. * @flags: Stack-allocated storage for saving local interrupt state, * to be passed to printk_cpu_sync_put_irqrestore(). * @@ -314,13 +321,6 @@ extern void __printk_cpu_sync_put(void); local_irq_restore(flags); \ } while (0) -#else - -#define printk_cpu_sync_get_irqsave(flags) ((void)flags) -#define printk_cpu_sync_put_irqrestore(flags) ((void)flags) - -#endif /* CONFIG_SMP */ - extern int kptr_restrict; /** -- 2.30.2