From: Mark Rutland <mark.rutland@arm.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Akira Yokosawa <akiyks@gmail.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-doc@vger.kernel.org, kernel-team@meta.com,
Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun.feng@gmail.com>
Subject: Re: [PATCH locking/atomic 18/19] locking/atomic: Refrain from generating duplicate fallback kernel-doc
Date: Tue, 16 May 2023 17:52:03 +0100 [thread overview]
Message-ID: <ZGO0s1FDGn/pzCPg@FVFF77S0Q05N> (raw)
In-Reply-To: <551c7820-1748-433b-8c42-daf777e202df@paulmck-laptop>
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.
next prev parent reply other threads:[~2023-05-16 16:52 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 18:15 [PATCH locking/atomics 0/19] Add kernel-doc for more atomic operations Paul E. McKenney
2023-05-10 18:16 ` [PATCH locking/atomic 01/19] locking/atomic: Fix fetch_add_unless missing-period typo Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 02/19] locking/atomic: Add "@" before "true" and "false" for fallback templates Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 03/19] locking/atomic: Add kernel-doc and docbook_oldnew variables for headers Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 04/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}inc${sfx}${order} Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 05/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}dec${sfx}${order} Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 06/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}andnot${sfx}${order} Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 07/19] locking/atomic: Add kernel-doc header for arch_${atomic}_try_cmpxchg${order} Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 08/19] locking/atomic: Add kernel-doc header for arch_${atomic}_dec_if_positive Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 09/19] locking/atomic: Add kernel-doc header for arch_${atomic}_dec_unless_positive Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 10/19] locking/atomic: Add kernel-doc header for arch_${atomic}_inc_unless_negative Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 11/19] locking/atomic: Add kernel-doc header for arch_${atomic}_set_release Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 12/19] locking/atomic: Add kernel-doc header for arch_${atomic}_read_acquire Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 13/19] locking/atomic: Script to auto-generate acquire, fence, and release headers Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 14/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}${name}${sfx}_acquire Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 15/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}${name}${sfx}_release Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 16/19] locking/atomic: Add kernel-doc header for arch_${atomic}_${pfx}${name}${sfx} Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 17/19] x86/atomic.h: Remove duplicate kernel-doc headers Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 18/19] locking/atomic: Refrain from generating duplicate fallback kernel-doc Paul E. McKenney
2023-05-11 17:10 ` Mark Rutland
2023-05-11 19:12 ` Paul E. McKenney
2023-05-12 13:18 ` Mark Rutland
2023-05-12 16:01 ` Paul E. McKenney
2023-05-12 17:03 ` Mark Rutland
2023-05-12 18:42 ` Paul E. McKenney
2023-05-13 2:11 ` Paul E. McKenney
2023-05-13 23:58 ` Akira Yokosawa
2023-05-14 1:14 ` Paul E. McKenney
2023-05-16 16:52 ` Mark Rutland [this message]
2023-05-16 18:42 ` Paul E. McKenney
2023-05-11 19:38 ` Peter Zijlstra
2023-05-11 19:53 ` Paul E. McKenney
2023-05-11 20:01 ` Peter Zijlstra
2023-05-11 20:25 ` Paul E. McKenney
2023-05-11 20:46 ` Peter Zijlstra
2023-05-11 20:48 ` Peter Zijlstra
2023-05-11 21:24 ` Paul E. McKenney
2023-05-12 13:30 ` Mark Rutland
2023-05-11 20:18 ` Peter Zijlstra
2023-05-11 20:29 ` Paul E. McKenney
2023-05-10 18:17 ` [PATCH locking/atomic 19/19] docs: Add atomic operations to the driver basic API documentation Paul E. McKenney
2023-05-16 21:33 ` Kees Cook
2023-05-17 10:10 ` Paul E. McKenney
2023-05-22 12:30 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZGO0s1FDGn/pzCPg@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=akiyks@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox