From patchwork Wed Jan 8 09:04:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13930373 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FE50E77188 for ; Wed, 8 Jan 2025 09:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=llMQUR+wwEgcNFKsWw7SwALRhRZ8Hk9MwBUMNVtb2mw=; b=GwbTP/mxGVPUtGbkz4jXbTO/Ks 37aKpxXIYHHBvo/QjiwcjaG5RDa9x+CXMscEl3OXw9dyRIaEWP8Ue49KXBQLQRwQGQYnYbD9EvNK+ 6xthEMucxy6ejEtsWPxmFd+rm6y/o8mvUeqQAbhKZIk+r9piOOkYZoVGXrxhNCc5+VS9IPrgoPM0J wTC73X186XZLCgQAtZjmYwxk0oQIqZcpGj5yMUYnNPtz2cASjfE+k6ZrkSfSWRULeAGaNl6lJQVPb MhL8H72Kz6ElooEXNO++QnyzRhP9HF3X/FEh98K13Gpx70L4dy0vl4Fo8643vIEWQXn68udDzf82a lKcZuaNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVS1c-00000007g3m-2wUU; Wed, 08 Jan 2025 09:06:52 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVS0Q-00000007fek-1HMS for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Jan 2025 09:05:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=llMQUR+wwEgcNFKsWw7SwALRhRZ8Hk9MwBUMNVtb2mw=; b=AVOJQIbRDTaJWZ1jpeOfNOgGuv lQeYLEnz91kLue9Tz39VE0ezlvDI+lsvUmk3LCYbxLw0CIzxYHS//jhjjqM6unDndDK/SNO8jf/q5 lefr2qvIWhMbfgs6Yc8r9qeq0/nuNUJnAhnnHr817fh/QugbBj7NZKdW7zMU+3JKgt7Nwz+UNBLk8 jCSDgFWpPftpSrJ1+I90VaRD8AqDuzsEvvf4Ye7/Q0rfGFxlWF45e/1abNDJrBpl0/EeUq338UXkf MaxBwKfVhrTd5+ttauewwtFCFkFwV9tnDFBJgq6rjPPgKiU7JGxgIOWBaP44ePx78Oac2qFvST/wy 8AQQC+eA==; Received: from galois.linutronix.de ([193.142.43.55]) by casper.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVS0J-0000000ESa2-2e9Y for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 09:05:37 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736327120; 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=llMQUR+wwEgcNFKsWw7SwALRhRZ8Hk9MwBUMNVtb2mw=; b=aHWOD9UvZeeU8Ir7Qavbls53FEG2Xe8Gv1/qATtpio2CaQM5AhaNUBpylTtnLd4e5z5i3B HP/18AHWf0FN5MToKXBVSURD//SomAAqYKHnzWsfYGFSA58Zbo13m+Dk/Z6yezFdRxTBDG mNoalLKtcvXr6vKRycAQuaJY5FkU29U4phi4/tqu9jgwSc0aYAN2GOopOPUJT6GbBbceaE RL/NRUfSDZtGLNyQUvf3qiE6BGvhaW0wpOE0Xb46rnxRZjtsGbf4V0c2bWQpKZvUjmxR4+ jBZma0KTgNcHf2OSfxJZEBO606z1g588NXeCsjuL9+duzhcrcuZjowT8eas25Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736327120; 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=llMQUR+wwEgcNFKsWw7SwALRhRZ8Hk9MwBUMNVtb2mw=; b=03lSaS47ru0spuAwkaF2+tUNIqOm2UkglqnqHkgXkSl+watQnRd0jZv1xntHJBYnM8rGBe ckU7+LKwwcQXw9CQ== To: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Gomez , Luis Chamberlain , "Paul E . McKenney" , Peter Zijlstra , Petr Pavlu , Sami Tolvanen , Thomas Gleixner , Sebastian Andrzej Siewior , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 16/28] ARM: module: Use RCU in all users of __module_text_address(). Date: Wed, 8 Jan 2025 10:04:45 +0100 Message-ID: <20250108090457.512198-17-bigeasy@linutronix.de> In-Reply-To: <20250108090457.512198-1-bigeasy@linutronix.de> References: <20250108090457.512198-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_090531_957739_46F6B30E X-CRM114-Status: UNSURE ( 9.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_text_address() with RCU. Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Acked-by: Peter Zijlstra (Intel) Signed-off-by: Sebastian Andrzej Siewior --- arch/arm/kernel/module-plts.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c index da2ee8d6ef1a7..354ce16d83cb5 100644 --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c @@ -285,11 +285,9 @@ bool in_module_plt(unsigned long loc) struct module *mod; bool ret; - preempt_disable(); + guard(rcu)(); mod = __module_text_address(loc); ret = mod && (loc - (u32)mod->arch.core.plt_ent < mod->arch.core.plt_count * PLT_ENT_SIZE || loc - (u32)mod->arch.init.plt_ent < mod->arch.init.plt_count * PLT_ENT_SIZE); - preempt_enable(); - return ret; } From patchwork Wed Jan 8 09:04:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13930374 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E588EE77199 for ; Wed, 8 Jan 2025 09:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=luYbbdZNCAXl/IP2EISod9yvpOfM235A0wCO9dfQi8c=; b=zUKnKpdha4WG1AjOyNokeC2AQx 2uk6/Q8ofQmnVCsTujE/gs9DSgRR0Bnf8L7Ou8gpwv3ZugsY/5EirMQXGbTAqNsBAAoCijYNaPREk IC7Zd1b60F0jIunLBc/rYgDUZoPcS4SWmGb+DDYcR+1ZIfZRS1OdDtE7NXJPb6P2a66HBGGJCfTVl 1ra3FpqAOyDXnQJFmSgoHOUh0b371gj0aFYVOU25DlpxfL7NdyH3w04oAl6u1wHLVk+E7qHmJJ8Lt DPQgLMbawaeWemSA/lIdwmSGCAEWmfmoFqSqarD0fiU+sFZpkSYSlKLMDSYr74CAdRvVEfkvH1B2d jdiraYyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVS2n-00000007gTc-1rxx; Wed, 08 Jan 2025 09:08:05 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVS0Q-00000007ff0-2x5I for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Jan 2025 09:05:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=luYbbdZNCAXl/IP2EISod9yvpOfM235A0wCO9dfQi8c=; b=tMvp8CYW0r3s5YEZEfs9ZasSgk Qo57v5YSAzAyRPGQvkcae+e4yhv17k7iWCOma3aC4t0q+gpZI4HC97wIfDJXV4eRSTylEZ2cjlsve 0PQeRQ/8jSrIe38jqt71jtJta0C90AbCSTgGCuPgs3OH8zmjjPf5LedWaO1DMZB60GYYYiO5ybMLM 4J/Lu+GuXtyDpqq6DmQ1OnQw9SGxwDC2oxtg6Uakg0d8TaiSsDtLPjby4oVBi5zot9msbeBZ3vJfZ AoShypkkATg48xMpYCMzWcjUjQeGlY9nl3qwzW0dskPD+QwGsyx9zUTcq4k4E51GBXXprlcWzXdrG aBQXHYNA==; Received: from galois.linutronix.de ([193.142.43.55]) by casper.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVS0J-0000000ESbZ-2uma for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2025 09:05:37 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736327120; 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=luYbbdZNCAXl/IP2EISod9yvpOfM235A0wCO9dfQi8c=; b=qZGqUNiLevk3ULvmOAgodsKpMRTtpdv6zZ5qUtcVO8ZwmriORfqt+BAiiwnzpFb4pj7wGJ qqIrEs42Lod/4DpYI4l0IL434kVxZV3x+XaZ3TbpdcrNBYRR4lP0VEUHk8ZUzgfPd+3/MO a+FI63LXtZjf0rHQ5aK2L0M0T1UZOb4GeqtD3Y5HvX3pJKhuimEoUeA/AhEZjRj0pYyfL5 +amDJ/rpmcycJ3/zeQNMje5n0Xnql5aGiTx6ld96PiO6RPYSW/AGgTbzc8k2h7yTa2mj4E k9ofqTkV3//mwiIDmmTC20MOYsAaVNPdrp5VNOXL6tRR872cXmzwLhnKHPnm7Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736327120; 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=luYbbdZNCAXl/IP2EISod9yvpOfM235A0wCO9dfQi8c=; b=JhnK0Yu4bXTsTOoq/2QpxdG2IUFKpBcbjrCKe3W7xFQhlFCjP6V59gChgnIT16k/VUPy28 I8OAkeg4E0fvk/Cw== To: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Gomez , Luis Chamberlain , "Paul E . McKenney" , Peter Zijlstra , Petr Pavlu , Sami Tolvanen , Thomas Gleixner , Sebastian Andrzej Siewior , Catalin Marinas , Mark Rutland , Masami Hiramatsu , Steven Rostedt , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v3 17/28] arm64: module: Use RCU in all users of __module_text_address(). Date: Wed, 8 Jan 2025 10:04:46 +0100 Message-ID: <20250108090457.512198-18-bigeasy@linutronix.de> In-Reply-To: <20250108090457.512198-1-bigeasy@linutronix.de> References: <20250108090457.512198-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_090532_007385_491454BA X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_text_address() with RCU. Cc: Catalin Marinas Cc: Mark Rutland Cc: Masami Hiramatsu Cc: Steven Rostedt Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linux-trace-kernel@vger.kernel.org Acked-by: Peter Zijlstra (Intel) Signed-off-by: Sebastian Andrzej Siewior --- arch/arm64/kernel/ftrace.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 245cb419ca24d..2b76939b6304f 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -257,14 +257,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, * dealing with an out-of-range condition, we can assume it * is due to a module being loaded far away from the kernel. * - * NOTE: __module_text_address() must be called with preemption - * disabled, but we can rely on ftrace_lock to ensure that 'mod' + * NOTE: __module_text_address() must be called within a RCU read + * section, but we can rely on ftrace_lock to ensure that 'mod' * retains its validity throughout the remainder of this code. */ if (!mod) { - preempt_disable(); + guard(rcu)(); mod = __module_text_address(pc); - preempt_enable(); } if (WARN_ON(!mod))