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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23545C433EF for ; Tue, 5 Oct 2021 07:18:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E0CD6613B5 for ; Tue, 5 Oct 2021 07:18:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0CD6613B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VaaIbbjuvL0cMWVc6RTfzpxHf45ReLxf2/uMVq4fRo4=; b=3JbDK71WfCXX/s x0lr1bRL8kTE288q6n/dj+DR55muCVir9XvFcp/r+LEUqLFAd7kPKMkOPUkIpVHK0vY4MeW9YIKTD CLHBCEOTPLUU0D52STVkV1CWcvKwXNXKAmCWZ+A6j0nmqEdmaeNLCzIN/uds2p7x7rMtqqHFL7Qwt oGk+j1kxT7shh/xXqRjjWCtxSgCOtN2gunP21BpvOc1keGp3qqNZzvJHs86orvWnYG4nFQb4MAEcJ 7ka7wkI8zV8eDeeno1XC76QtB56/Lb5IyHBCxi0FvZqkOH2ZF4F81MWViyy8XLtFcvMoule/s1VGu OFCcVtV8zelABKlCaPNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXeh0-009IUX-BY; Tue, 05 Oct 2021 07:16:50 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXegQ-009IIz-Dd for linux-arm-kernel@lists.infradead.org; Tue, 05 Oct 2021 07:16:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BB1861507; Tue, 5 Oct 2021 07:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633418174; bh=6w24sjgU0SgiSE1AUBQG2MopN3G6/i+QeWWBcYAOAIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q1EKY8F3OLbHPQGOr7rm+QPzBwN/aa4ZQvyYiRGtcAYNehfDItVnTTJ64CSNZLAux 5QQ1ah74AMJOXhFStfxJGauecCpDH9B7kFYYeCrG3+dTsUR5mhqnpZI4+jZ4zLvUDJ H5pEmVuC5fvFFaKZp16MGml17UCWiJ5NtBBw0J3a8fGwIgs+1W2vf2tVx+gARS9hW+ 5Hh81IgI3t13/ky/kgpkzdXFGLWd1c6BwvtlUE+F6CG0bOo5iS7VA/Nj6QCdKS/mmU +2WMpLC+LvGWGJEmBPR0/5le1KkdOMgQNHep1d30vhbcsAsrafvvDbzkRkuJBpWflt Xa0xgayBTVbdQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij Subject: [PATCH v2 3/9] ARM: optimize indirect call to handle_arch_irq for v7 cores Date: Tue, 5 Oct 2021 09:15:36 +0200 Message-Id: <20211005071542.3127341-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211005071542.3127341-1-ardb@kernel.org> References: <20211005071542.3127341-1-ardb@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211005_001614_503192_67CBE50B X-CRM114-Status: GOOD ( 11.13 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current irq_handler macro uses a literal load followed by an explicit assignment of lr before an indirect call, both of which are sub-optimal on recent ARM cores. Replace it by a mov_l call, which will evaluate to a movw/movt pair on v7 cores, avoiding one of the two loads, followed by a call to a newly introduced 'bl_m' macro, which will evaluate to a blx instruction on cores that support it. (Setting lr explicitly rather than via a bl or blx instruction confuses the return address prediction that modern out-of-order cores use to speculatively perform the function return.) Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/entry-armv.S | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a54b5044d406..21896f702447 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -38,14 +38,12 @@ */ .macro irq_handler #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER - ldr r1, =handle_arch_irq + mov_l r1, handle_arch_irq mov r0, sp - badr lr, 9997f - ldr pc, [r1] + bl_m [r1] #else arch_irq_handler_default #endif -9997: .endm .macro pabt_helper -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel