From patchwork Wed Apr 19 07:42:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Mladek X-Patchwork-Id: 13216466 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EB23C6FD18 for ; Wed, 19 Apr 2023 07:42:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 275B38E0003; Wed, 19 Apr 2023 03:42:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 226C88E0001; Wed, 19 Apr 2023 03:42:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 117448E0003; Wed, 19 Apr 2023 03:42:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 042158E0001 for ; Wed, 19 Apr 2023 03:42:31 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C3034801FD for ; Wed, 19 Apr 2023 07:42:30 +0000 (UTC) X-FDA: 80697348060.08.5F6508F Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id 2388D4001B for ; Wed, 19 Apr 2023 07:42:28 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=SZgPNF5L; spf=pass (imf17.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681890149; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=UzVUs+NcKfpPnRkrILdkjoJFYTyn1Afn69dgHx+rH9U=; b=CW37WG4XbrKcErqVJyX0L+UXvazoFri880bL6nZPg/iwf4vjsO1YLRnTUdV5QE55bPw/I5 IJL6pGqzQrDNzzkmbEAoqVx2jq5TI7qrFuGO9MnM0cBUiu/S33+8POqRU0QfYaOGcrcWWT bIlTg35YW9qnC2Q8Ol9Z+E4yjT8cppE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=SZgPNF5L; spf=pass (imf17.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681890149; a=rsa-sha256; cv=none; b=G2DeQGWY5u4s+UijFwh+9jcz3ouY76NXkSIdUARBOHgrWssHcGr8bGpgdNVqYt153gQ0kE T7FPl9kT3fuDXSMgABfUdcGeH+jbJoyKKK7jZ9ujHGQ8oe9ZsO2LspVVnmrKsZ5sMR04hA lP6IJ8kN4zrlQKNfg7t0N5AbJemtEU8= 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 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: c7buxw9achrwd4oycfgjgfh5ixzui9uo X-Rspamd-Queue-Id: 2388D4001B X-HE-Tag: 1681890148-89308 X-HE-Meta: U2FsdGVkX19HK1ZAI3LdXwsayeQqU8oSPkhpV0B70vGzy8veEBgeo/9LxnNHb7DTRxsbAw68zojt3hS3Ch3K9IP9tz/GQTM5rTLev2b6Qono+Z1mGfX1MW+Za4jZ1juSuOqXegkBnM0Hcl9fwlg8vJVCnwMAQ9CnT1KBLaqZRnRA5vWHXwDLQ16J9xGCW3eV3XGEq4NKn1zSCHjhXAM3WrRAniaLg6pImyN0cxFfCZTpAHe66gzr8qsKO/MjfdUcbAMNORe0qs+Esb0M1zrCXDRqEkjmgOean4Pi+Zu6wCtpwoVpPZbGnadw0evxiGac5NS8SxJKm2k6mOCkzULBlzcPB8FwqEx7tPrDzCJIs2IUsJcMgTrFWbcMen+2JOsFWn0Q6U5PsfqnAekkjXtV9f0ubOltyXSShQ4dNONnVkPLDXCPHO9GEQ/ugmKuEBh5bWiE/OFwtr0xIUgh5VcMGwr4+2unBOqrR490Dj/y0HUFM/Rej6Xd8IC4cfcHB5SNv4fha5PoGpB7pE5GmUEHIP90EHcBKb7swULDkVc5RGHugSHwJOkGYv0tm6PrPMKqw/87c3Rqv67eu7Wr/i3B+YgBLUt/mqpPn8LIxk3Ul/1NTLstFbu4gAL2eh/w0nV3WZcjo/VG7AXpr0RHCOyIKIgXJsFockSJU65X8Teexs+w5BOQv4akAIgPjld1s5HswFWvoAWeinABzfdyoqvfu2dWM68qsZBaKT0U1Je4yUj6EvMzlQzthEOGoeoX9qUxWcJvfBhtO12Cng5rrWVFes2V6jUInjIbPFCcPfER0kM7154xQY5q5VZ8It/31LFeYmXaGdMRdwJ2p6/VziGfpGfEMfyAnUHQuYiACMxi0ORy0tOuO2Ql1mYKnYuD/cU0szbzAuWCyZUVJFIZ5xtwM8soGrmiXdK29JHG5Fx6KjZigzIBMxfpNIB36PYB/Y9eWzeYB+awWGi8WTbU/Ho JSjPSPMj hHHB4tmA4ppqs9euBKcJnFTW2LmjYK/eTTzL4qB/bMJVfqHyuQ6AmVhD4aQqREjeGFZ6nHDkGRAAcJkKVyN0RXssMJeEk797RpmaOg6PKIGwsCVknvVSw68qCge8T2Khgi4l7/tAEpamHMsKNlnPa84VsGyJaUysOHJ2klWm6DhRHfK+jh+kwkxMPZGqUocExec3t8B7gTwqTPNva0JeQIYkqTg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Sergey Senozhatsky Reviewed-by: John Ogness --- 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