Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp444189rwe; Wed, 19 Apr 2023 00:50:15 -0700 (PDT) X-Google-Smtp-Source: AKy350bYU/6+dLYlWgLkqgE6WPw4sEEE1RaAEvPtm0trMKnPb1uZB4SZ+eFsA5szDB4mrE/6CRGv X-Received: by 2002:a17:903:18f:b0:19a:b427:230a with SMTP id z15-20020a170903018f00b0019ab427230amr5101718plg.63.1681890615254; Wed, 19 Apr 2023 00:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681890615; cv=none; d=google.com; s=arc-20160816; b=fSE4auUh0zssyss+7nR+YV6S/EzJKt+rqU1XBD/0Sd8zBop25UPWGBFGMTQPlksbMC J2LjMGovLpfSZ32DPyY1yO89Gc5PDvdJFmZ5CDveOdGes1uH7dAf9o4hk1P6/RfL2cL/ 2fmSudYOXHISeJ8RFv8jbqBw6dniFZl8+dJaEYhr+bK9hhIsCbkq3hiS9Jjr0W1emlB4 /yk6cv5eExEaWWdZFwgWygKbKMHBFCZsqqTfxzUeEEVfRA94nxkY5uw2lheylIj44cO5 ddK5RsPQPk0yaa2jbJbPqODvvINi5W2SXKery3xjSdpxY0bl6c0QarsQQCxrXzmBY2XA qo2Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UzVUs+NcKfpPnRkrILdkjoJFYTyn1Afn69dgHx+rH9U=; b=AbDA3CF1oL6O3mC/uCAgVF3phhT+uC2oPyl1E3jTmeyBBXNxLctNV3m1yNspS69H5Z BibqEsXGbVBgjzZIXC4JkKubAmz928NE4hgNTFl416TUIdj14lDuoESiyXOxy+Bdr8t+ TXbZDWzNQNL35sBsEd0u8jxCn4ht1HcOEqsh+VkR+12yygMC+IPCfN1Y21Ois21JMZdq YftlERK9PusjyqfghEC0loCvSBcCRI3no6TTmiHryenJ3uVYNUtBdLgyHxucwCh2vy1C X18y6vvNhIk+ugIWsPkqCP+9BaVJfuZtm6VUOHSJAeXwQqcM5yDmeLlI70QGHBqBzZ1K j2FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SZgPNF5L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a17090abf1200b002467d05c498si1224637pjs.69.2023.04.19.00.50.03; Wed, 19 Apr 2023 00:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SZgPNF5L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbjDSHnF (ORCPT + 99 others); Wed, 19 Apr 2023 03:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjDSHma (ORCPT ); Wed, 19 Apr 2023 03:42:30 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C17DB472 for ; Wed, 19 Apr 2023 00:42:29 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id CFE891FD8A; Wed, 19 Apr 2023 07:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681890147; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UzVUs+NcKfpPnRkrILdkjoJFYTyn1Afn69dgHx+rH9U=; b=SZgPNF5LpNK1fCrO63cyU4bB2QrO7CqxFrHaLjLAfb0sZ8t+HFXn1Ic1ymsnyggIsxfWew 1DSCfmhSS1GRNyaEFdmNtDJ3l1lbb05icTlFCZSYRhsUY2he+ozejj2iYMLFj2+u2bBNCG Ubn/e/TWdAZdLXH1c0fbyNSDLo6RaWw= Received: from alley.suse.cz (unknown [10.100.201.202]) by relay2.suse.de (Postfix) with ESMTP id 3A0ED2C141; Wed, 19 Apr 2023 07:42:27 +0000 (UTC) From: Petr Mladek To: John Ogness , Sergey Senozhatsky , Steven Rostedt Cc: Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH] printk: Enough to disable preemption in printk deferred context Date: Wed, 19 Apr 2023 09:42:10 +0200 Message-Id: <20230419074210.17646-1-pmladek@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 The comment above printk_deferred_enter()/exit() definition claims that it can be used only when interrupts are disabled. It was required by the original printk_safe_log_store() implementation. The code provided lockless synchronization between a single writer and a single reader. The interrupt and the normal context shared the same buffer. The commit 93d102f094be ("printk: remove safe buffers") removed these temporary buffers. Instead, the messages are stored directly into the new global lockless buffer which supports multiple parallel writers. As a result, it is safe to interrupt one writer now. The preemption still has to be disabled because the deferred context is CPU specific. Fixes: 93d102f094be ("printk: remove safe buffers") Signed-off-by: Petr Mladek --- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 8ef499ab3c1e..915a321b491e 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -161,7 +161,7 @@ extern void __printk_safe_enter(void); extern void __printk_safe_exit(void); /* * The printk_deferred_enter/exit macros are available only as a hack for - * some code paths that need to defer all printk console printing. Interrupts + * some code paths that need to defer all printk console printing. Preemption * must be disabled for the deferred duration. */ #define printk_deferred_enter __printk_safe_enter -- 2.35.3