From patchwork Thu Oct 10 11:33:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13830006 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 3E8A0CF11D0 for ; Thu, 10 Oct 2024 11:57:32 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DsQ2/1OD1833y3AwH5IJOrZR5jmPSoKtfSG79U8bJN4=; b=3UseuiXAyxhmWoy95LB4R6hJae e7Lj9EG7RHXw5FChbm74ksUrs/dgQITi4/cdbRV6f3sgIdMXASZjveZeYnKqtGosNmzSODdZVWZwl idya3ToM+h0RdT3R5UBD2GO6IPlIZJ08LpXaOmMPPmy8t4H79x2MIvwbaznGVACGSyCCULa21QalJ xocZ7mFUA5ygXkgTkSe00OcoBso8iiggzwT1uT/rzvnKRSwsCEgBJ3Y/5Nihh0zcp2rMWpLDMO5Vi Uk+5M1x6/12SR4BM24+CwjT9AceRRP70Mw6o/Zg3zU08+Ppb8NyES+W+7ayZoIU3Z7nrhMcihANY1 +glon8dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syrnF-0000000Ccl5-1FV8; Thu, 10 Oct 2024 11:57:21 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syrQm-0000000CYIB-3hr4 for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 11:34:14 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5c896b9b3e1so1039541a12.2 for ; Thu, 10 Oct 2024 04:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728560047; x=1729164847; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DsQ2/1OD1833y3AwH5IJOrZR5jmPSoKtfSG79U8bJN4=; b=ul8hR04WbnDssMDoYr5TCeXosM1xDT63JLka0bTEzmPAMkDMPXWuiuZJSbU8jN2gLg 8nMAhLc0yj8DoVSR12CuvuOCbB4bjzuwXHeMz1npvymoBCS7FXa80LKxF3Xd9R4zj3sG EEq5KZ24kn/ewKgv7nSHBThCojgX68dnOxiF/D26yp6bxMLq/Ee275EFcZ2L+VAF1cAz Bpz7xhZYHc5mLp2N0PvnjDx/XT0qq7r3kwYeC/bNgDPIwhoEBA+LF0+CTM3bx3zkSpCy SQgCe9536dfMBQhxa3GRetXvjmAFXyrymiVQurVtCEJFGRsx1k9t3wwD5qKw1sh3pHej DMKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728560047; x=1729164847; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DsQ2/1OD1833y3AwH5IJOrZR5jmPSoKtfSG79U8bJN4=; b=oFlGJUL44Vw7n3s5p9VL6TXANmwIC8yLTDeZBO6yS4rnJUfLv+7JjJYOwNsakvtV9l DH5P6Zb4KMPpQO5SVR0UUUvkGJJtqvX8obTvOLBVlBlpXYlnas4szJ/vXa25nxNBo9zE b8GW2PJBSWXc/4NE5WnHu/+e0JC84s1xohcFZqp+HDPlmdmj1nqHlewXTguECoQRUOcq dKeiK6yaJfsKwOZE07kW/v7EUuGAYxjDdHtxes9c6QQ0pdhhqFGJDkqMDASJ81mCwRBv 5Vt5fVKcR4nKYhv4UjAd6/hAul2qVi4kWNDw88dHE+PnADc3sACcQKYkVrqJEcV/PZ03 sZOA== X-Gm-Message-State: AOJu0YwdtwhFsZZuXoO0FLyi/ESIWrCRgKMg60RciHTJSWR9QAhzmNNG FqutuhTNce3TgUpIo+cVbkT0xx4kVC5NAXrTnKAWlbZeTYLz7fKlMgwvDhHJRSA= X-Google-Smtp-Source: AGHT+IFtzNsWgaNiVVEj8OP/CCcRSjW/L9HZNJ/xW1811pDAMg/fQ7GHSKZ1D1WYhG9TkEqfw7s76w== X-Received: by 2002:a17:907:e2d3:b0:a99:52aa:cae9 with SMTP id a640c23a62f3a-a998d1a256bmr530617366b.24.1728560046838; Thu, 10 Oct 2024 04:34:06 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a7f25406sm77619066b.69.2024.10.10.04.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 04:34:06 -0700 (PDT) From: Linus Walleij Date: Thu, 10 Oct 2024 13:33:52 +0200 Subject: [PATCH RFC 14/28] ARM: entry: Drop trace argument from usr_entry macro MIME-Version: 1.0 Message-Id: <20241010-arm-generic-entry-v1-14-b94f451d087b@linaro.org> References: <20241010-arm-generic-entry-v1-0-b94f451d087b@linaro.org> In-Reply-To: <20241010-arm-generic-entry-v1-0-b94f451d087b@linaro.org> To: Oleg Nesterov , Russell King , Kees Cook , Andy Lutomirski , Will Drewry , Frederic Weisbecker , "Paul E. McKenney" , Jinjie Ruan , Arnd Bergmann , Ard Biesheuvel , Al Viro Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_043408_962305_272F76BD X-CRM114-Status: GOOD ( 12.76 ) 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 The trace argument select whether to look into tracing of the hardirqs for the exceptions from userspace, but also selects whether to call further down to establish context for RCU. Split off a second macro that is called on everything except the FIQ since this is the only outlier. Signed-off-by: Linus Walleij --- arch/arm/kernel/entry-armv.S | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index d6e8b36c70f5..be2df297ec0a 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -356,7 +356,7 @@ ENDPROC(__fiq_abt) #error "sizeof(struct pt_regs) must be a multiple of 8" #endif - .macro usr_entry, trace=1, uaccess=1 + .macro usr_entry, uaccess=1 UNWIND(.fnstart ) UNWIND(.cantunwind ) @ don't unwind the user space sub sp, sp, #PT_REGS_SIZE @@ -400,13 +400,14 @@ ENDPROC(__fiq_abt) @ Clear FP to mark the first stack frame @ zero_fp + .endm - .if \trace + /* Called after usr_entry for everything except FIQ */ + .macro usr_entry_enter #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off #endif asm_irqentry_enter_from_user_mode save = 0 - .endif .endm .macro kuser_cmpxchg_check @@ -428,6 +429,7 @@ ENDPROC(__fiq_abt) .align 5 __dabt_usr: usr_entry uaccess=0 + usr_entry_enter kuser_cmpxchg_check mov r2, sp dabt_helper @@ -438,6 +440,7 @@ ENDPROC(__dabt_usr) .align 5 __irq_usr: usr_entry + usr_entry_enter kuser_cmpxchg_check irq_handler from_user=1 get_thread_info tsk @@ -451,6 +454,7 @@ ENDPROC(__irq_usr) .align 5 __und_usr: usr_entry uaccess=0 + usr_entry_enter @ IRQs must be enabled before attempting to read the instruction from @ user space since that could cause a page/translation fault if the @@ -475,6 +479,7 @@ ENDPROC(__und_usr) .align 5 __pabt_usr: usr_entry + usr_entry_enter mov r2, sp @ regs pabt_helper UNWIND(.fnend ) @@ -494,7 +499,7 @@ ENDPROC(ret_from_exception) .align 5 __fiq_usr: - usr_entry trace=0 + usr_entry kuser_cmpxchg_check mov r0, sp @ struct pt_regs *regs bl handle_fiq_as_nmi