From patchwork Sat Sep 2 15:29:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13373125 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 2EF1FC83F3E for ; Sat, 2 Sep 2023 15:30:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A1C88E001A; Sat, 2 Sep 2023 11:30:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 22AAA8D0002; Sat, 2 Sep 2023 11:30:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CCBE8E001A; Sat, 2 Sep 2023 11:30:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EF1A48D0002 for ; Sat, 2 Sep 2023 11:30:01 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BBDEA1602CB for ; Sat, 2 Sep 2023 15:30:01 +0000 (UTC) X-FDA: 81192043002.23.05DE3A0 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by imf29.hostedemail.com (Postfix) with ESMTP id 07F6112001A for ; Sat, 2 Sep 2023 15:29:59 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="rnCG/9We"; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693668600; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=94vGaJ39BVEqwQYt2X0XTeCa7BR+bq/679T/VBpfA0g=; b=KKWSMEE7qagkbP5pgUHPSDuBwpSmSronZrFFI4PmMp7q95mfOLNbzjUAvn/iSvOREM4AEo VGyecWeQ1TnKgGWGd4SrzkbPgHmCmhwof0XulXRn1lGHfRvL5W4d1bw9LYSjy8QwIVqdeq o/gXevlaoajIC2bVdW/+rsor6SiUtWI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693668600; a=rsa-sha256; cv=none; b=ByukNtDGFy7xx1EkENCATCSt9NZKQLyPN933t7nn4BYrjoU3a+jVqUejrZAgwFq9aDDx1M V2TQsnHhAcUB+dVSuM4jFcrcBKD+I5tXgLl+0BYI9rxi1j+ctv7TaXiS1JTQHlu49z7xJq Vuelbm/3b+ssCiUyeuB79L5Xsdh6FmY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="rnCG/9We"; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3ab244ef065so35776b6e.0 for ; Sat, 02 Sep 2023 08:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1693668599; x=1694273399; darn=kvack.org; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=94vGaJ39BVEqwQYt2X0XTeCa7BR+bq/679T/VBpfA0g=; b=rnCG/9WeLsflfJBOilZ3f32tbicYTsjAN1CY0Uqyb2mfITDz+GAABKx1FJIh+1Md9n jvWBXbP0ZvBxsCg/cRRsrXMf3UZWWK3n8/xtsZh9jokjB3phc2OnGTxP7nG23fjWN4A+ 4EBNkI1iLW0W0T9BfkY71SP0a2At4B9v6Q0WiuN9DCl03TnzjvJmLzbElPIrHW1Y1FIj M+RawuR92kkaL373278SXn9gCULB4yhtyVL+EncDe9soaQWguzGMAiIAeGViusWXdMH+ ButFiDhW9U5UksJ7lngHwwuhe5oEQDjR42+hWY7HULGDe7iC/JH2SzDcZ/hxhHJ0DOA3 HHOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693668599; x=1694273399; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=94vGaJ39BVEqwQYt2X0XTeCa7BR+bq/679T/VBpfA0g=; b=GhvaJR6YSgGWjX37fqTZac26af++8cK+cgQTAmgtbcNmjB3ifwXQCI2zwEZC6BdypU t0nL+niJKTP1KpFDCo3YcRNGyZwTe0aVkKc3/NGYnAUh5PCT/+yx7lTMYsxnu7ws6T5+ zsA8nRO22a8zoEhUpMbrYXL6eFWsERnOo3oiJfLmICHJnTdGEcQfAUNXtWLRKyw8hhDJ TjHjGDswFYE3fwAfdOatAYAxurfC2l7a7TMVePHoBBqpWGdp77J9iR/XO68d9oTw6jU2 jq6oxFM86pwb+o/MtHaH8tYjJCiKI9ANVmRWC9bNxPuDrnILqiJQT6Ju8NHttHlONa1C KkHg== X-Gm-Message-State: AOJu0YyyjFiTpDHDh6SBxWY3mEVuKiQrwa3PbnGdksTeJhKnpVvYcHij PNdMESnGBwoNYFMxs1bEBsgpxA== X-Google-Smtp-Source: AGHT+IHA0XTRV8+ro9PdmZKhn1UTJ+8ioIcr8KGiOrHgZfMCqzyTp/BRmG0aV3RaSUgLAN9vhIP00g== X-Received: by 2002:a54:418c:0:b0:3a1:e85f:33c3 with SMTP id 12-20020a54418c000000b003a1e85f33c3mr5821810oiy.50.1693668599087; Sat, 02 Sep 2023 08:29:59 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id t78-20020a25aad4000000b00bcd91bb300esm1448109ybi.54.2023.09.02.08.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:29:58 -0700 (PDT) Date: Sat, 2 Sep 2023 08:29:30 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Linus Torvalds cc: Andrew Morton , Mikhail Gavrilov , Dave Hansen , Bagas Sanjaya , linux-kernel@vger.kernel.org, linux-mm@kvack.org, regressions@lists.linux.dev Subject: [PATCH] mm/pagewalk: fix bootstopping regression from extra pte_unmap() Message-ID: <8321a347-4a38-526c-97fb-5999ceaf6dd@google.com> MIME-Version: 1.0 X-Stat-Signature: yj1pgx7agccyrfgoc97b1ndytmsxhkr7 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 07F6112001A X-Rspam-User: X-HE-Tag: 1693668599-442883 X-HE-Meta: U2FsdGVkX1+0/5ol7KqDt6C1nPzV04trWFoxWCjzsQr/LS4lf3BYUMfF4xZG+YKCLNVNOWiTZF3mtV+0HmXcWBN6GmB4KHCeJijJg3OvljFGDDSuyWKU9a8ZdIP9nbnhcs83pNmhqvEXjhERkyo5nfiDuVVAUku/vEnN3473Dzvah9Kkw4boOstQH/IncPlAz4dpG4Ljfdu5YuBZ4IlwqwoaT0tcmuki0H9IE0O0m4kvbpprVuIjfo11qvPbUQEZdCSUwzuJbkl5G1ufszyPGqxIhr4kWUtoWyEqiZNA5pLLwi6IfDTiSrfy6vqIwTKHBSOtO/ybzVv1oJjmYDqk/8rxRLZIEbJ8IQe/hV2ExezuW0OFflrSJ5kZDcTGRmQnhg8ZLURFxRdVvQW5b6FfXi9XQdvkh4m3NIpVZDqkc8xUV+IgmBB3BjhauGOT8KA56L7O4qyNc04/aICCavsCVFWwZqnVcsPWWlU0GeDxmV0UGUdl1XAI81VAYdxMiA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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: Mikhail reports early-6.6-based Fedora Rawhide not booting: "rcu_preempt detected expedited stalls", minutes wait, and then hung_task splat while kworker trying to synchronize_rcu_expedited(). Nothing logged to disk. He bisected to my 6.6 a349d72fd9ef ("mm/pgtable: add rcu_read_lock() and rcu_read_unlock()s"): but the one to blame is my 6.5 commit to fix the espfix "bad pmd" warnings when booting x86_64 with CONFIG_EFI_PGT_DUMP=y. Gaah, that added an "addr >= TASK_SIZE" check to avoid pte_offset_map(), but failed to add the equivalent check when choosing to pte_unmap(). It's not a problem on 6.5 (for different reasons, it's harmless on both 64-bit and 32-bit), but becomes a bootstopper on 6.6 with the unbalanced rcu_read_unlock() - RCU has a WARN_ON_ONCE for that, but it would have scrolled off Mikhail's console too quickly. Reported-by: Mikhail Gavrilov Closes: https://lore.kernel.org/linux-mm/CABXGCsNi8Tiv5zUPNXr6UJw6qV1VdaBEfGqEAMkkXE3QPvZuAQ@mail.gmail.com/ Fixes: 8b1cb4a2e819 ("mm/pagewalk: fix EFI_PGT_DUMP of espfix area") Fixes: a349d72fd9ef ("mm/pgtable: add rcu_read_lock() and rcu_read_unlock()s") Signed-off-by: Hugh Dickins Tested-by: Mikhail Gavrilov --- mm/pagewalk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 9b2d23fbf4d3..b7d7e4fcfad7 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -58,7 +58,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte = pte_offset_map(pmd, addr); if (pte) { err = walk_pte_range_inner(pte, addr, end, walk); - if (walk->mm != &init_mm) + if (walk->mm != &init_mm && addr < TASK_SIZE) pte_unmap(pte); } } else {