Re: [PATCH next v2 2/3] printk: change @clear_seq to atomic64_t

From: Sergey Senozhatsky
Date: Tue Dec 08 2020 - 20:04:54 EST


On (20/12/08 23:36), John Ogness wrote:
> On 2020-12-09, Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> wrote:
> >> Sigh, atomic64_read() uses a spin lock in the generic implementation
> >> that is used on some architectures.
> >
> > Oh... So on those archs prb is not lockless in fact, it actually
> > takes the spin_lock each time we read the descriptor state?
> >
> > desc_read()
> > atomic_long_read(state_var)
> > atomic64_read()
> > raw_spin_lock_irqsave(lock, flags)
> > << NMI panic >>
> >
> > Am I missing something?
>
> For the state variable we chose atomic_long_t instead of atomic64_t for
> this reason. atomic_long_t operations are available atomically on all
> architectures.

Right. Looking more at Kconfigs, it seems that when atomic_long_t is
atomic64 (64BIT) then GENERIC_ATOMIC64 is not selected. Those archs
that select GENERIC_ATOMIC64 unconditionally all seem to be 32-bit.

Thanks.

-ss