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=-0.7 required=3.0 tests=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 C06F5C433E0 for ; Wed, 27 May 2020 09:27:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2B8820890 for ; Wed, 27 May 2020 09:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbgE0J1M (ORCPT ); Wed, 27 May 2020 05:27:12 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:45301 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbgE0J1L (ORCPT ); Wed, 27 May 2020 05:27:11 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1M58vU-1jcmPR1REy-001DGZ for ; Wed, 27 May 2020 11:27:09 +0200 Received: by mail-qk1-f169.google.com with SMTP id c185so9553227qke.7 for ; Wed, 27 May 2020 02:27:09 -0700 (PDT) X-Gm-Message-State: AOAM533EaXypvXV/RPIxrCu71t0DINIG6KNdkkKK9RWB+1dvKDp4i7n9 pwU58BFWPJmmVxPFZ092O4sPGuW4TogAL7UQ5Cw= X-Google-Smtp-Source: ABdhPJzkT5QDMDvcQ6ejl8sl6wd/LQhNAfsVk7IEt0pH2byVzyEGYVLDvQPCW4598CVgxFHaFoVEUY9oABgjhh3Wl9s= X-Received: by 2002:ae9:c10d:: with SMTP id z13mr2828308qki.3.1590571628188; Wed, 27 May 2020 02:27:08 -0700 (PDT) MIME-Version: 1.0 References: <20200521142047.169334-1-elver@google.com> <20200521142047.169334-10-elver@google.com> <20200526120245.GB27166@willie-the-truck> <20200526173312.GA30240@google.com> <20200527072248.GA9887@willie-the-truck> In-Reply-To: From: Arnd Bergmann Date: Wed, 27 May 2020 11:26:51 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH -tip v3 09/11] data_race: Avoid nested statement expression To: Marco Elver Cc: Will Deacon , Nick Desaulniers , "Paul E. McKenney" , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , kasan-dev , LKML , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , clang-built-linux , Borislav Petkov , Stephen Rothwell Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:/I6/dQJLsm12Wrx747jKQ/XV7txwet5pFgidFgA1eiBkWeCl8gr WAutPPBp4SiXlVyj8HfUjJ+wkQACVQcKIc8wO9vmaLcZlkEbFJb40+eBJvRdwnNSw4zO666 uJax3GKkUWuD76UVoy9ye21BTrhAn2e1bf4MMF/eD8aL1qhbOL4CnCWCGh/gh5ZXzWebyRd WErOCvN/ufEuejrIxX5UA== X-UI-Out-Filterresults: notjunk:1;V03:K0:mRc7YvyaHpc=:zTEU4UgBfMQGw6t7xc7v4m g6d5VelbOf6WllApzNQxWHNI/dwmMM7RvvIHIjmqIRn0gPAi/2fqXUuyAzIIT0LJrknR6wrih KAJo7EUcK0VyXTlvQjp4sP8YPLGCOpbm0bEdBb2oi64ht5bWuN8KP7k0ml4xmhiAQ+YwSAxJo 4DAgSe1big6AU7rrsIEPpBUTPj5Rye2RFAT5ecxpLBqhpedeiHmNZIQjyA+jJyVmj/AKfiYzD bYtaSfRQWnUT/V7VcBTz1A737/w1cs8hGtssIeMdhbXNfZbCVwks/XAYDVW8AIkfITEeX5tKH 1JTlMtQfZyXr2ak3WnJQG5gr+eRahHk+8wQeFuWJno5nPa1JrGL80+AVnjMFEVr1zEZzqE9fk Mj3TIs+I4JQ211dgYwPT2m5miwWPVgbWgpDLJXPIqMWRMokOJUfMjhWh9/1YQPODCBaxXps2j OAwSW/cSEy9MGd9NyInBBYggaZU5A30lWuGYIx4qGP6DfmrfHZjtAkceglthpRjtwLPRyFNiP I0/T/rNsNI6dQGalZ+8XBXuAhgnQWprMog/Qo+AqYJgYFu+HnpGGnoZwrziA4WXTrj6uTF1DJ By/6Q+8EoBH9sPdmQHWd8Ymaq5ORKBarOmqwt+T+txkJtNd3UGDxM0Sd4zjxICTqGw32D2qpZ 8x70qvOxFD3DJQFSXqVOZAYiACpFnq4lVSwYuvRKxoyDKnm2EKhQZW+VKXbt3/nEwjvTLMO2g AfOvZ27SRvl5l47UHJgsFmVtmHZozNrCyp3HmM6hOX/DsQrwHw/4tRSwhysyamtPLJUJHtBJO LR8l1x/7RtQS+9pai5BasFcxPo9fS4x3ulavmy7SMVqc5ADuTM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 9:44 AM 'Marco Elver' via Clang Built Linux wrote: > On Wed, 27 May 2020 at 09:22, Will Deacon wrote: > > > > Nice! FWIW, I'm planning to have Alpha override __READ_ONCE_SCALAR() > > eventually, so that smp_read_barrier_depends() can disappear forever. I > > just bit off more than I can chew for 5.8 :( > > > > However, '__unqual_scalar_typeof()' is still useful for > > load-acquire/store-release on arm64, so we still need a better solution to > > the build-time regression imo. I'm not fond of picking random C11 features > > to accomplish that, but I also don't have any better ideas... > > We already use _Static_assert in the kernel, so it's not the first use > of a C11 feature. > > > Is there any mileage in the clever trick from Rasmus? > > > > https://lore.kernel.org/r/6cbc8ae1-8eb1-a5a0-a584-2081fca1c4aa@rasmusvillemoes.dk > > Apparently that one only works with GCC 7 or newer, and is only > properly defined behaviour since C11. It also relies on multiple > _Pragma. I'd probably take the arguably much cleaner _Generic solution > over that. ;-) I'd have to try, but I suspect we could force gcc-4.9 or higher to accept it by always passing --std=gnu11 instead of --std=gnu89, but that still wouldn't help us with gcc-4.8, and it's definitely not something we could consider changing for v5.8. However, if we find a solution that is nicer and faster but does requires C11 or some other features from a newer compiler, I think making it version dependent is a good idea and lets us drop the worse code eventually. > I think given that Peter and Arnd already did some testing, and it > works as intended, if you don't mind, I'll send a patch for the > _Generic version. At least that'll give us a more optimized > __unqual_scalar_typeof(). Any further optimizations to READ_ONCE() > like you mentioned then become a little less urgent. Right. I think there is still room for optimization around here, but for v5.8 I'm happy enough with Marco's__unqual_scalar_typeof() change. Stephen Rothwell is probably the one who's most affected by compile speed, so it would be good to get an Ack/Nak from him on whether this brings speed and memory usage back to normal for him as well. Arnd