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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C6F1C433E0 for ; Wed, 3 Mar 2021 14:06:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50ECE64EC3 for ; Wed, 3 Mar 2021 14:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242955AbhCCOCa (ORCPT ); Wed, 3 Mar 2021 09:02:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842909AbhCCKWZ (ORCPT ); Wed, 3 Mar 2021 05:22:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FDCC08ED80 for ; Wed, 3 Mar 2021 02:15:43 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1614766537; 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=aIgzcClqdt8bamaPognH+cXAeOEvrwnEOvhbMvR50pI=; b=aafh14V6g/BpVLvTFZJ7nDVt57Jccy7Q9ityXev4cYHgvH1FHnu1jcrchhDbQuibJ3sV9E QE5jSwXmxeRadGgtfWqtOf4Z+ZD3/WlgEPz2aD6qThAXpX9jVQkhE3cuRhAyJ5a/61Bc4u 6qhN9ZiA79BP7a4Xb2ag4AjzTRmzwmc1SP8IvDMPVeb+UH3rMAZsTwMlqw2N+xIsUfkhy3 EXBjWZQwJFcnTHU8qpJQaxjKDYdttnxAbq4Vt0hAbnAf8oMJjbUpSQBHoMXiWZjqlhHv4w 6h4Wrbk6xkl4EqMjd0ei4yLu0W4B1zweQI91iD0HNhP7XcpTm1AH7KcytX80Ng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1614766537; 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=aIgzcClqdt8bamaPognH+cXAeOEvrwnEOvhbMvR50pI=; b=3fXbWMFJGw/M9KaXwDPYNFR+jv54S+zBhf1/bza8k/IwvV5O+hzcOaaXlbg/scKpgH5OZM HkOfm4v8ByGcDEDA== To: Petr Mladek Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH next v4 15/15] printk: console: remove unnecessary safe buffer usage Date: Wed, 3 Mar 2021 11:15:28 +0100 Message-Id: <20210303101528.29901-16-john.ogness@linutronix.de> In-Reply-To: <20210303101528.29901-1-john.ogness@linutronix.de> References: <20210303101528.29901-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 Upon registering a console, safe buffers are activated when setting up the sequence number to replay the log. However, these are already protected by @console_sem and @syslog_lock. Remove the unnecessary safe buffer usage. Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- kernel/printk/printk.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 602de86d4e76..2f829fbf0a13 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2967,9 +2967,7 @@ void register_console(struct console *newcon) /* * console_unlock(); will print out the buffered messages * for us. - */ - printk_safe_enter_irqsave(flags); - /* + * * We're about to replay the log buffer. Only do this to the * just-registered console to avoid excessive message spam to * the already-registered consoles. @@ -2982,11 +2980,9 @@ void register_console(struct console *newcon) exclusive_console_stop_seq = console_seq; /* Get a consistent copy of @syslog_seq. */ - raw_spin_lock(&syslog_lock); + raw_spin_lock_irqsave(&syslog_lock, flags); console_seq = syslog_seq; - raw_spin_unlock(&syslog_lock); - - printk_safe_exit_irqrestore(flags); + raw_spin_unlock_irqrestore(&syslog_lock, flags); } console_unlock(); console_sysfs_notify(); -- 2.20.1