Re: [PATCH] READ_ONCE, WRITE_ONCE, kcsan: Perform checks in __*_ONCE variants
From: Nathan Chancellor
Date: Tue May 19 2020 - 23:44:32 EST
On Tue, May 19, 2020 at 11:16:24PM -0400, Qian Cai wrote:
> On Tue, May 19, 2020 at 10:47 PM Nathan Chancellor
> <natechancellor@xxxxxxxxx> wrote:
> >
> > On Tue, May 19, 2020 at 10:28:41PM -0400, Qian Cai wrote:
> > >
> > >
> > > > On May 19, 2020, at 6:05 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > > >
> > > > Yes, it's unfortunate, but we have to stop making major concessions just
> > > > because tools are not up to the task.
> > > >
> > > > We've done that way too much in the past and this particular problem
> > > > 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 tools
> > > > every now and then to get our job done. It's not the end of the world.
> > > >
> > > > Building clang is trivial enough and pointing the make to the right
> > > > compiler is not rocket science either.
> > >
> > > Yes, it all make sense from that angle. On the other hand, I want to be focus on kernel rather than compilers by using a stable and rocket-solid version. Not mentioned the time lost by compiling and properly manage my own toolchain in an automated environment, using such new version of compilers 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ât have a better solution to offer right now.
> >
> > Hi Qian,
> >
> > Shameless plug but I have made a Python script to efficiently configure
> > 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) that
> > has been qualified against the kernel. I currently update it every
> > Linux release but I am probably going to start doing it every month as
> > 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 wanted
> > 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/5a2c31116f412c3b6888be361137efd705e05814
[2]: https://github.com/llvm/llvm-project/commit/151ed6aa38a3ec6c01973b35f684586b6e1c0f7e
Cheers,
Nathan