From mboxrd@z Thu Jan 1 00:00:00 1970 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 76ED8C4345F for ; Mon, 22 Apr 2024 06:39:37 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=UOPfYqY4DlswoPGNf+oVjNrAUVvEBFXTigT0DBmD6zI=; b=BBU9mn8JuVN3Kb YdhMc/YCCefVDkqgDgObFZf2UtHboA6HGTL2JABXRThUzOhLDTYM4M6Y6eBvV56HCksc8Ak7oIsP5 WK7m9WMbl5E5HoqXMRkYr4ECQ3UcuYDi3vr88AQUm9Fbh6udsy+DuZD/Fqt2qs2n4HfLglzpaqsem /1lVC4XhFuQsWNZJvhfc4eZHGbyqss5JLLX1YExSra/vECejF4sM81ZC49WDeFK7nQ+pqpEGsb7qI e3jD3h2x9TUGylZsPcbQSqIgV199hfxhObjcVpxI4kYgLBn2UJhpaCeUa3a7A7vS6tKSOzZGRxCMe G/yG6aKN23sPhdYnisNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rynKm-0000000CGzK-3mDW; Mon, 22 Apr 2024 06:39:24 +0000 Received: from out-178.mta0.migadu.com ([91.218.175.178]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rynKj-0000000CGy1-2qSM for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 06:39:23 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713767953; 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; bh=DFTiIIshBt3nHGS/4A3nNNzLGmWXkp5ut7bbz0K7Lek=; b=xaRojVG7IT4jnM4Vnz7YUbaEUPe5r+mDIGUtMHukl/XaZ4VHG4ehNm8Yg3VsimU7se0ek0 VHPVBoNMot79mURJlOpZ3hEYGKx1UjBRwPa35FTDf5PuLeE+pEE53XHqdCDk7erVT4O+M3 33XbPTDnLBmKHLJ83uX4t/uhK3BBbUE= From: George Guo To: peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH 1/1] arm64: optimize code duplication in arch_static_branch/_jump function Date: Mon, 22 Apr 2024 14:38:53 +0800 Message-Id: <20240422063853.3568733-1-dongtai.guo@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240421_233921_873045_D56751A0 X-CRM114-Status: UNSURE ( 7.07 ) 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: , 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 From: George Guo Extracted the jump table definition code from the arch_static_branch and arch_static_branch_jump functions into a macro JUMP_TABLE_ENTRY to reduce code duplication and improve readability. Signed-off-by: George Guo --- arch/arm64/include/asm/jump_label.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h index 6aafbb789991..69407b70821e 100644 --- a/arch/arm64/include/asm/jump_label.h +++ b/arch/arm64/include/asm/jump_label.h @@ -15,16 +15,19 @@ #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE +#define JUMP_TABLE_ENTRY \ + ".pushsection __jump_table, \"aw\" \n\t" \ + ".align 3 \n\t" \ + ".long 1b - ., %l[l_yes] - . \n\t" \ + ".quad %c0 - . \n\t" \ + ".popsection \n\t" + static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch) { asm goto( "1: nop \n\t" - " .pushsection __jump_table, \"aw\" \n\t" - " .align 3 \n\t" - " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" - " .popsection \n\t" + JUMP_TABLE_ENTRY : : "i"(&((char *)key)[branch]) : : l_yes); return false; @@ -37,11 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke { asm goto( "1: b %l[l_yes] \n\t" - " .pushsection __jump_table, \"aw\" \n\t" - " .align 3 \n\t" - " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" - " .popsection \n\t" + JUMP_TABLE_ENTRY : : "i"(&((char *)key)[branch]) : : l_yes); return false; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel