Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1064547pxb; Fri, 13 Nov 2020 03:19:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3KRO8XpMa4VEaVj/vZLSxaD8QEWPBgDDYaMSfFw+NOh/NnquoNSu5K11mw9DzYPE+5dL6 X-Received: by 2002:a50:d78f:: with SMTP id w15mr2041792edi.227.1605266375032; Fri, 13 Nov 2020 03:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605266375; cv=none; d=google.com; s=arc-20160816; b=oIZsUfoVyJcAu9V8S7PqmlvcSYe6Tw6rcxwXvBztn1D8JHUkP4fto5gMTb7jzBlMTa KjsigZr7yyM+gOVyY7+NK0ent8j2cf/zyY50StzExlKYuToxOFH52VoAzjFfodvQQw4r QRqC+zvfYrFb5gfCB2ZoaaxAjLFLLzlTS/N3alYXmZ68l2Qln7zOX4IRFlr/6/ICeSPX 5asxPBg6ZCfHry4ByFzUECqaZ3FbiYcPrOCx8on//6iBfdcJ1LLbbWB1eaAubHVKW0JO 7FK8k0++HHYnxdAMWwjuwrI1gw1PA5L8hHsy88RBToxIgtk2wlIgEZPMuJN2pB8blC8e 6NtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=RY3/ca7GPdRsgGcBAqRzB3f4/EK+fHzH0A/wCtezt7E=; b=QD+tZWD5G62GX5Rj1Gt2CViT3cMQnEezoMeW3cOMmDlOHZQkdRHBcYKRxUu6phJBLM 5zF4L3l1KmtuLXUJoeAPwCKVbpZctVw9kuUsoP3Kckk8RlSoRNAaV3eovDD/5foniy9M ORs46YICiurRle2YzkBRak4cIbJ49IIqXi3C7t2IwsYARQ8AIgRcBRd5/D4IQgYTSnmD aEiPnoCL2g+MMDNPr+wn195/AI80IP49zXbzAA6MvqSNfnhWHbyVe6kEWWgUIrPjhayD WcBpt3S5//OTk4tjoLMq5GdhlPcP4FlCUm3P5aTvuRvnj+8oHC7eY0154Y99QhMvXpB9 Hlxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m8si6203737edj.357.2020.11.13.03.19.11; Fri, 13 Nov 2020 03:19:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbgKMLQl (ORCPT + 99 others); Fri, 13 Nov 2020 06:16:41 -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