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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 72821C2D0A3 for ; Fri, 6 Nov 2020 18:01:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16295206B6 for ; Fri, 6 Nov 2020 18:01:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BFXZEyu0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbgKFSBT (ORCPT ); Fri, 6 Nov 2020 13:01:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgKFSBS (ORCPT ); Fri, 6 Nov 2020 13:01:18 -0500 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AADE4C0613CF for ; Fri, 6 Nov 2020 10:01:18 -0800 (PST) Received: by mail-qk1-x744.google.com with SMTP id b18so1861166qkc.9 for ; Fri, 06 Nov 2020 10:01:18 -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=q71DOcgxQ/FG+0xRI5ty6ibPA0LopqgeTgo5KPl0sXI=; b=BFXZEyu0IJx/Eo1PAWDnU1E+j+u2xlC+giK0SSSSmSwwyQ7JfBDuPZt5o+4CCPJMnW /hvbt4kvErDT3iza/KDi032qxXMwKG4Nu7cgikuhMa9LoMwcJP6qXYaIG54/rBFRS9uM bXXsDoqRFpKmbwJ83PJL+wwVRVaPJrPyB8qM6IP3w1+HRFyNoaE4LsTfLQpjsnc5kUqG 9uzH2odBeM17XZchQptnC1H7HRXBTkbjJCP/QME4wcYx4VZ5H5wJA648x6NFEKPLVzIV ngJTwswU4MyALzXeuQ++Mp9Vuju3354k2/pfGE/9IHa36EP4nf+bGJ8VEI114kVoRMJj dDSg== 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=q71DOcgxQ/FG+0xRI5ty6ibPA0LopqgeTgo5KPl0sXI=; b=DIGsZgyomp9Hu1W6C4cuZps/y/+a8AEGMeWs9tUc29DaUE7ryCgxntQ9ScRv+czzKk ycCpK0AfriVqPqEDTpAtzmfBcncetQF4f2y0Y0Hz02pPKi3/M4NVjStfjHBgEhZ42DHN RkVONidHS4lNZN9/M/meocOHPGoOxOjPvlGhehVcT9xw8FKrqTowB7/I02qoT65nKBXA P9RcThJ5JBG//pM4JHefCsm2SgHKDAO+l78foJPF49gbSHvqz39qT8n2AFzCPFqoojXD QetYFl5gCcxMWkRAC9Si2hrOz+RVeeEmzUjOWbg5mjKQ/Wz8pMsCHu0dsL3uvSOBojoy C8Zg== X-Gm-Message-State: AOAM533a84u5DMlVKE6PQntwREWmGgdrASStU/HrCPmwqVhjBMXfYy4U Ws+VvIsef1pw1YbQlKhGIkc= X-Google-Smtp-Source: ABdhPJzvM8vj7aDUG+FeZM5sY4sQwhD207HCFkuHpBTU8KLpOk2Rgfvm3t9JJxM9oRVgotbiAHiHlg== X-Received: by 2002:a05:620a:22f5:: with SMTP id p21mr2452964qki.13.1604685677742; Fri, 06 Nov 2020 10:01:17 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id 66sm993396qkd.81.2020.11.06.10.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 10:01:16 -0800 (PST) Date: Fri, 6 Nov 2020 11:01:15 -0700 From: Nathan Chancellor To: Adrian Ratiu Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , clang-built-linux@googlegroups.com, Russell King , linux-kernel@vger.kernel.org, kernel@collabora.com, Ard Biesheuvel Subject: Re: [PATCH 2/2] arm: lib: xor-neon: disable clang vectorization Message-ID: <20201106180115.GB2959494@ubuntu-m3-large-x86> References: <20201106051436.2384842-1-adrian.ratiu@collabora.com> <20201106051436.2384842-3-adrian.ratiu@collabora.com> <20201106101419.GB3811063@ubuntu-m3-large-x86> <87wnyyvh56.fsf@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wnyyvh56.fsf@collabora.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adrian, On Fri, Nov 06, 2020 at 01:50:13PM +0200, Adrian Ratiu wrote: > I tested Arnd's kernel patch from the LLVM bugtracker [1], but with the > Clang v10.0.1 I still get warnings like the following even though the > __restrict workaround seems to affect the generated instructions: > > ./include/asm-generic/xor.h:15:2: remark: the cost-model indicates that > interleaving is not beneficial [-Rpass-missed=loop-vectorize] > ./include/asm-generic/xor.h:11:1: remark: List vectorization was possible > but not beneficial with cost 0 >= 0 [-Rpass-missed=slp-vectorizer] > xor_8regs_2(unsigned long bytes, unsigned long *__restrict p1, unsigned long > *__restrict p2) > > [1] https://bugs.llvm.org/show_bug.cgi?id=40976#c6 Ack, thanks for double checking! > In my opinion we have 3 ways to go regarding this: > > 1. Leave it as is and try to notify the user of the breakage (eg add a new > warning). You previously said this is not a good idea because the user can't > do anything about it. I agree. > > 2. Somehow work around the compiler bug in the kernel which is what the LLVM > bugtracker patch tries to do. This is a slippery slope even if we somehow > get it right, especially since multiple Clang versions might be supported in > the future and we don't know when the bug will be properly fixed by the > compiler. In addition we're enabling and "hiding" possibly undefined > behaviour. > > 3. Disable the broken feature and once the compiler bug is fixed enable it > back warning users of old compilers that there is an action they can take: > upgrade. This is exactly how this was handled for GCC previously, so there > is a precedent. > > This implements the 3'rd scenario which is also the first thing Arnd > suggested in the original patch. :) I agree that number three is definitely the most robust against the future. I know that I periodically grep the tree for "bugs.llvm.org" because we always file something on LLVM's bug tracker when we have to work around something in the kernel. I think this patch is totally fine as is, hopefully we can get it fixed in LLVM sooner rather than later. Cheers, Nathan 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=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 C9E24C388F2 for ; Fri, 6 Nov 2020 18:02:06 +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 25D02206FA for ; Fri, 6 Nov 2020 18:02:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eNu2pIxs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BFXZEyu0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25D02206FA 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=F/oOIUoOl669JmkqJ2IVi3L0ssWLjY1C5Wp7DgbC2eE=; b=eNu2pIxsMZ/dbHeHgrS2LX9aa Hy6MkxgHDvHMQm4boQaJ/Xrehh7xARKmaDHbjjv0JNSdhNYlf/3QpVetXI/hyv4KgiGCwLA+m+0r6 3/bdJkIieAbypYektoamaAxekICUQe/Z3WAbuZ9bkkaFs1QwRpIismWUi4cQo+VCWzEyn6RPzZWew rAj57uNlbXwlMlNp3uQlMj8fj9jbSkshSxACvOTP4YIulaWP/Ohan3FOXvXD4QGOnZA95VRailbXz Perdbf8j6XpHYfG65PS8SIkBElRLuW4QKDpWRFMHRcT8oGh8+L7q+zUpHozZgcyVGTAVFm2SpGO49 UE5oBBZRw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb638-0003J9-O1; Fri, 06 Nov 2020 18:01:22 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb635-0003IU-Fj for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2020 18:01:20 +0000 Received: by mail-qk1-x743.google.com with SMTP id y197so1874212qkb.7 for ; Fri, 06 Nov 2020 10:01:19 -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=q71DOcgxQ/FG+0xRI5ty6ibPA0LopqgeTgo5KPl0sXI=; b=BFXZEyu0IJx/Eo1PAWDnU1E+j+u2xlC+giK0SSSSmSwwyQ7JfBDuPZt5o+4CCPJMnW /hvbt4kvErDT3iza/KDi032qxXMwKG4Nu7cgikuhMa9LoMwcJP6qXYaIG54/rBFRS9uM bXXsDoqRFpKmbwJ83PJL+wwVRVaPJrPyB8qM6IP3w1+HRFyNoaE4LsTfLQpjsnc5kUqG 9uzH2odBeM17XZchQptnC1H7HRXBTkbjJCP/QME4wcYx4VZ5H5wJA648x6NFEKPLVzIV ngJTwswU4MyALzXeuQ++Mp9Vuju3354k2/pfGE/9IHa36EP4nf+bGJ8VEI114kVoRMJj dDSg== 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=q71DOcgxQ/FG+0xRI5ty6ibPA0LopqgeTgo5KPl0sXI=; b=fyoS/T52vtTbIZh2jAQBOFS0uVu5hsyOCoAlNR7woIyhcTm4ToxRbEwJzF2OIxEMxB if9R2OrXBPMBNAZw0+CDOd6VaMTJ6oV4+CMZYaMDswWWi/gFpTKT5rkwq6yDaxQScEce dvurdNX0Sw7y7z1wmKIXH3CeVTz4uL1HuyPwoPOx1cQnz6hTLtSx9LIex5707sdErE8r /M5XA4sqwmdi+8BLhmM1l2hshuJDeWxz+C3dk/vAuJy0vcjuA0MJAkRM5z70mD5FsPv/ 3LSoIj5MimvLm0fWKHG8oIPLYzt2ozNTFFQQW1Rah3zNLQzHuY1f1NkjukNYpfMcEESl 6t5g== X-Gm-Message-State: AOAM531O+kX1FBXwypPdkTv1mL7hos9XYVkCnaeOKD1aumNPu4pijL2H VlqVkvqcj1mRxpCutUvxV3DC1/pvAnLwzw== X-Google-Smtp-Source: ABdhPJzvM8vj7aDUG+FeZM5sY4sQwhD207HCFkuHpBTU8KLpOk2Rgfvm3t9JJxM9oRVgotbiAHiHlg== X-Received: by 2002:a05:620a:22f5:: with SMTP id p21mr2452964qki.13.1604685677742; Fri, 06 Nov 2020 10:01:17 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id 66sm993396qkd.81.2020.11.06.10.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 10:01:16 -0800 (PST) Date: Fri, 6 Nov 2020 11:01:15 -0700 From: Nathan Chancellor To: Adrian Ratiu Subject: Re: [PATCH 2/2] arm: lib: xor-neon: disable clang vectorization Message-ID: <20201106180115.GB2959494@ubuntu-m3-large-x86> References: <20201106051436.2384842-1-adrian.ratiu@collabora.com> <20201106051436.2384842-3-adrian.ratiu@collabora.com> <20201106101419.GB3811063@ubuntu-m3-large-x86> <87wnyyvh56.fsf@collabora.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87wnyyvh56.fsf@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_130119_581556_FD5B2CCE X-CRM114-Status: GOOD ( 25.18 ) 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 Hi Adrian, On Fri, Nov 06, 2020 at 01:50:13PM +0200, Adrian Ratiu wrote: > I tested Arnd's kernel patch from the LLVM bugtracker [1], but with the > Clang v10.0.1 I still get warnings like the following even though the > __restrict workaround seems to affect the generated instructions: > > ./include/asm-generic/xor.h:15:2: remark: the cost-model indicates that > interleaving is not beneficial [-Rpass-missed=loop-vectorize] > ./include/asm-generic/xor.h:11:1: remark: List vectorization was possible > but not beneficial with cost 0 >= 0 [-Rpass-missed=slp-vectorizer] > xor_8regs_2(unsigned long bytes, unsigned long *__restrict p1, unsigned long > *__restrict p2) > > [1] https://bugs.llvm.org/show_bug.cgi?id=40976#c6 Ack, thanks for double checking! > In my opinion we have 3 ways to go regarding this: > > 1. Leave it as is and try to notify the user of the breakage (eg add a new > warning). You previously said this is not a good idea because the user can't > do anything about it. I agree. > > 2. Somehow work around the compiler bug in the kernel which is what the LLVM > bugtracker patch tries to do. This is a slippery slope even if we somehow > get it right, especially since multiple Clang versions might be supported in > the future and we don't know when the bug will be properly fixed by the > compiler. In addition we're enabling and "hiding" possibly undefined > behaviour. > > 3. Disable the broken feature and once the compiler bug is fixed enable it > back warning users of old compilers that there is an action they can take: > upgrade. This is exactly how this was handled for GCC previously, so there > is a precedent. > > This implements the 3'rd scenario which is also the first thing Arnd > suggested in the original patch. :) I agree that number three is definitely the most robust against the future. I know that I periodically grep the tree for "bugs.llvm.org" because we always file something on LLVM's bug tracker when we have to work around something in the kernel. I think this patch is totally fine as is, hopefully we can get it fixed in LLVM sooner rather than later. Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel