Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp858909ybm; Wed, 27 May 2020 09:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb0P6MCUkBLfEnwKZJJIeTxfIQl6v38L3sV7Ue327lCjD2I4DNCD9vWghNvv8rfdPPmgCR X-Received: by 2002:a17:906:f747:: with SMTP id jp7mr6790984ejb.110.1590597575021; Wed, 27 May 2020 09:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590597575; cv=none; d=google.com; s=arc-20160816; b=vzfgnj904qeUFLS8EcFgf24ATHFIFbgB9Uue0eHN9UHcdCwhuctHhjycW/z4CzYRHN rQy7tjbq4XGGwJ5ud6wKMIm7QfTBE/BLD38Uq36YFIWeg8gxFUwMi87djzrPK+JhhEpN KDANa1h3Jp6eSLxNtFlau2kOJtdLowt6g/Aza1QsFDlLmaAx0twVV/B79qnv2PxSg8Da uVWvI+DDLhoX8cEKS4LMUzYHyan8sPbEgByoowpOKePryVW0TmC1caG44DzQf5yJAIwu Z/1uOWgP2+AJ4XvL2D4GytjMmwaAaBQgjUPDTJ1/hB7/6HDljfGnCsFrBvqlUcH/h7Bi Rtqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=S25vVde9yiEiJGC4pstAOIXqe7k8wnOQKj8y0xY81d8=; b=R5q81NpSsfYRqmCgbjcEJ7Vmg77+BgHu1NkQZcC4DyGCoGLdB/SmzcH/evLItrjTR/ 0KVPWe+oWLFLiwr8l9s1qLfPS2QREFgIaMPA4c35djWCbwOrKvSdrglvaPAFqfO36Pe9 70tR0XD/Vd5HjtK01HhNiZpX+Su+MsfL4+5Cz02Yc3Qcul8JyYUgqIdytwjAK1P4m75E 9Eq8rac6CG8xBK9fx8wYev6hwj5TwcmGD2FK+SPY27L9RctDeqFX690sahBEOPqQfrS/ eovfi4Yh/q4hfEHzyYeoIl0gDEjcN/ljGRcogFRSvdzKwf+RH0s3hJwrtpJVA283vZKh +D6A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si2305879ejh.271.2020.05.27.09.39.12; Wed, 27 May 2020 09:39:35 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727872AbgE0J1M (ORCPT + 99 others); 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-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-Spam-Flag: NO 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