Re: rcu kernel-doc issues (4.14-rc1)

From: Paul E. McKenney
Date: Sun Sep 17 2017 - 22:40:34 EST


On Sun, Sep 17, 2017 at 12:49:10PM -0700, Paul E. McKenney wrote:
> On Sun, Sep 17, 2017 at 10:57:42AM -0700, Randy Dunlap wrote:
> > On 09/17/17 10:47, Paul E. McKenney wrote:
> > > On Sat, Sep 16, 2017 at 09:41:45PM -0700, Paul E. McKenney wrote:
> > >> On Sat, Sep 16, 2017 at 06:26:04PM -0700, Randy Dunlap wrote:
> > >>> On 4.14-rc1, I am seeing lots of warnings on rcu kernel-doc:
> > >>>
> > >>> .. kernel-doc:: include/linux/rcupdate.h
> > >>> :external:
> > >>> ./Documentation/core-api/kernel-api.rst:357: ERROR: Error in "kernel-doc" directive:
> > >>> unknown option: "external".
> > >>
> > >> $ grep external include/linux/rcupdate.h
> > >> * by a single external-to-structure RCU-protected pointer, then you may
> > >> * external-to-structure pointer -after- you have completely initialized
> > >>
> > >> Do these comments somehow qualify as an "external" option? If so, how
> > >> do I tell kernel-doc to ignore them? Or must I reword them to avoid
> > >> the word "external"?
> > >>
> > >>> .. kernel-doc:: include/linux/rcupdate_wait.h
> > >>> :external:
> > >>> ./Documentation/core-api/kernel-api.rst:360: ERROR: Error in "kernel-doc" directive:
> > >>> unknown option: "external".
> > >>
> > >> $ grep external include/linux/rcupdate_wait.h
> > >>
> > >> There is no occurrence of the string "external" in this file. So this
> > >> "external" option is unknown to me as well. So, any hints on how I
> > >> should interpret these error messages?
> > >
> > > And thanks to Akira Yokosawa for pointing out my confusion in reading
> > > these error messages. The line numbers of course apply to the file
> > > Documentation/core-api/kernel-api.rst rather than the various RCU
> > > C-language source files.
> > >
> > > The patch below removes the error messages for me. Is this what you
> > > had in mind? (Might need other options at some point, but somewhere
> > > to start.)
> > >
> >
> > Yes, much better. Thanks.
> >
> > Just some missing kernel-doc on parameters mostly remaining:
>
> I have now fixed a number of these, thank you.
>
> Any hints for how to represent code samples within a "/**" comment?
>
> /home/git/linux-2.6-tip/include/linux/rcupdate.h:559: ERROR: Unexpected indentation.
> /home/git/linux-2.6-tip/include/linux/rcupdate.h:563: WARNING: Block quote ends without a blank line; unexpected unindent.
> /home/git/linux-2.6-tip/include/linux/rcupdate.h:777: ERROR: Unexpected indentation.
> /home/git/linux-2.6-tip/include/linux/rcupdate.h:778: WARNING: Block quote ends without a blank line; unexpected unindent.

And after some playing around, I did get rid of the error messages.
The code-block output looks a bit strange though, hints? I preceded
the code block with "::", again at Akira's suggestion. It looks fine
except for the :c:func: and backquotes on the first and last lines.

Thanx, Paul

------------------------------------------------------------------------

:c:func:`rcu_read_lock()`;
p = rcu_dereference(gp);
long_lived = is_long_lived(p);
if (long_lived) {
if (!atomic_inc_not_zero(p->refcnt))
long_lived = false;
else
p = rcu_pointer_handoff(p);
}
:c:func:`rcu_read_unlock()`;