Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp334948ybk; Wed, 20 May 2020 00:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp+Igbf92II8NRJeAe31xIkc2EjZGVHvmkur6S8NgiPUbCPRo6z4resvBNPgulriD9Jq0G X-Received: by 2002:a17:906:528e:: with SMTP id c14mr2576356ejm.123.1589959861175; Wed, 20 May 2020 00:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589959861; cv=none; d=google.com; s=arc-20160816; b=FmiCpv3icIu2TEjxAMAE9lEBKbZ/myYstjEgD9KaZsrI9zwvDJcJEOxKUsHgDbM41I SrmNS+S+pHmdmcKzbuZObJjzohDrNjiW67rt6e2ezkWkYrkiYB6jzk9ep39lqGvSHodb K8voIixPnHcwAHupjr+5m5OR01Uja8OmVxbEA4jULXh93guVZdNWEAg8OfCcn9SdYStp IgIgxJzo8HdjpZPvdwH+D/BDU8AXppmNOOgXotKrhDIXkI5sbZvJ1FRpos91eSfP3obU UCfKiktYhWyaxnP25Q916yZso40PdVqhEeziHI3Rsx4t257+VQ1oGS8W1bPlDBcjBAUL Vi9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xkPHVoXP68BKS5mey7jq2q721wyLayczstvvUEvUVF8=; b=bxVrNHjkxDBIrJ92+xpNlfU/dpagx8k2J+7/hvEvJ4iadTYv9yOyz0KW8ZVUG1z7e8 JzTtPCqHwge4d1omMvnGphSN1zIs0adNBdw0X+X7va4l4kDRPRy5FSr6PT2IQ3ak4FQC hsCSZ7p3ChTi52TZxY8Ovw15smGvWrGPeGbEqpznzmIxnLyhLpAim7ViR7dS4Sa/qMNm PPA6x/up+omUMRRZIlMAG2r7/L15c8b5HBOug5L99p7TLsqJ6VwZQ0HwIvNppbl4ZCXa ZQtvki5L77frJm4BoD0OecNF5BiDt+GihRBLyCMnstvxH2DOFp1pxxkABW7EVF0V8pTJ NoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pEvWD2Pb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo2si1374125ejb.197.2020.05.20.00.30.37; Wed, 20 May 2020 00:31:01 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=pEvWD2Pb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgETH2y (ORCPT + 99 others); Wed, 20 May 2020 03:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbgETH2e (ORCPT ); Wed, 20 May 2020 03:28:34 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BA1C05BD43 for ; Wed, 20 May 2020 00:28:34 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id v17so1747876ote.0 for ; Wed, 20 May 2020 00:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xkPHVoXP68BKS5mey7jq2q721wyLayczstvvUEvUVF8=; b=pEvWD2PbPHRjXPov0v2cPi6kSsk2SgidZEVQWiKP8t8HL+JLZFvt4KZ8EYY2Bn7cVG 39AeQe/ptN2kBoSaOBbJZcZ0MCK15MyXClTAU80ZaaYuoZFF5NJOPJfvTkfVGb8EUK28 sJm9O6LWJU6p71VM3KDh7lW/fPq5/0zl0yrJ8dIFdIWWvnP4mWqLrg4fbTrF4H+5py6M IiWfLYKiYvAjt01S8sK6rz97dGBIcMLqKK0tHyxQ4lEtn0oDaN1Dkoq/sDvToyrE7khA 04CSFCH7qXynRt3Q6XBMhs9xLs0viiLWy5ltq41le9hewUyJ9SwLeU058foskccxKkbW MyVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xkPHVoXP68BKS5mey7jq2q721wyLayczstvvUEvUVF8=; b=ShpQQs67SXwReGA6cDffCJd6ikULoD1di2G16M/HdOX/n9a4PKr2BwnTRjmv/AY07E cvZ7iUGDZoJ3QoN5xQsQdutlPbT6ovPLPwyR2NRqNG0L13K0M5XwnYDjevQfA4BigXLx PzIRivFQ+z7q4wH2tC5YxYnI8Ea62vwzXy5v0GaCAevfa7+Bt3a9cHuarCEU0eNlWeLj 1vX8IZhof4pGzxySdxLPODl8bBS4sl9M0Nx0GkU+O2Jf0SIfwjRJ3TxftIlAbWtmOyuk YEPssky10Py2K+o2DlZmKIPEghJ1+AoVmJTQ46ZhYQhouEdz6AFszQwMyVOSHdL9GX/l RTsw== X-Gm-Message-State: AOAM531vyjFRNYgZW054BEZIV2oaj/gB0W+MuKDOs8SsufUlbki5YCaq RK7c93Oio1sDubxIlS7+W6d6mZawQ0jRNzB7kDz3gtZsNzQ= X-Received: by 2002:a05:6830:18ce:: with SMTP id v14mr2045756ote.251.1589959713491; Wed, 20 May 2020 00:28:33 -0700 (PDT) MIME-Version: 1.0 References: <87y2pn60ob.fsf@nanos.tec.linutronix.de> <360AFD09-27EC-4133-A5E3-149B8C0C4232@lca.pw> <20200520024736.GA854786@ubuntu-s3-xlarge-x86> <20200520034426.GA1027673@ubuntu-s3-xlarge-x86> In-Reply-To: <20200520034426.GA1027673@ubuntu-s3-xlarge-x86> From: Marco Elver Date: Wed, 20 May 2020 09:28:20 +0200 Message-ID: Subject: Re: [PATCH] READ_ONCE, WRITE_ONCE, kcsan: Perform checks in __*_ONCE variants To: Nathan Chancellor Cc: Qian Cai , Thomas Gleixner , Peter Zijlstra , Linux Kernel Mailing List , kasan-dev , Will Deacon , "Paul E . McKenney" , Ingo Molnar , clang-built-linux Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 May 2020 at 05:44, Nathan Chancellor wrote: > > On Tue, May 19, 2020 at 11:16:24PM -0400, Qian Cai wrote: > > On Tue, May 19, 2020 at 10:47 PM Nathan Chancellor > > wrote: > > > > > > On Tue, May 19, 2020 at 10:28:41PM -0400, Qian Cai wrote: > > > > > > > > > > > > > On May 19, 2020, at 6:05 PM, Thomas Gleixner = wrote: > > > > > > > > > > Yes, it's unfortunate, but we have to stop making major concessio= ns just > > > > > because tools are not up to the task. > > > > > > > > > > We've done that way too much in the past and this particular prob= lem > > > > > clearly demonstrates that there are limits. > > > > > > > > > > Making brand new technology depend on sane tools is not asked too > > > > > much. And yes, it's inconvenient, but all of us have to build too= ls > > > > > every now and then to get our job done. It's not the end of the w= orld. > > > > > > > > > > Building clang is trivial enough and pointing the make to the rig= ht > > > > > compiler is not rocket science either. > > > > > > > > Yes, it all make sense from that angle. On the other hand, I want t= o be focus on kernel rather than compilers by using a stable and rocket-sol= id version. Not mentioned the time lost by compiling and properly manage my= own toolchain in an automated environment, using such new version of compi= lers means that I have to inevitably deal with compiler bugs occasionally. = Anyway, it is just some other more bugs I have to deal with, and I don=E2= =80=99t have a better solution to offer right now. > > > > > > Hi Qian, > > > > > > Shameless plug but I have made a Python script to efficiently configu= re > > > then build clang specifically for building the kernel (turn off a lot= of > > > different things that the kernel does not need). > > > > > > https://github.com/ClangBuiltLinux/tc-build > > > > > > I added an option '--use-good-revision', which uses an older master > > > version (basically somewhere between clang-10 and current master) tha= t > > > has been qualified against the kernel. I currently update it every > > > Linux release but I am probably going to start doing it every month a= s > > > I have written a pretty decent framework to ensure that nothing is > > > breaking on either the LLVM or kernel side. > > > > > > $ ./build-llvm.py --use-good-revision > > > > > > should be all you need to get off the ground and running if you wante= d > > > to give it a shot. The script is completely self contained by default= so > > > it won't mess with the rest of your system. Additionally, leaving off > > > '--use-good-revision' will just use the master branch, which can > > > definitely be broken but not as often as you would think (although I > > > totally understand wanting to focus on kernel regressions only). > > > > Great, thanks. I'll try it in a bit. > > Please let me know if there are any issues! > > Do note that in order to get support for Marco's series, you will need > to have a version of LLVM that includes [1], which the current > --use-good-revision does not. You can checkout that revision exactly > through the '-b' ('--branch') parameter: > > $ ./build-llvm.py -b 5a2c31116f412c3b6888be361137efd705e05814 > > I also see another patch in LLVM that concerns KCSAN [2] but that does > not appear used in Marco's series. Still might be worth having available > in your version of clang. > > I'll try to bump the hash that '--use-good-revision' uses soon. I might > wait until 5.7 final so that I can do both at the same time like I > usually do but we'll see how much time I have. > > [1]: https://github.com/llvm/llvm-project/commit/5a2c31116f412c3b6888be36= 1137efd705e05814 > [2]: https://github.com/llvm/llvm-project/commit/151ed6aa38a3ec6c01973b35= f684586b6e1c0f7e Thanks for sharing the script, this is very useful! Note that [2] above is used, but optional: https://lore.kernel.org/lkml/20200515150338.190344-5-elver@google.com/ It's not required for KCSAN to function correctly, but if it's available it'll help find more data races with the default config. Thanks, -- Marco