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 X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4B78C4742C for ; Fri, 13 Nov 2020 11:16:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9756D207DE for ; Fri, 13 Nov 2020 11:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbgKMLQm (ORCPT ); Fri, 13 Nov 2020 06:16:42 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45420 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbgKMLQK (ORCPT ); Fri, 13 Nov 2020 06:16:10 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: aratiu) with ESMTPSA id 52DAE1F468E4 From: Adrian Ratiu To: Ard Biesheuvel Cc: Linux ARM , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Russell King , Arvind Sankar , kernel@collabora.com, clang-built-linux , Linux Kernel Mailing List Subject: Re: [PATCH v2 2/2] arm: lib: xor-neon: move pragma options to makefile In-Reply-To: References: <20201112212457.2042105-1-adrian.ratiu@collabora.com> <20201112212457.2042105-3-adrian.ratiu@collabora.com> Date: Fri, 13 Nov 2020 13:17:38 +0200 Message-ID: <87k0upjyjx.fsf@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Nov 2020, Ard Biesheuvel wrote: > On Thu, 12 Nov 2020 at 22:23, Adrian Ratiu > wrote: >> >> Using a pragma like GCC optimize is a bad idea because it tags >> all functions with an __attribute__((optimize)) which replaces >> optimization options rather than appending so could result in >> dropping important flags. Not recommended for production use. >> >> Because these options should always be enabled for this file, >> it's better to set them via command line. tree-vectorize is on >> by default in Clang, but it doesn't hurt to make it explicit. >> >> Suggested-by: Arvind Sankar >> Suggested-by: Ard Biesheuvel Signed-off-by: >> Adrian Ratiu --- >> arch/arm/lib/Makefile | 2 +- arch/arm/lib/xor-neon.c | 10 >> ---------- 2 files changed, 1 insertion(+), 11 deletions(-) >> >> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile >> index 6d2ba454f25b..12d31d1a7630 100644 --- >> a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -45,6 >> +45,6 @@ $(obj)/csumpartialcopyuser.o: >> $(obj)/csumpartialcopygeneric.S >> >> ifeq ($(CONFIG_KERNEL_MODE_NEON),y) >> NEON_FLAGS := -march=armv7-a >> -mfloat-abi=softfp -mfpu=neon >> - CFLAGS_xor-neon.o += $(NEON_FLAGS) + >> CFLAGS_xor-neon.o += $(NEON_FLAGS) -ftree-vectorize >> -Wno-unused-variable >> obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o >> endif >> diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c >> index e1e76186ec23..62b493e386c4 100644 --- >> a/arch/arm/lib/xor-neon.c +++ b/arch/arm/lib/xor-neon.c @@ >> -14,16 +14,6 @@ MODULE_LICENSE("GPL"); >> #error You should compile this file with '-march=armv7-a >> -mfloat-abi=softfp -mfpu=neon' #endif >> >> -/* - * Pull in the reference implementations while instructing >> GCC (through - * -ftree-vectorize) to attempt to exploit >> implicit parallelism and emit - * NEON instructions. - */ >> -#ifdef CONFIG_CC_IS_GCC -#pragma GCC optimize "tree-vectorize" >> -#endif - -#pragma GCC diagnostic ignored "-Wunused-variable" >> #include >> >> struct xor_block_template const xor_block_neon_inner = { >> -- 2.29.2 >> > > So what is the status now here? How does putting > -ftree-vectorize on the command line interact with Clang? Clang needs to be fixed separately as -ftree-vectorize does not change anything, the option is enabled by default. I know it sucks to have such a silent failure, but it's always been there (the "upgrade your GCC" warning during Clang builds was bogus) and I do not want to rush a Clang fix without fully understanding it. Warning Clang users that the optimization doesn't work was discussed but dropped because users can't do anything about it. If we are positively certain this is a kernel bug and not a Clang bug (i.e. the xor-neon use case is not enabling/triggering the optimization properly) I could add a TODO comment in the code FWIW. Adrian