Re: [PATCH locking/atomic 18/19] locking/atomic: Refrain from generating duplicate fallback kernel-doc

From: Paul E. McKenney
Date: Thu May 11 2023 - 16:29:09 EST


On Thu, May 11, 2023 at 10:18:37PM +0200, Peter Zijlstra wrote:
> On Wed, May 10, 2023 at 11:17:16AM -0700, Paul E. McKenney wrote:
> > The gen-atomics.sh script currently generates 42 duplicate definitions:
> >
> > arch_atomic64_add_negative
> > arch_atomic64_add_negative_acquire
> > arch_atomic64_add_negative_release
> > arch_atomic64_dec_return
> > arch_atomic64_dec_return_acquire
> > arch_atomic64_dec_return_release
> > arch_atomic64_fetch_andnot
> > arch_atomic64_fetch_andnot_acquire
> > arch_atomic64_fetch_andnot_release
> > arch_atomic64_fetch_dec
> > arch_atomic64_fetch_dec_acquire
> > arch_atomic64_fetch_dec_release
> > arch_atomic64_fetch_inc
> > arch_atomic64_fetch_inc_acquire
> > arch_atomic64_fetch_inc_release
> > arch_atomic64_inc_return
> > arch_atomic64_inc_return_acquire
> > arch_atomic64_inc_return_release
> > arch_atomic64_try_cmpxchg
> > arch_atomic64_try_cmpxchg_acquire
> > arch_atomic64_try_cmpxchg_release
> > arch_atomic_add_negative
> > arch_atomic_add_negative_acquire
> > arch_atomic_add_negative_release
> > arch_atomic_dec_return
> > arch_atomic_dec_return_acquire
> > arch_atomic_dec_return_release
> > arch_atomic_fetch_andnot
> > arch_atomic_fetch_andnot_acquire
> > arch_atomic_fetch_andnot_release
> > arch_atomic_fetch_dec
> > arch_atomic_fetch_dec_acquire
> > arch_atomic_fetch_dec_release
> > arch_atomic_fetch_inc
> > arch_atomic_fetch_inc_acquire
> > arch_atomic_fetch_inc_release
> > arch_atomic_inc_return
> > arch_atomic_inc_return_acquire
> > arch_atomic_inc_return_release
> > arch_atomic_try_cmpxchg
> > arch_atomic_try_cmpxchg_acquire
> > arch_atomic_try_cmpxchg_release
> >
> > These duplicates are presumably to handle different architectures
> > generating hand-coded definitions for different subsets of the atomic
> > operations. However, generating duplicate kernel-doc headers is
> > undesirable.
> >
> > Therefore, generate only the first kernel-doc definition in a group
> > of duplicates. A comment indicates the name of the function and the
> > fallback script that generated it.
>
> So my canonical solution to fixing kernel-doc related problems is this
> trivial regex:
>
> s/\/\*\*/\/\*/
>
> works every time.

Can't say that I am a fan of that approach.

> And is *much* simpler than this:
>
> > scripts/atomic/chkdup.sh | 27 ++
> > scripts/atomic/fallbacks/acquire | 3 +
> > scripts/atomic/fallbacks/add_negative | 5 +
> > scripts/atomic/fallbacks/add_unless | 5 +
> > scripts/atomic/fallbacks/andnot | 5 +
> > scripts/atomic/fallbacks/dec | 5 +
> > scripts/atomic/fallbacks/dec_and_test | 5 +
> > scripts/atomic/fallbacks/dec_if_positive | 5 +
> > scripts/atomic/fallbacks/dec_unless_positive | 5 +
> > scripts/atomic/fallbacks/fence | 3 +
> > scripts/atomic/fallbacks/fetch_add_unless | 5 +
> > scripts/atomic/fallbacks/inc | 5 +
> > scripts/atomic/fallbacks/inc_and_test | 5 +
> > scripts/atomic/fallbacks/inc_not_zero | 5 +
> > scripts/atomic/fallbacks/inc_unless_negative | 5 +
> > scripts/atomic/fallbacks/read_acquire | 5 +
> > scripts/atomic/fallbacks/release | 3 +
> > scripts/atomic/fallbacks/set_release | 5 +
> > scripts/atomic/fallbacks/sub_and_test | 5 +
> > scripts/atomic/fallbacks/try_cmpxchg | 5 +
> > scripts/atomic/gen-atomics.sh | 4 +

This is not a huge addition, now is it?

Thanx, Paul