Re: [PATCH 00/22] add support for Clang LTO

From: Peter Zijlstra
Date: Mon Jul 06 2020 - 15:40:27 EST


On Mon, Jul 06, 2020 at 11:39:33AM -0700, Paul E. McKenney wrote:
> On Mon, Jul 06, 2020 at 08:29:26PM +0200, Peter Zijlstra wrote:
> > On Mon, Jul 06, 2020 at 09:26:33AM -0700, Paul E. McKenney wrote:

> > If they do not consider their Linux OS running correctly :-)
>
> Many of them really do not care at all. In fact, some would consider
> Linux failing to run as an added bonus.

This I think is why we have compiler people in the thread that care a
lot more.

> > > Nevertheless, yes, control dependencies also need attention.
> >
> > Today I added one more \o/
>
> Just make sure you continually check to make sure that compilers
> don't break it, along with the others you have added. ;-)

There's:

kernel/locking/mcs_spinlock.h: smp_cond_load_acquire(l, VAL); \
kernel/sched/core.c: smp_cond_load_acquire(&p->on_cpu, !VAL);
kernel/smp.c: smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK));

arch/x86/kernel/alternative.c: atomic_cond_read_acquire(&desc.refs, !VAL);
kernel/locking/qrwlock.c: atomic_cond_read_acquire(&lock->cnts, !(VAL & _QW_LOCKED));
kernel/locking/qrwlock.c: atomic_cond_read_acquire(&lock->cnts, !(VAL & _QW_LOCKED));
kernel/locking/qrwlock.c: atomic_cond_read_acquire(&lock->cnts, VAL == _QW_WAITING);
kernel/locking/qspinlock.c: atomic_cond_read_acquire(&lock->val, !(VAL & _Q_LOCKED_MASK));
kernel/locking/qspinlock.c: val = atomic_cond_read_acquire(&lock->val, !(VAL & _Q_LOCKED_PENDING_MASK));

include/linux/refcount.h: smp_acquire__after_ctrl_dep();
ipc/mqueue.c: smp_acquire__after_ctrl_dep();
ipc/msg.c: smp_acquire__after_ctrl_dep();
ipc/sem.c: smp_acquire__after_ctrl_dep();
kernel/locking/rwsem.c: smp_acquire__after_ctrl_dep();
kernel/sched/core.c: smp_acquire__after_ctrl_dep();

kernel/events/ring_buffer.c:__perf_output_begin()

And I'm fairly sure I'm forgetting some... One could argue there's too
many of them to check already.

Both GCC and CLANG had better think about it.