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 4A6B9CF6D38 for ; Wed, 2 Oct 2024 15:32:07 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y5KqdIVDWiNeK+fu8OnwFeIeZ98oGj0mBpNz2jpaoAU=; b=hk2nLGMKnygTpdlxUmMcgMUOwG TIASes7b+a9bQYP9f6RMZ4q6iSThiBUdLFusi2YdbddK7THC0Yahe3wrRdy0EWxfnyVxujYW/wYx3 0FHqvp36ZTMBxKsbm8m6tlgLkOzthdKl2Fy82H2UAn0h4MsJA2pcd9bz4QYytmv9qAjrSS3PwQ9ig 5Q+UPR5ivUPZpzv8U6IwcYo2IGsHUnl3krOs0CTenzECJfkcgaHR8LIAKY7uDS/PVKIYP6Zo5oc7m af44LGCjy/UFYNOxy1LOSsPNHa9+ooi5kK8vTLtAEQ5yWnsW96b2gb1WKL8J6vBebLWgsUi7mNRAw PdEqpE6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sw1KU-00000006fzM-0Npl; Wed, 02 Oct 2024 15:31:54 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sw1Hx-00000006fJ1-46Yt for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 15:29:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D90065C00B0; Wed, 2 Oct 2024 15:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D63C4CEC2; Wed, 2 Oct 2024 15:29:15 +0000 (UTC) Date: Wed, 2 Oct 2024 16:29:13 +0100 From: Catalin Marinas To: Kristina Martsenko Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Mark Rutland , Robin Murphy , Marc Zyngier Subject: Re: [PATCH 4/5] arm64: lib: Use MOPS for memcpy() routines Message-ID: References: <20240930161051.3777828-1-kristina.martsenko@arm.com> <20240930161051.3777828-5-kristina.martsenko@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240930161051.3777828-5-kristina.martsenko@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_082918_082066_29AFD1DA X-CRM114-Status: GOOD ( 15.12 ) 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 On Mon, Sep 30, 2024 at 05:10:50PM +0100, Kristina Martsenko wrote: > diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S > index 4ab48d49c451..9b99106fb95f 100644 > --- a/arch/arm64/lib/memcpy.S > +++ b/arch/arm64/lib/memcpy.S > @@ -57,7 +57,7 @@ > The loop tail is handled by always copying 64 bytes from the end. > */ > > -SYM_FUNC_START(__pi_memcpy) > +SYM_FUNC_START_LOCAL(__pi_memcpy_generic) > add srcend, src, count > add dstend, dstin, count > cmp count, 128 > @@ -238,7 +238,24 @@ L(copy64_from_start): > stp B_l, B_h, [dstin, 16] > stp C_l, C_h, [dstin] > ret > +SYM_FUNC_END(__pi_memcpy_generic) > + > +#ifdef CONFIG_AS_HAS_MOPS > + .arch_extension mops > +SYM_FUNC_START(__pi_memcpy) > +alternative_if_not ARM64_HAS_MOPS > + b __pi_memcpy_generic > +alternative_else_nop_endif I'm fine with patching the branch but I wonder whether, for the time being, we should use alternative_if instead and the NOP to fall through the default implementation. The hardware in the field doesn't have FEAT_MOPS yet and they may see a slight penalty introduced by the branch, especially for small memcpys. Just guessing, I haven't done any benchmarks. -- Catalin