From patchwork Fri Jun 23 17:12:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13290835 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 AEDCAEB64D7 for ; Fri, 23 Jun 2023 17:12:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 050278D0002; Fri, 23 Jun 2023 13:12:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1C578D0001; Fri, 23 Jun 2023 13:12:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBCD38D0002; Fri, 23 Jun 2023 13:12:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C8FDF8D0001 for ; Fri, 23 Jun 2023 13:12:45 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 86C8C1402DF for ; Fri, 23 Jun 2023 17:12:45 +0000 (UTC) X-FDA: 80934657090.20.D833953 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf21.hostedemail.com (Postfix) with ESMTP id 67A2B1C0018 for ; Fri, 23 Jun 2023 17:12:43 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wUEukFRu; dkim=pass header.d=linutronix.de header.s=2020e header.b=crRCrHYh; spf=pass (imf21.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687540363; 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:in-reply-to:references:references:dkim-signature; bh=d174zlUL/lhF0vBTL/OICvsXlNACFuiYhQ7ttHm3uTo=; b=fT/ZUSDis5QC1rcb4YI5kyU8Jrb7ju+AiMDjWZ8Ty6ho4I26lgpLKaVQLtzKXEc4unqf4E zm+iovUNYMoc+JBsuBlwp33m3GgvU3xHBNFvVhFBqQ7uvObLQmkaicqbbDR2LybS5XWww+ NvUEyLC7zWvJQtR3kFYh22b1KX13jbY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687540363; a=rsa-sha256; cv=none; b=BcNwOxvax9I2Nwf0F6WCTzKtVVsqQfG3WQeAVHEvFTBC4k74T9p1Hw/Jum7EzPmkFzbX+l +gaByPdKqbrtJK9/n/Cr9MvQKDrYXGSYAXGsuwqPTeWCoAqbNCObKEwg0X2UVw97Ytl6tg Czd8dw+L7LoXib/D7JzFPtYp6XUycJ8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wUEukFRu; dkim=pass header.d=linutronix.de header.s=2020e header.b=crRCrHYh; spf=pass (imf21.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687540361; 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=d174zlUL/lhF0vBTL/OICvsXlNACFuiYhQ7ttHm3uTo=; b=wUEukFRuQtWtID4ZOeOhNXoXQ773U6bquwTxJC7s8rOqzIlrm+gZSF7ZYmg1UhYmzJz4qm oD5Ysr/0zLXb9jT8ovdKF0Bpnlu+ruuv5VQLGVR9IpQu1tCXNMfKYOdKKjWpQ6kyj38jjk A3H8UVBPOl/2QXtQf3GaYd928rVYkoeof+erMEKQc7QMrkdtrWBK1pJnKT5YTlzAhx4C64 eK4rIHSgqMfZyHITIAvcGigQjrydcs2bQNIuo3JhRnlq9qSlzz3y5lPmbLHw+cWmTyNiTQ YRAqhj5dYBPvaNyVjqV0onfE/WhUArwF1Be/lz2+WhLL5yHn/M6an9SWQOwFHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687540361; 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=d174zlUL/lhF0vBTL/OICvsXlNACFuiYhQ7ttHm3uTo=; b=crRCrHYhVULMoIjeuCQU0yIWeH3xxFHKwaD5PsqTuAc+qRz2en09xW9R2TKMpVhjpwL/DE JSx8UERIkzfTFABA== To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Luis Claudio R. Goncalves" , Andrew Morton , Boqun Feng , Ingo Molnar , John Ogness , Mel Gorman , Michal Hocko , Peter Zijlstra , Petr Mladek , Tetsuo Handa , Thomas Gleixner , Waiman Long , Will Deacon , Sebastian Andrzej Siewior , Tetsuo Handa Subject: [PATCH v2 1/2] seqlock: Do the lockdep annotation before locking in do_write_seqcount_begin_nested() Date: Fri, 23 Jun 2023 19:12:31 +0200 Message-Id: <20230623171232.892937-2-bigeasy@linutronix.de> In-Reply-To: <20230623171232.892937-1-bigeasy@linutronix.de> References: <20230623171232.892937-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 67A2B1C0018 X-Rspam-User: X-Stat-Signature: e8jd6ud1z7jipqxh7yn9pfdgzrcnaegn X-R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Qxy9zbeVYVVumcgE44eGxd1F24Wp8K2GmUSPZEIZyGbdQCTAvu68da+a7ap10CAMxZGhl5VbJc1i+9V92uP8U3HWSxwu+CBaRVLyY+H1PuMTCGfBwRtC8q13+A/tM/f0/0nNFNiRfvWMzwGdHRy+Ss5qzq9JwLVG6+X5eBl1teTldCf8Usciq2nDfm4ASpm2r51lzaUh3i+92nvbpMP4oDfuCyE= 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: It was brought up by Tetsuo that the following sequence write_seqlock_irqsave() printk_deferred_enter() could lead to a deadlock if the lockdep annotation within write_seqlock_irqsave() triggers. The problem is that the sequence counter is incremented before the lockdep annotation is performed. The lockdep splat would then attempt to invoke printk() but the reader side, of the same seqcount, could have a tty_port::lock acquired waiting for the sequence number to become even again. The other lockdep annotations come before the actual locking because "we want to see the locking error before it happens". There is no reason why seqcount should be different here. Do the lockdep annotation first then perform the locking operation (the sequence increment). Fixes: 1ca7d67cf5d5a ("seqcount: Add lockdep functionality to seqcount/seqlock structures") Reported-by: Tetsuo Handa Link: https://lore.kernel.org/20230621130641.-5iueY1I@linutronix.de Signed-off-by: Sebastian Andrzej Siewior Acked-by: Mel Gorman --- include/linux/seqlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 3926e90279477..d778af83c8f36 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -512,8 +512,8 @@ do { \ static inline void do_write_seqcount_begin_nested(seqcount_t *s, int subclass) { - do_raw_write_seqcount_begin(s); seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_); + do_raw_write_seqcount_begin(s); } /** From patchwork Fri Jun 23 17:12:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13290836 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 AC8F6EB64DD for ; Fri, 23 Jun 2023 17:12:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5F768D0005; Fri, 23 Jun 2023 13:12:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC1A08D0003; Fri, 23 Jun 2023 13:12:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A617E8D0005; Fri, 23 Jun 2023 13:12:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8F63A8D0001 for ; Fri, 23 Jun 2023 13:12:46 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 90F2BC0C7C for ; Fri, 23 Jun 2023 17:12:45 +0000 (UTC) X-FDA: 80934657090.19.CE78BBC Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 9CF0940023 for ; Fri, 23 Jun 2023 17:12:43 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="UooxLz/z"; dkim=pass header.d=linutronix.de header.s=2020e header.b=8kTgNXsU; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf11.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687540363; 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:in-reply-to:references:references:dkim-signature; bh=BMld1PknhyoTTWqIQWTi/haDnPaStkrULY18977v1W8=; b=MnCDO86u/bcGDsBZ9Js3Ik3UNB+vd9lcr4VzJYzPXEBQXrNv2M3RP1wpCun8IK0IrIFqiT MbjAGK0ynbjzXbH5UCvjEotOBedbs/haJnnOpArxVMt+ZmLnSpMyiQC9pUeWHysh7ZBE23 x6QJ75Zbr2zW7zFKMg87hKhMTW2E4jI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="UooxLz/z"; dkim=pass header.d=linutronix.de header.s=2020e header.b=8kTgNXsU; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf11.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687540363; a=rsa-sha256; cv=none; b=fv/+ERP07sA3v2c7ELIzLypUzk3K0QcKv/9asDvKY9vj1wGe28NfqYmNM+5+KVM0/WOrOi fOI9pABGVO0/g/RykniFHNMrKylw3xw5JXI7uNBZaylp25izeelGkT2TIkkIHxnQgjQKNn eF+KHTy9CrWbXssWS8ovMLf90rDttQI= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687540361; 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=BMld1PknhyoTTWqIQWTi/haDnPaStkrULY18977v1W8=; b=UooxLz/zkoWhq+XAmNcit5ZQDI4n/Y+KVronARo5RtTZ+Tn6qjAbf+SOx/FC241sDV8f4t t8HJpjsAu06tlvLNMcBnutuGtTbknm/McJdfqacY7/9mKIMPXaChuyDfV91Lysn8JRgd04 FEajI9b521OGBvRhaLW4XirU9DI8WhB8c6njc7IoxIwm2p33Jxy1cOxv66rkXxgB5Chru+ A/FRmn+Hy1gok2d3NWwOZ5rM/Dtjk9URSGAuXs6LWjFMo+DbMSueXkd5UnHH+D8fM0FIeG T9YGtSeiToHljMH9F6NvMNkhsbUtBC+W2HnzhVsbBO2nnoCWRzHlsR620hmdWQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687540361; 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=BMld1PknhyoTTWqIQWTi/haDnPaStkrULY18977v1W8=; b=8kTgNXsUUa80s7tfPsheHF9UbSnMTZUFyjFjS52xpo0dV5r9dRvc1KbatV5CicN60n6keS OX2i42K9YrjV0vBg== To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Luis Claudio R. Goncalves" , Andrew Morton , Boqun Feng , Ingo Molnar , John Ogness , Mel Gorman , Michal Hocko , Peter Zijlstra , Petr Mladek , Tetsuo Handa , Thomas Gleixner , Waiman Long , Will Deacon , Sebastian Andrzej Siewior Subject: [PATCH v2 2/2] mm/page_alloc: Use write_seqlock_irqsave() instead write_seqlock() + local_irq_save(). Date: Fri, 23 Jun 2023 19:12:32 +0200 Message-Id: <20230623171232.892937-3-bigeasy@linutronix.de> In-Reply-To: <20230623171232.892937-1-bigeasy@linutronix.de> References: <20230623171232.892937-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9CF0940023 X-Stat-Signature: fyoi7m65r37aqeegb7stz6dp9fzuxs3k X-HE-Tag: 1687540363-746042 X-HE-Meta: U2FsdGVkX1/+k+j22P/hzJQ66deN5dYFD+ko4j9mwUY6AcLU+IwEyBqKMB/Xjz0ov2iHYC5amJV74omum8PhL8fhowk6jJ4FPzybD9ac8bsA/issEmmxXB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hJpq8O4= 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: __build_all_zonelists() acquires zonelist_update_seq by first disabling interrupts via local_irq_save() and then acquiring the seqlock with write_seqlock(). This is troublesome and leads to problems on PREEMPT_RT. The problem is that the inner spinlock_t becomes a sleeping lock on PREEMPT_RT and must not be acquired with disabled interrupts. The API provides write_seqlock_irqsave() which does the right thing in one step. printk_deferred_enter() has to be invoked in non-migrate-able context to ensure that deferred printing is enabled and disabled on the same CPU. This is the case after zonelist_update_seq has been acquired. There was discussion on the first submission that the order should be: local_irq_disable(); printk_deferred_enter(); write_seqlock(); to avoid pitfalls like having an unaccounted printk() coming from write_seqlock_irqsave() before printk_deferred_enter() is invoked. The only origin of such a printk() can be a lockdep splat because the lockdep annotation happens after the sequence count is incremented. This is exceptional and subject to change. It was also pointed that PREEMPT_RT can be affected by the printk problem since its write_seqlock_irqsave() does not really disable interrupts. This isn't the case because PREEMPT_RT's printk implementation differs from the mainline implementation in two important aspects: - Printing happens in a dedicated threads and not at during the invocation of printk(). - In emergency cases where synchronous printing is used, a different driver is used which does not use tty_port::lock. Acquire zonelist_update_seq with write_seqlock_irqsave() and then defer printk output. Fixes: 1007843a91909 ("mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock") Signed-off-by: Sebastian Andrzej Siewior Acked-by: Michal Hocko --- mm/page_alloc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 47421bedc12b7..99b7e7d09c5c0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5808,11 +5808,10 @@ static void __build_all_zonelists(void *data) unsigned long flags; /* - * Explicitly disable this CPU's interrupts before taking seqlock - * to prevent any IRQ handler from calling into the page allocator - * (e.g. GFP_ATOMIC) that could hit zonelist_iter_begin and livelock. + * The zonelist_update_seq must be acquired with irqsave because the + * reader can be invoked from IRQ with GFP_ATOMIC. */ - local_irq_save(flags); + write_seqlock_irqsave(&zonelist_update_seq, flags); /* * Explicitly disable this CPU's synchronous printk() before taking * seqlock to prevent any printk() from trying to hold port->lock, for @@ -5820,7 +5819,6 @@ static void __build_all_zonelists(void *data) * calling kmalloc(GFP_ATOMIC | __GFP_NOWARN) with port->lock held. */ printk_deferred_enter(); - write_seqlock(&zonelist_update_seq); #ifdef CONFIG_NUMA memset(node_load, 0, sizeof(node_load)); @@ -5857,9 +5855,8 @@ static void __build_all_zonelists(void *data) #endif } - write_sequnlock(&zonelist_update_seq); printk_deferred_exit(); - local_irq_restore(flags); + write_sequnlock_irqrestore(&zonelist_update_seq, flags); } static noinline void __init