From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E76C129CA for ; Tue, 14 Dec 2021 12:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96A05C34609 for ; Tue, 14 Dec 2021 12:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639486679; bh=fPLzgAM5zZtvxYbuMSdvyPFHt7Io9bVbB3QgwMTW9qg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Lr56zdM1DlSJ/z8DBEHmYIZk8afgszG9CIi5DU8EIHGEydyBxLyKvUyOm+/AkUV9A aMAwPwFqfeFeOcHWuOQoVlhWhMFGmqxr96B2ntHTaNVZT7mivc807HO79LTx1oOYwe J8DpehzRHoLN4hnwGsKBZgZHUJ1cp1kyy+tQVzaI4jWWpMVyEAh+vDeoKGVwqTLwv4 105VckNOOcYKUAbKGOVHmN2SdnShVQwAmf82FbgOu0PUHRZ8uyh20OCoy3shO6gokY hXTZtmIS1k9fHG+snY4ceC1rF8i2jL9y+mRjnLcRky+/vtIoAKHoQyI6cAa3dm9cN+ j6DrzdUtqhqrw== Received: by mail-oi1-f181.google.com with SMTP id s139so27003659oie.13 for ; Tue, 14 Dec 2021 04:57:59 -0800 (PST) X-Gm-Message-State: AOAM532Lb/2OSGS7bD7/m80++kGcdXdUcUgiCNddiTUoi4c9M2QdjO1r TEryO6Nz/wb7aB0IkVWQBuSy6tLUODnnWue7HAA= X-Google-Smtp-Source: ABdhPJzs5O4ABCAFC/pS+qQWblhbzf6ey4r6qkA99C/F9P/HFftEzrvzbESxd+BvKMj8PHnYU68mNAUZmy7z78cn+ek= X-Received: by 2002:a05:6808:1919:: with SMTP id bf25mr4280185oib.33.1639486678759; Tue, 14 Dec 2021 04:57:58 -0800 (PST) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20211213140252.2856053-1-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 14 Dec 2021 13:57:47 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] arm64/xor: use EOR3 instructions when available To: Catalin Marinas Cc: Nathan Chancellor , Arnd Bergmann , Linux ARM , Will Deacon , Mark Rutland , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" On Tue, 14 Dec 2021 at 12:36, Catalin Marinas wrote: > > On Tue, Dec 14, 2021 at 12:05:34PM +0100, Ard Biesheuvel wrote: > > On Tue, 14 Dec 2021 at 09:19, Ard Biesheuvel wrote: > > > > > > + Arnd > > > > > > On Tue, 14 Dec 2021 at 03:37, Nathan Chancellor wrote: > > > > > > > > Hi Ard, > > > > > > > > On Mon, Dec 13, 2021 at 03:02:52PM +0100, Ard Biesheuvel wrote: > > > > > Use the EOR3 instruction to implement xor_blocks() if the instruction is > > > > > available, which is the case if the CPU implements the SHA-3 extension. > > > > > This is about 20% faster on Apple M1 when using the 5-way version. > > > > > > > > > > Signed-off-by: Ard Biesheuvel > > > > > > > > Our CI reported that this patch as commit ce9ba49a2460 ("arm64/xor: use > > > > EOR3 instructions when available") in the arm64 tree breaks > > > > allyesconfig: > > > > > > > > https://github.com/ClangBuiltLinux/continuous-integration2/runs/4514540083?check_suite_focus=true > > > > > > > > I also see this when building with GCC 11.2.0: > > > > > > > > WARNING: modpost: EXPORT symbol "xor_block_inner_neon" [vmlinux] version ... > > > > Is "xor_block_inner_neon" prototyped in ? > > > > aarch64-linux-gnu-ld: arch/arm64/lib/xor-neon.o: relocation R_AARCH64_ABS32 against `__crc_xor_block_inner_neon' can not be used when making a shared object > > > > > > I suspect this is another genksyms crash, preventing the > > > __crc_xor_block_inner_neon symbol from ever being emitted. > > > > > > This is a recurring annoyance and I am not sure how to address this > > > properly. Arnd might have some thoughts on the matter as well. > > > > I managed to reproduce this: it's not a crash but definitely a bug in > > genksyms, as it simply fails to produce the output containing the > > assignment of __crc_xor_block_inner_neon. > > > > Moving the definition of xor_block_inner_neon as below works around the issue. > > > > Catalin: would you like me to spin a v3? Or do your prefer to just > > fold this into the existing one? > > I'll fold it in. Thanks. > The root cause appears to be that genksyms gives up when it encounters static inline uint64x2_t eor3(uint64x2_t p, uint64x2_t q, uint64x2_t r) { because the types are not defined. This is because our asm/neon-intrinsics.h header avoids #include'ing arm-neon.h in the context of genksyms, as doing so does result in a genksyms crash. I have very little motivation to go and figure out why genksyms crashes in that case, so I think for now, we can stick with the fix I proposed. Alternatively, we could typedef uint64x2_t to something arbitrary if __GENKSYMS__ is defined, or use a macro instead of a static inline for eor3() 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 883B8C433EF for ; Tue, 14 Dec 2021 12:59:39 +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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7OxT4r7q3opD529qpt25Vg50lEk+pFh8BMr63Y3ECTo=; b=JoN80mxEGza6eE JV9pZAYllYLwqB/qKsbGgKgT/MRmiq6B4M2GReAoqkniV6UdXhSEbXyAUZaHTJsUC+tNNnr1BWhsn bhzLxtq83U6K/LxfQsKAACsMVCbwtiQBJow5d4Nh3hXIaBVP/3+yHxZcy+Hzo+uK+f960JL0PvPY/ xToIFNRDF5T8Md2gPAz1+hHQt3NhtGUWFaq2LqKhcPcOHpjJvTV57HFAwHtbmGRxWvaGkDPyv0MFa Yr+UagLVK+9M6KzlBFgECa5ZzKGUy4wjEXQsfsmuufDYMWiWobP05K3YOsLypVr2uKuR8EJOFya5l bdUdNC8mrHZ0ZPpObmGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx7Ng-00E5dr-Il; Tue, 14 Dec 2021 12:58:08 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx7Na-00E5cJ-41 for linux-arm-kernel@lists.infradead.org; Tue, 14 Dec 2021 12:58:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6AB6B817F1 for ; Tue, 14 Dec 2021 12:58:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91CCFC3460A for ; Tue, 14 Dec 2021 12:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639486679; bh=fPLzgAM5zZtvxYbuMSdvyPFHt7Io9bVbB3QgwMTW9qg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Lr56zdM1DlSJ/z8DBEHmYIZk8afgszG9CIi5DU8EIHGEydyBxLyKvUyOm+/AkUV9A aMAwPwFqfeFeOcHWuOQoVlhWhMFGmqxr96B2ntHTaNVZT7mivc807HO79LTx1oOYwe J8DpehzRHoLN4hnwGsKBZgZHUJ1cp1kyy+tQVzaI4jWWpMVyEAh+vDeoKGVwqTLwv4 105VckNOOcYKUAbKGOVHmN2SdnShVQwAmf82FbgOu0PUHRZ8uyh20OCoy3shO6gokY hXTZtmIS1k9fHG+snY4ceC1rF8i2jL9y+mRjnLcRky+/vtIoAKHoQyI6cAa3dm9cN+ j6DrzdUtqhqrw== Received: by mail-oi1-f173.google.com with SMTP id n66so27059440oia.9 for ; Tue, 14 Dec 2021 04:57:59 -0800 (PST) X-Gm-Message-State: AOAM53316EOxJpFEgKMI8tbaEQJZkTV1YnhFoBL4hsj4ZJoWJYcyWjgH 2x+mZT6FkesToYG2zaes9x6tNuTji7Pji0MCJcc= X-Google-Smtp-Source: ABdhPJzs5O4ABCAFC/pS+qQWblhbzf6ey4r6qkA99C/F9P/HFftEzrvzbESxd+BvKMj8PHnYU68mNAUZmy7z78cn+ek= X-Received: by 2002:a05:6808:1919:: with SMTP id bf25mr4280185oib.33.1639486678759; Tue, 14 Dec 2021 04:57:58 -0800 (PST) MIME-Version: 1.0 References: <20211213140252.2856053-1-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 14 Dec 2021 13:57:47 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] arm64/xor: use EOR3 instructions when available To: Catalin Marinas Cc: Nathan Chancellor , Arnd Bergmann , Linux ARM , Will Deacon , Mark Rutland , llvm@lists.linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211214_045802_464060_8675A75E X-CRM114-Status: GOOD ( 32.75 ) 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 On Tue, 14 Dec 2021 at 12:36, Catalin Marinas wrote: > > On Tue, Dec 14, 2021 at 12:05:34PM +0100, Ard Biesheuvel wrote: > > On Tue, 14 Dec 2021 at 09:19, Ard Biesheuvel wrote: > > > > > > + Arnd > > > > > > On Tue, 14 Dec 2021 at 03:37, Nathan Chancellor wrote: > > > > > > > > Hi Ard, > > > > > > > > On Mon, Dec 13, 2021 at 03:02:52PM +0100, Ard Biesheuvel wrote: > > > > > Use the EOR3 instruction to implement xor_blocks() if the instruction is > > > > > available, which is the case if the CPU implements the SHA-3 extension. > > > > > This is about 20% faster on Apple M1 when using the 5-way version. > > > > > > > > > > Signed-off-by: Ard Biesheuvel > > > > > > > > Our CI reported that this patch as commit ce9ba49a2460 ("arm64/xor: use > > > > EOR3 instructions when available") in the arm64 tree breaks > > > > allyesconfig: > > > > > > > > https://github.com/ClangBuiltLinux/continuous-integration2/runs/4514540083?check_suite_focus=true > > > > > > > > I also see this when building with GCC 11.2.0: > > > > > > > > WARNING: modpost: EXPORT symbol "xor_block_inner_neon" [vmlinux] version ... > > > > Is "xor_block_inner_neon" prototyped in ? > > > > aarch64-linux-gnu-ld: arch/arm64/lib/xor-neon.o: relocation R_AARCH64_ABS32 against `__crc_xor_block_inner_neon' can not be used when making a shared object > > > > > > I suspect this is another genksyms crash, preventing the > > > __crc_xor_block_inner_neon symbol from ever being emitted. > > > > > > This is a recurring annoyance and I am not sure how to address this > > > properly. Arnd might have some thoughts on the matter as well. > > > > I managed to reproduce this: it's not a crash but definitely a bug in > > genksyms, as it simply fails to produce the output containing the > > assignment of __crc_xor_block_inner_neon. > > > > Moving the definition of xor_block_inner_neon as below works around the issue. > > > > Catalin: would you like me to spin a v3? Or do your prefer to just > > fold this into the existing one? > > I'll fold it in. Thanks. > The root cause appears to be that genksyms gives up when it encounters static inline uint64x2_t eor3(uint64x2_t p, uint64x2_t q, uint64x2_t r) { because the types are not defined. This is because our asm/neon-intrinsics.h header avoids #include'ing arm-neon.h in the context of genksyms, as doing so does result in a genksyms crash. I have very little motivation to go and figure out why genksyms crashes in that case, so I think for now, we can stick with the fix I proposed. Alternatively, we could typedef uint64x2_t to something arbitrary if __GENKSYMS__ is defined, or use a macro instead of a static inline for eor3() _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel