From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53ABD1EF085 for ; Tue, 7 Jan 2025 09:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242915; cv=none; b=MXqSC8cOhr9fANaScdbOgSNnWX4WrzBScStbHOZWr86Fx97Mhp3lmxaEFDeb+53OhSqCANeBlv/HB5oOJLfXIh12CCrMhFQ49H/CAqQTV+shPvuswhvuCVtSjIbwp0B2FZeYP7FDC+YDMO+Qrxr3pYU8hXzByDZdjPEL+sjpxYo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242915; c=relaxed/simple; bh=2aSD4Rqiwl4e8YlgSpCe2iMo/CwUTanyqatHAk+INBY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M21/osN5rnxyFdT099GKuHzczkLdwTsHt/DvkVdY3r6Bui3OBg41vp7tBQTOmgYfYuIw+fTwfExYjG13/ydBRQvJ70gci+zFNJdo34fTVIe1MzzyFKl2KsoeFAM5PJPrWtm563q51W9XAbjQsvSMqVm4XYY4AqSjUGYVliuodyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=p1OYclFK; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="p1OYclFK" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5d3e9f60bf4so27460073a12.3 for ; Tue, 07 Jan 2025 01:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736242911; x=1736847711; darn=vger.kernel.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=rNGuHvTHhzfhTH3CopTS+hOuzXjJxItcv+TieblAYlA=; b=p1OYclFKbsc9a5jYpSP6Z8RxlutrmdoZHMjQEJgdlovyk/hSMSfaRfdarVCvjjVRF2 Li3I47kD0auThcPjncga5rm2ULqWwfXNXOobdFBCLi9kclT95ZLnCl5NoUugBr0kkMKI WHvGdJgeX5QcA6tVU2brugORXiCIzYO+TNWI8NWQrJVyHFX28fJ+fPCob+BwBXbpMhK8 6fjT8H0dhXu7Y0gxj4Qh5vNKbs00LcZCQnNU9FW2rGLoDSGZeO+H+4BvwRDSx4hUXY8l EmcY3nRb8/e1SgWkPdzHyvx8v8mypv57UTZIbqpeqj++ihWOowyFOVWXS1hg34tiRfxF l+KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736242911; x=1736847711; 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=rNGuHvTHhzfhTH3CopTS+hOuzXjJxItcv+TieblAYlA=; b=HF2Y/LBUCGGGhrEGX4P7vGdgCFqVBDLZoW8B4lVrtG7x3JD+iCN3FGAYsao7D7+8gJ ICB/DQm219iX5xNOdawhSoqhCsoE8T7Q5XKKIDpuR4FbprTdE2I3TWnE4AEFTnhHvgCw Fk3PquezCvcVrqHlosnAgEby5rsLYF5i76rUhc+RZM+Cq2e4nXZdjwvBVKwH73BWSP7U CsjDh9sd9abaPwLkWncKcgdoPXqjavG+nnrCWwXAzbF2biIwpONYP9uBu3GBiJTkJs6b uOjaBSLHMWG8+ipEPAoTbwHrldfrakulPEClm1j9J+XmokMP2GivJuMwNfuZGnlHdpOF 6hTg== X-Forwarded-Encrypted: i=1; AJvYcCVbjC6gYLXKPlkVNizYBfIVvDozW6dABl7yABahPtHCypzysn/96q5pMBG5MhnlbCeCcmETY6by5YusBa0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyqx59KTqcXHMZSOy+sKSLbz9MF4/Mz6y2iYBD0CfR02UxUYdv8 XhEU40PJ2IOWjPiyf7KqCQ+aiN0z1i31UbYs34wyH+NFhfBh9D+3Z0TpSLiwJXo= X-Gm-Gg: ASbGncuZRADa0jBnbtxAuzXLQ9V41jOdX+bPkI+hVlj5xan1T5baPMrNp/18rU0i5Z4 RLPUZG3QrfQFDkggaMRXnQgF2qXup3uvLBtbmEsrSCjIfDhuZoZDXPm8kkzX+zPdYP/Kk+YX44Q 3w8Kf9gsKP9hrIl17y/UhBm8+b0URaD+On9Xvr0z4DoobJC2/xwvJVZGOkD4ifvsmgE99IHTHTS 1sihzJenhew7ks8DqhQHaLb6R9utwvTRwu0pX+ldLx4MfegADFUdlofvTZgjGRSYV8= X-Google-Smtp-Source: AGHT+IFxRx1Uu23VD6LIatzdS+l1ndVVhhtxHZ732JbaJpgqK/hVhhr7XB86kAmbVwbbNYxk+Vt9bw== X-Received: by 2002:a17:907:7291:b0:aae:e784:55c5 with SMTP id a640c23a62f3a-aaee7846124mr3788329666b.33.1736242910656; Tue, 07 Jan 2025 01:41:50 -0800 (PST) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0f012229sm2356901166b.133.2025.01.07.01.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 01:41:50 -0800 (PST) From: Linus Walleij Date: Tue, 07 Jan 2025 10:41:34 +0100 Subject: [PATCH RFC v3 18/30] ARM: entry: Drop the superfast ret_fast_syscall Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250107-arm-generic-entry-v3-18-4e5f3c15db2d@linaro.org> References: <20250107-arm-generic-entry-v3-0-4e5f3c15db2d@linaro.org> In-Reply-To: <20250107-arm-generic-entry-v3-0-4e5f3c15db2d@linaro.org> To: Dmitry Vyukov , 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.2 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 3559e0a9f5e079f1af91392bf000d39f9b45906c..dddbd6ba1eb9fcbc2c0d81f24e1a9b3231558d7f 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 -- 2.47.1