From patchwork Thu Oct 10 11:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13830010 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 097CDCF11D5 for ; Thu, 10 Oct 2024 12:00:17 +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=KWToKPY4NC+RvNbtP48N7l0nt4O+1hLmMWZz8WN9xgg=; b=427QfwqDt6N9qVCGZnTLyoEGum 7jZSGPyYfqG9iDtexsNP54DO5SP5olJcqZs2wodkRTRksPTu1AfXHMDe7vh4kWVA1Cixq3FUHfhNs 33CfgZde8zLnSTyBcRQ5M+itUcSXoe9xptwCmA2W13ZbHyk06vFrIXd9+ul6Sm73bUOxNWNraAX2l KtikC+rTe9+pOSiTj1p/cbSzJ5shIqLKMPGkBvgIJaKp5nS0OyGzUT6g2UFgEz2ybcs2MZh3qzEyd F5scFO2bqI5soy/I4aDDCsvJbVc/XgFWbouWfSxDHfVsCK6troGvdiqIQEqR1gtqP5+Cl6tJ3BLnV LNJljjjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syrpq-0000000Cd3d-2QnZ; Thu, 10 Oct 2024 12:00:02 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syrQt-0000000CYLF-2p92 for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 11:34:19 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a99650da839so133344666b.2 for ; Thu, 10 Oct 2024 04:34:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728560054; x=1729164854; 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=KWToKPY4NC+RvNbtP48N7l0nt4O+1hLmMWZz8WN9xgg=; b=nagsQ+K22T/a5F5DByPl51Dqh7HxftF5p7xvxTEIiKTvDOytCcolT7FLArcnDJ6obi 0IOGygai+wUFrTL9xtZYxGrExz5oIWRKV51Fskn3g2UB3UHPSLOshZhYii8Z7sOKtQZb CpCK4SFcIU7SQuetJdxXGYMxAeXCYlG0BeFaGzpTXdRx0+OGsUuJYksDWGhXuilQU25Y +ukSl1ww8Ve7sl/YWe7nOkS0In+8rTqxU+cOuWoDP0+piEw348X1ocrJ2G3WQ541IhNZ VNc2exeePsLPbJZufAORgUptZJT8T1Cl+sYQHnUXyEKD7FYaqrd+DwHiahVLokZef3qe B2Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728560054; x=1729164854; 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=KWToKPY4NC+RvNbtP48N7l0nt4O+1hLmMWZz8WN9xgg=; b=VWaHWDPBiI4UD9NySDB85UxCMFU8Fj9K5sPnGI+XO0VfOfPB0Y3sFFoPpjg7eCDid0 oeYth7GOR/6HhBesDtQzxcfMmwv5jutYyMVt72AgkuRmqllNQHsUKd+TbLCdHepcHVRX zgEsv2KHCwilVXa/qsO0H8oCglUQUKNOWmFL//Ya6wxNDsbmKt8JmXEBgPQrQJ46g+UM cqQR5qycBImlIiDn6wSahYZX8yJWne1r4Jp9TSzN3gfdTYWdUSbUZDtPnGhGJPZ5lwPt AexvyTon5mVlJ4omDyolD2VA9htby7lUxaUfD4qZQ7I/sOAxdZMnKKSrBZTHZ9Ou6yy1 uFTg== X-Gm-Message-State: AOJu0Yy4MzB6TX7j52FgsTyIQ6iNLP5dSo7GhuQGNaXWeIlbZGUf2vyR uGdhDmp0Ws8K5XrejUK+UYoOyBNhG1/258so+vIv82aD+oExmftlSOciC/uuS2g= X-Google-Smtp-Source: AGHT+IFDPzLaonbakRRWJT+0QxQclhlzU2yW7uKOVcDb6pVGDrHLXlnDxsO6QIKMg9pncKslUeaLQA== X-Received: by 2002:a17:907:3fa5:b0:a99:75ba:baa8 with SMTP id a640c23a62f3a-a998d1fa613mr557910666b.31.1728560053677; Thu, 10 Oct 2024 04:34:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 04:34:13 -0700 (PDT) From: Linus Walleij Date: Thu, 10 Oct 2024 13:33:56 +0200 Subject: [PATCH RFC 18/28] ARM: entry: Drop the superfast ret_fast_syscall MIME-Version: 1.0 Message-Id: <20241010-arm-generic-entry-v1-18-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_043415_749753_F48014FC X-CRM114-Status: GOOD ( 14.81 ) 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 When not using any irqflags tracing, context tracking or rseq debugging, the ARM kernel uses a "superfast" ret_fast_syscall with a very few assembly instructions. With generic entry, such local optimizations are not really possible, we need to call C unconditionally and take the (hopefully small) overhead. With generic entry in C, most of the tracing (etc) calls are replaced by stubs and optimized out by the compiler. Signed-off-by: Linus Walleij --- arch/arm/kernel/entry-common.S | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 3559e0a9f5e0..dddbd6ba1eb9 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -30,34 +30,8 @@ saved_pc .req lr .section .entry.text,"ax",%progbits .align 5 -#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING_USER) || \ - IS_ENABLED(CONFIG_DEBUG_RSEQ)) /* - * This is the fast syscall return path. We do as little as possible here, - * such as avoiding writing r0 to the stack. We only use this path if we - * have tracing, context tracking and rseq debug disabled - the overheads - * from those features make this path too inefficient. - */ -ret_fast_syscall: - UNWIND(.fnstart ) - UNWIND(.cantunwind ) - disable_irq_notrace @ disable interrupts - ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing - movs r1, r1, lsl #16 - bne fast_work_pending - - restore_user_regs fast = 0, offset = S_OFF - UNWIND(.fnend ) -ENDPROC(ret_fast_syscall) - - /* Ok, we need to do extra processing, enter the slow path. */ -fast_work_pending: - add sp, sp, #(S_R0 + S_OFF) - /* fall through to work_pending */ -#else -/* - * The "replacement" ret_fast_syscall for when tracing, context tracking, - * or rseq debug is enabled. As we will need to call out to some C functions, + * As we will need to call out to some C functions, * we save r0 first to avoid needing to save registers around each C function * call. */ @@ -75,7 +49,6 @@ ret_fast_syscall: ENDPROC(ret_fast_syscall) /* Slower path - fall through to work_pending */ -#endif tst r1, #_TIF_SYSCALL_WORK beq slow_work_pending