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=-14.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 AB191C2D0A3 for ; Fri, 6 Nov 2020 10:14:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24C48206CB for ; Fri, 6 Nov 2020 10:14:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WqaHsl+M"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EI/iO/20" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24C48206CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4StkR5sdd1WPgqSgM8kML50aJwJBi4gB6mA5xB1JgaU=; b=WqaHsl+MIR9nqTnSd3bbtqYRk /KIvABngVSDYm6ovqjYytPK2U2ESECF8skcAHffR2qL978JS+DUVZ8XKuwClvM1YIkra0Cm7Nbiq2 gY/ZiJALQtQ2UxeAIKk+kAbZ1M2LYTVMaXMP60dvCAXy4uZV+jXnApVIqkkdtNCmuOwTZLal+UcvA hWrpRp7DBZTVlE3CKvnriwdnLkZlrwDp7wdAWpQ2LbW0Fy5uCDsD8N9IsNdlcrDJhVcLKkcd7Ca++ FJWCgg0Ic+Zt1eRBdeS8qcbi2PL88KEH3MQeVzAq23/v87S1WZEfS6dd7Mrsz3PQLnxfglRRW3R/l eWOdeB7nw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaylH-0007GR-6u; Fri, 06 Nov 2020 10:14:27 +0000 Received: from mail-il1-x144.google.com ([2607:f8b0:4864:20::144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaylD-0007FN-JP for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2020 10:14:24 +0000 Received: by mail-il1-x144.google.com with SMTP id p2so621830ilg.1 for ; Fri, 06 Nov 2020 02:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iOjO/+SmXIjhhMmb/arLW6PNxmPECHhSo5uEUFHznhs=; b=EI/iO/205kjlnCe4kyJsvbZU2XLrtFbwebhRxt8IpJrlEKATzuUDcd5FWbCRjd0QPf +GboFAJoE/TUFKOaqNozcWX0BAxQDzZfb661OOIp0nbZ+qZ6HKk4P9nQolwCZ8PxStjY ZUmQFTH15NJbCjZp8sRPIDimWLKW0JrLsvgJEI9tV/WDGrjkOvtHbu0Tqh2ebX13vQhp 4uoUCjyT4UmG7KMwZoD/ShUVnccerjsUKIGjkXa5vt557+zYUakE7Qvaa76xc4COAyzU lczit1FAuK2gP8JK8cwUUAc/rnQQbWYRvJInNBYB446LJsHLk/B/oKhLiXB/2r04Sujl xGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iOjO/+SmXIjhhMmb/arLW6PNxmPECHhSo5uEUFHznhs=; b=CYreSbIM1+lxuNHbkfOBhM74CzYZ8WuasY8PX0nV2OwDR5s0gYnPVf8fqPltpakRxv 2hNKCirQwobza2E+I2dASIPfoZK2wZgveHY9YS9i4e/QCmG0JL0iALU+IqYjWlcnIile DMUSeieoIf+gL6oNZRJ99AX8XnBjpEKz3va1VRtTsxqFNc3AWqu0JStUTdBt7/4Cmrbh CmhhZRbK13IERkefWm9DtEpYPITP0Ymc/o1ZVAMs6qWkOXZEbnXv6k60q1OBg54835HG d0dQpW7+1sPiz/MtkhRSVSKa3+HX4zqx6Bxx86JCPeFYlg9qGrqJ+HOM6InM30SpjnP/ 8o8Q== X-Gm-Message-State: AOAM530x1FiH9fnwjnDJ4CO9WQP5IFkssLI6ubYCFE49tF1kcm4+f/ab u44C54Ac+W9nDyBBJdMtJKs= X-Google-Smtp-Source: ABdhPJy+aMsmwQ5T6MGifDqDt3Bg1N13Nz0Mj0a+bv9L9zFp6mnExd1W67qYEsmMTSxasMIMj3lt/Q== X-Received: by 2002:a92:d449:: with SMTP id r9mr809204ilm.276.1604657661703; Fri, 06 Nov 2020 02:14:21 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id r16sm557880ioc.45.2020.11.06.02.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 02:14:20 -0800 (PST) Date: Fri, 6 Nov 2020 03:14:19 -0700 From: Nathan Chancellor To: Adrian Ratiu Subject: Re: [PATCH 2/2] arm: lib: xor-neon: disable clang vectorization Message-ID: <20201106101419.GB3811063@ubuntu-m3-large-x86> References: <20201106051436.2384842-1-adrian.ratiu@collabora.com> <20201106051436.2384842-3-adrian.ratiu@collabora.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201106051436.2384842-3-adrian.ratiu@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_051423_701976_F53DC8F8 X-CRM114-Status: GOOD ( 31.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Nick Desaulniers , linux-kernel@vger.kernel.org, Russell King , clang-built-linux@googlegroups.com, kernel@collabora.com, Ard Biesheuvel , linux-arm-kernel@lists.infradead.org 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 + Ard, who wrote this code. On Fri, Nov 06, 2020 at 07:14:36AM +0200, Adrian Ratiu wrote: > Due to a Clang bug [1] neon autoloop vectorization does not happen or > happens badly with no gains and considering previous GCC experiences > which generated unoptimized code which was worse than the default asm > implementation, it is safer to default clang builds to the known good > generic implementation. > > The kernel currently supports a minimum Clang version of v10.0.1, see > commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1"). > > When the bug gets eventually fixed, this commit could be reverted or, > if the minimum clang version bump takes a long time, a warning could > be added for users to upgrade their compilers like was done for GCC. > > [1] https://bugs.llvm.org/show_bug.cgi?id=40976 > > Signed-off-by: Adrian Ratiu Thank you for the patch! We are also tracking this here: https://github.com/ClangBuiltLinux/linux/issues/496 It was on my TODO to revist getting the warning eliminated, which likely would have involved a patch like this as well. I am curious if it is worth revisting or dusting off Arnd's patch in the LLVM bug tracker first. I have not tried it personally. If that is not a worthwhile option, I am fine with this for now. It would be nice to try and get a fix pinned down on the LLVM side at some point but alas, finite amount of resources and people :( Should no other options come to fruition from further discussions, you can carry my tag forward: Acked-by: Nathan Chancellor Hopefully others can comment soon. > --- > arch/arm/include/asm/xor.h | 3 ++- > arch/arm/lib/Makefile | 3 +++ > arch/arm/lib/xor-neon.c | 4 ++++ > 3 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/xor.h b/arch/arm/include/asm/xor.h > index aefddec79286..49937dafaa71 100644 > --- a/arch/arm/include/asm/xor.h > +++ b/arch/arm/include/asm/xor.h > @@ -141,7 +141,8 @@ static struct xor_block_template xor_block_arm4regs = { > NEON_TEMPLATES; \ > } while (0) > > -#ifdef CONFIG_KERNEL_MODE_NEON > +/* disabled on clang/arm due to https://bugs.llvm.org/show_bug.cgi?id=40976 */ > +#if defined(CONFIG_KERNEL_MODE_NEON) && !defined(CONFIG_CC_IS_CLANG) > > extern struct xor_block_template const xor_block_neon_inner; > > diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile > index 6d2ba454f25b..53f9e7dd9714 100644 > --- a/arch/arm/lib/Makefile > +++ b/arch/arm/lib/Makefile > @@ -43,8 +43,11 @@ endif > $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S > $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S > > +# disabled on clang/arm due to https://bugs.llvm.org/show_bug.cgi?id=40976 > +ifndef CONFIG_CC_IS_CLANG > ifeq ($(CONFIG_KERNEL_MODE_NEON),y) > NEON_FLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon > CFLAGS_xor-neon.o += $(NEON_FLAGS) > obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o > endif > +endif > diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c > index e1e76186ec23..84c91c48dfa2 100644 > --- a/arch/arm/lib/xor-neon.c > +++ b/arch/arm/lib/xor-neon.c > @@ -18,6 +18,10 @@ MODULE_LICENSE("GPL"); > * Pull in the reference implementations while instructing GCC (through > * -ftree-vectorize) to attempt to exploit implicit parallelism and emit > * NEON instructions. > + > + * On Clang the loop vectorizer is enabled by default, but due to a bug > + * (https://bugs.llvm.org/show_bug.cgi?id=40976) vectorization is broke > + * so xor-neon is disabled in favor of the default reg implementations. > */ > #ifdef CONFIG_CC_IS_GCC > #pragma GCC optimize "tree-vectorize" > -- > 2.29.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel