[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGO0s1FDGn/pzCPg@FVFF77S0Q05N>
Date: Tue, 16 May 2023 17:52:03 +0100
From: Mark Rutland <mark.rutland@....com>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: Akira Yokosawa <akiyks@...il.com>, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-doc@...r.kernel.org, kernel-team@...a.com,
Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH locking/atomic 18/19] locking/atomic: Refrain from
generating duplicate fallback kernel-doc
Hi Paul,
On Sat, May 13, 2023 at 06:14:36PM -0700, Paul E. McKenney wrote:
> On Sun, May 14, 2023 at 08:58:00AM +0900, Akira Yokosawa wrote:
> > Running "./scripts/kernel-doc -none include/linux/atomic/atomic-arch-fallback.h"
> > on the tag emits a lot of warnings.
> >
> > Looks like there are kernel-doc comments who don't have a corresponding
> > function signature next to them.
> >
> > /**
> > * function_name() - Brief description of function.
> > * @arg1: Describe the first argument.
> > * @arg2: Describe the second argument.
> > * One can provide multiple line descriptions
> > * for arguments.
> > *
> > * A longer description, with more discussion of the function function_name()
> > * that might be useful to those using or modifying it. Begins with an
> > * empty comment line, and may include additional embedded empty
> > * comment lines.
> > */
> > int function_name(int arg1, int arg2) <---
> >
> > Note that the kernel-doc script ignores #ifdef -- #else.
>
> Me, I was thinking in terms of making this diagnostic ignore
> include/linux/atomic/atomic-arch-fallback.h. ;-)
>
> The actual definitions are off in architecture-specific files, and
> the kernel-doc headers could be left there. But there are benefits to
> automatically generating all of them.
>
> Another approach might be to put a "it is OK for the definition to
> be elsewhere" comment following those kernel-doc headers.
>
> Any other ways to make this work?
I've spent the last day or so playing with this, and I think we can do this by
relegating the arch_atomic*() functions to an implementation detail (and not
documenting those with kerneldoc), and having a raw_atomic*() layer where we
flesh out the API, where each can have a mandatory function definition as
below:
/**
* raw_atomic_fetch_inc_release() - does a thing atomically
*
* TODO: fill this in
*
* This is a version of atomic_fetch_inc_release() which is safe to use in
* noinstr code. Unless instrumentation needs to be avoided,
* atomic_fetch_inc_release() should be used in preference.
*/
static __always_inline int
raw_atomic_fetch_inc_release(atomic_t *v)
{
#if defined(arch_atomic_fetch_inc_release)
return arch_atomic_fetch_inc_release(v)
#elif defined(arch_atomic_fetch_inc_relaxed)
__atomic_release_fence();
return arch_atomic_fetch_inc_relaxed(v);
#elif defined(arch_atomic_fetch_inc)
return arch_atomic_fetch_inc(v)
#else
return raw_atomic_fetch_add_release(1, v);
#endif
}
... and likewise we can add comments for the regular instrumented atomics.
I've pushed out the WIP patches to my atomics/fallback-rework branch; if you're
happy to give me another day or two I can get a bit further.
> For me, the option of making this
> diagnostic ignore include/linux/atomic/atomic-arch-fallback.h has
> considerable attraction.
It's certainly appealing...
Thanks,
Mark.
Powered by blists - more mailing lists