From patchwork Tue Dec 10 16:05:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13901630 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 F1F98E77182 for ; Tue, 10 Dec 2024 16:06:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D1D06B020C; Tue, 10 Dec 2024 11:06:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 582036B020E; Tue, 10 Dec 2024 11:06:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FD1F6B020F; Tue, 10 Dec 2024 11:06:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1FE196B020C for ; Tue, 10 Dec 2024 11:06:50 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 89807C0C24 for ; Tue, 10 Dec 2024 16:06:49 +0000 (UTC) X-FDA: 82879527486.02.CFAEC98 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 1CFE040012 for ; Tue, 10 Dec 2024 16:06:37 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=M1E8oc1U; spf=pass (imf12.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733846791; 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=HwG46zvUnQw2m9oBPSyxLJojvCYh95qCe3Oj2S2XB08=; b=ESIzGGYgN6Zxrs9xR8kk6gNW3qo/tHEnOscDRWxmP2GBAu3ugOwp1UcJYCLvXBmSOEBdjX 5596aZf8Chmtea+4+f7zgwZLD3judlqGyWmQ589i4lpvCU0JoDKfNPV6mrM8yoBb9vhnKN RbpTY4qLl34l1Nff06Q01fKQefrJclc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=M1E8oc1U; spf=pass (imf12.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733846791; a=rsa-sha256; cv=none; b=qaaT1rXtwVBbHEkBeyjkPtDyzcdH2CdlJOyfhJ2aBSj1Arc4Tl+zlXV07YTbdGyLl0309i kVkz5eC7Iu/5eM1bu4cLuXt2jKBGR/1F/O6/7QXoAw8ZUDHo6NabJJ+kOdI1oYfFzVc3Ul LTXp2K/BLAvyz3q008KK1Cb9pnRq9Ck= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2E3725C4B5C; Tue, 10 Dec 2024 16:06:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C9DC4CEE2; Tue, 10 Dec 2024 16:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846806; bh=wxcjY6Sxsaz2hTsZ9OLXJZ3XXXODa/UsYKOkty8coHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1E8oc1U42hpuavRnkbvtANsKDn6k+Yz5tBBqHzq5EK5TUqUHa36DOjdsZtM9/Oah 7Ob9TQmtp+TOGUxnPtTmLmpIqpnNroAzwnwmKUX1z2y5QJwZPjTBumWMwxlbxrJQSL XoGjjYk7/bX9yNbgOjxxo7jOVri9x8edVaTFuojVFYs2+5qimV28MQOYmCOpDoZ2hZ 3WTBquHU2z6SE3hFNLNM85NRZOHnW3qjqYiCxnAFISoWZu2F1V4EvZJlQ1m0lTFihC 7qBKTrXhoKxEhKdX/7Db81ANvpyxEUk+sFfpsf2DdNRV2wLjIJfc+yFATv/VLswlTx xiIo205ZM9XMQ== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt Subject: [PATCH 2/4] ARM: Disable HIGHPTE on PREEMPT_RT kernels Date: Tue, 10 Dec 2024 17:05:54 +0100 Message-Id: <20241210160556.2341497-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1CFE040012 X-Rspamd-Server: rspam12 X-Stat-Signature: g9n8mx9wxd49hasmpsfdjgguptuz97qh X-Rspam-User: X-HE-Tag: 1733846797-59244 X-HE-Meta: U2FsdGVkX197TZq8kY9re7nFa6p7Sd62ejm7IVgQABXnWGMC23prb/hC4sB9MHjJ2Uqe/YPadXF7n3/9C1UcQ6juFSp4hJVT8gwxLIl4ndbHuuxPGTlmmpEDWx9EAyLBV/v7PNyuUGYJyA+KcOemvPP/XjmtOKdqjF7GaorLSxtVcn/Jm0EQOI+Gl+xPiJpCY0RWM/rZhb+LWZUTdsl03uICWEn8iQCjw2wJxps2C1uQTMRu15hotOy9lHyXjt+umAqxK2PVSNf/M6zGHY29XSukeomWuLW1KItbJK5HyXgoNliBUvxjPrK3g0tIiToo77y3twtTlQJog8F9ddk1Aydp6hRARd80BHB4wDY6HdN0gQr51zd2XLmpgS4wIwr8qxNR3PQDV/LSegQq3XHyuWAoQ7k5f2S2xNxAXg3eswjtPr7VdQ3YkH3LACu7zZvhAd+DMmLoXY3/lTD91Y4XtxQ5dkOPdwSWceLKktontHDM5mQCUcmT8AR7rtBxiryIdDMFJiPObVq/2GyTZY3+gOK9dlGPD2dLtCCZHGzg7wrvwGRWxf0vUyWzCzCymKALYHzObVgLucNCGFJvD3d9OtAFt11C3kj2D6D0KzX7hQqqoAvhZ7nK0rHkG6+yixx/GssCQ+W/o5js9qqsCSOFLgbMcWDxzoOvxtFDwp5TF1JPoXtxDz4+UA96fUb7OftV6w6NSEno16C609s6HggAcry0Hn2Vj9p3jrkvO3w3jEDYLT+9CggWVzWGL+FFamEKjIueY4IGCdsfdPycMQj1V2VcqG/mMV09mrjv+TugpyfIQ6299W8yuTVEo1kod0GeexL2oEh+hABbBmHC/BIOKAhXKZcfwiqJGo4l02Ori1ab4Vzg9RhUo6wimaLPpkvM80p7+3764jDMHqI1cHC+fz8EKX0GbPYdCAgSnV0Pt4PO76YfdZdjjARHcLjkj4lMD/x+reV1Fq7uBb467oX cx0LiG3S 8KxCYqc2560C28hjuZkePQDLEBJAy89/gS8wH59dZ/4Yt9Z/CXwSoc3ajvzHo/HYkZzIhiPfmBrzCjBPrIY8ab36HWSmZ3hudSPTx22t9JXWzms4/h6K9kug3VG5CStFlnrQ0E0Q2orbLXynESugjTUjwXfWNtfsmFN3+ogKwvRI4KtI7qrZjyKwJu1t2PWPioVQCfBXyIg1Riog+vo6ibyE0xAgZFCEDUoZIFvfCHdm9z/PlHNVKnK4vJWE7TfGhzCfG 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: List-Subscribe: List-Unsubscribe: From: Sebastian Andrzej Siewior gup_pgd_range() is invoked with disabled interrupts and invokes __kmap_local_page_prot() via pte_offset_map(), gup_p4d_range(). With HIGHPTE enabled, __kmap_local_page_prot() invokes kmap_high_get() which uses a spinlock_t via lock_kmap_any(). This leads to an sleeping-while-atomic error on PREEMPT_RT because spinlock_t becomes a sleeping lock and must not be acquired in atomic context. The loop in map_new_virtual() uses wait_queue_head_t for wake up which also is using a spinlock_t. Since HIGHPTE is rarely needed at all, turn it off for PREEMPT_RT to allow the use of get_user_pages_fast(). [arnd: rework patch to turn off HIGHPTE instead of HAVE_PAST_GUP] Signed-off-by: Sebastian Andrzej Siewior --- There is an open question about whether HIGHPTE is still needed at all, given how rare 32-bit machines with more than 4GB are on any architecture. If we instead decide to remove HIGHPTE altogether, this patch is no longer needed. --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ed850cc0ed3c..4de4e5697bdf 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1231,7 +1231,7 @@ config HIGHMEM config HIGHPTE bool "Allocate 2nd-level pagetables from highmem" if EXPERT - depends on HIGHMEM + depends on HIGHMEM && !PREEMPT_RT default y help The VM uses one page of physical memory for each page table.