All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@redhat.com>,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/24] docs: lockdep-design: fix some warning issues
Date: Wed, 14 Oct 2020 18:04:59 +0200	[thread overview]
Message-ID: <20201014175143.3d594341@coco.lan> (raw)
In-Reply-To: <20201013150250.GJ20115@casper.infradead.org>

Em Tue, 13 Oct 2020 16:02:50 +0100
Matthew Wilcox <willy@infradead.org> escreveu:

> On Tue, Oct 13, 2020 at 04:09:41PM +0200, Peter Zijlstra wrote:
> > On Tue, Oct 13, 2020 at 02:11:16PM +0100, Matthew Wilcox wrote:
> > > On Tue, Oct 13, 2020 at 02:52:06PM +0200, Peter Zijlstra wrote:
> > > > On Tue, Oct 13, 2020 at 02:14:31PM +0200, Mauro Carvalho Chehab wrote:
> > > > > +   =====  ===================================================
> > > > > +   ``.``  acquired while irqs disabled and not in irq context
> > > > > +   ``-``  acquired in irq context
> > > > > +   ``+``  acquired with irqs enabled
> > > > > +   ``?``  acquired in irq context with irqs enabled.
> > > > > +   =====  ===================================================
> > > >
> > > > NAK!
> > > 
> > > You're seriously suggesting that:
> > > 
> > > -   ===  ===================================================
> > > -   '.'  acquired while irqs disabled and not in irq context
> > > -   '-'  acquired in irq context
> > > -   '+'  acquired with irqs enabled
> > > -   '?'  acquired in irq context with irqs enabled.
> > > -   ===  ===================================================
> > > +   =====  ===================================================
> > > +   ``.``  acquired while irqs disabled and not in irq context
> > > +   ``-``  acquired in irq context
> > > +   ``+``  acquired with irqs enabled
> > > +   ``?``  acquired in irq context with irqs enabled.
> > > +   =====  ===================================================
> > > 
> > > this change makes the lockdep docs less readable?
> > 
> > Definitely makes it harder to read for me. My C trained eyes go WTF at
> > seeing it, which breaks the flow. ',' is a regular single character
> > constant, '','' a syntax error.
> 
> OK, that's fair.  'a' is definitely a character constant.  Perhaps
> the automarkup script can take care of this for us?  We'd have to
> be careful not to catch anything we shouldn't've [1], but I'm sure
> there's a regex for it.  Something like "\<'.'\>", perhaps?

I guess that this regex could work:

	/\b\'\S\'\b/ 

would get this very specific case, or maybe even:
	/\b\'\S+\'\b/

in order to get things like 'foo'.

Adding support for something like this at 
Documentation/sphinx/automarkup.py should be trivial. However,
checking if this won't be doing anything wrong with the other existing
files can be painful.

Yet, there are 3 issues related to '.' character usage.

See, the first table is:

   ===  ===================================================
   '.'  acquired while irqs disabled and not in irq context
   '-'  acquired in irq context
   '+'  acquired with irqs enabled
   '?'  acquired in irq context with irqs enabled.
   ===  ===================================================

There, it uses '.' in order to indicate the dot character and so on.

The second table uses a different notation:

   +--------------+-------------+--------------+
   |              | irq enabled | irq disabled |
   +--------------+-------------+--------------+
   | ever in irq  |      ?      |       -      |
   +--------------+-------------+--------------+
   | never in irq |      +      |       .      |
   +--------------+-------------+--------------+

which uses just a question mark without aphostrophes, instead of
'?' (and the same for the other symbols).

The text describing them returns back to the notation used at the
first table:

	"The character '-' suggests irq is disabled because if otherwise the
	 charactor '?' would have been shown instead. Similar deduction can be
	 applied for '+' too."

-

The above has actually 3 separate problems:

1) This problem has nothing to do with Sphinx notation. The notation
   is not coherent: It should use either ., ``.`` or '.' everywhere.  

2) This is Sphinx-specific: a single minus or a single plus character
indicates a list. On both cases, this is actually replaced by an UTF-8
bullet character: '•'.

3) This is a minor issue:

   using '.' will produce an html table that will display, using
   a normal font, as '.', while ``.`` would use a monospaced 
   font and won't display the apostrophes. IMO, at the html output, 
   it would be better to just a dot without apostrophes, as the
   text of the dmesg output doesn't have apostrophes either:

     "When locking rules are violated, these usage bits are presented in the
      locking error messages, inside curlies, with a total of 2 * n STATEs bits.
      A contrived example::

        modprobe/2287 is trying to acquire lock:
         (&sio_locks[i].lock){-.-.}, at: [<c02867fd>] mutex_lock+0x21/0x24

        but task is already holding lock:
         (&sio_locks[i].lock){-.-.}, at: [<c02867fd>] mutex_lock+0x21/0x24"

   Yet, we could live without addressing this one.

> [1] I'm quite proud of that one.
> 
> > > It's not the markup that makes the lockdep documentation hard to
> > > understand.
> > 
> > I'm not sure what you're alluding to, the subject just isn't easy to
> > begin with.
> 
> Absolutely.  The problem is (similar to most Linux documentation)
> the document doesn't know who its audience is.  It mixes internal
> implementation details of lockdep with what people need to know who
> are just trying to understand what a lockdep splat means.  I don't
> have time to restructure it right now though.

Yeah, that is one of the the main issues with this. This specific 
section of the file describes something that a sysadmin or a Kernel
newbie may see on his system. He'll likely seek the web for some
documentation about that, in order to try to understand it.

If someone is willing to do that, it will get this:

	https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#state

Where it presents a plain wrong table that it would look like this:

   +--------------+-------------+--------------+
   |              | irq enabled | irq disabled |
   +--------------+-------------+--------------+
   | ever in irq  |      ?      |       •      |
   +--------------+-------------+--------------+
   | never in irq |      •      |       .      |
   +--------------+-------------+--------------+

If you prefer, I can send a new version of this patch using this at
the second table:

   +--------------+-------------+--------------+
   |              | irq enabled | irq disabled |
   +--------------+-------------+--------------+
   | ever in irq  |     '?'     |      '-'     |
   +--------------+-------------+--------------+
   | never in irq |     '+'     |      '.'     |
   +--------------+-------------+--------------+

and keep using '.' at the other parts of the document.

This should solve the Sphinx issue, although the Sphinx output
won't be using a monospaced font.

Thanks,
Mauro

  reply	other threads:[~2020-10-14 16:05 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 12:14 [PATCH v2 00/24] Documentation build fixes against next-20201013 Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 01/24] docs: hwmon: adm1266.rst: fix a broken reference Mauro Carvalho Chehab
2020-10-13 16:48   ` Guenter Roeck
2020-10-13 12:14 ` [PATCH v2 02/24] tools: docs: memory-model: fix references for some files Mauro Carvalho Chehab
2020-10-13 16:33   ` Paul E. McKenney
2020-10-13 16:38     ` Alan Stern
2020-10-14  1:58       ` Paul E. McKenney
2020-10-14  7:56         ` Mauro Carvalho Chehab
2020-10-14 14:14           ` Akira Yokosawa
2020-10-14 14:39             ` Mauro Carvalho Chehab
2020-10-14 18:57         ` Paul E. McKenney
2020-10-15  5:15           ` Mauro Carvalho Chehab
2020-10-15 10:30             ` Peter Zijlstra
2020-10-13 12:14 ` [PATCH v2 03/24] docs: SafeSetID: fix a warning Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 04/24] docs: lockdep-design: fix some warning issues Mauro Carvalho Chehab
2020-10-13 12:52   ` Peter Zijlstra
2020-10-13 13:11     ` Matthew Wilcox
2020-10-13 14:09       ` Peter Zijlstra
2020-10-13 15:02         ` Matthew Wilcox
2020-10-14 16:04           ` Mauro Carvalho Chehab [this message]
2020-10-13 12:14 ` [PATCH v2 05/24] docs: admin-guide: net.rst: add a missing blank line Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 06/24] blk-mq: docs: add kernel-doc description for a new struct member Mauro Carvalho Chehab
2020-10-13 13:29   ` John Garry
2020-10-13 19:12   ` Jens Axboe
2020-10-13 12:14 ` [PATCH v2 07/24] drm: amdgpu: kernel-doc: update some adev parameters Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 12:41   ` Christian König
2020-10-13 12:41     ` Christian König
2020-10-13 12:41     ` Christian König
2020-10-13 12:14 ` [PATCH v2 08/24] drm: kernel-doc: document drm_dp_set_subconnector_property() params Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 09/24] docs: kasan.rst: add two missing blank lines Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 10/24] mm: pagemap.h: fix two kernel-doc markups Mauro Carvalho Chehab
2020-10-13 12:26   ` Matthew Wilcox
2020-10-21  9:55     ` Mauro Carvalho Chehab
2020-10-21 11:28       ` Matthew Wilcox
2020-10-21 11:59         ` Mauro Carvalho Chehab
2020-10-21 12:02           ` Matthew Wilcox
2020-10-13 12:14 ` [PATCH v2 11/24] drm/dp: fix kernel-doc warnings at drm_dp_helper.c Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 19:20   ` Lyude Paul
2020-10-13 19:20     ` Lyude Paul
2020-10-13 12:14 ` [PATCH v2 12/24] drm/dp: fix a kernel-doc issue at drm_edid.c Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 19:24   ` Lyude Paul
2020-10-13 19:24     ` Lyude Paul
2020-10-13 19:49   ` Lyude Paul
2020-10-13 19:49     ` Lyude Paul
2020-10-21 10:11     ` Mauro Carvalho Chehab
2020-10-21 10:11       ` Mauro Carvalho Chehab
2020-10-21 16:56       ` Lyude Paul
2020-10-21 16:56         ` Lyude Paul
2020-10-13 12:14 ` [PATCH v2 13/24] docs: i2c: index.rst: add slave-testunit-backend.rst Mauro Carvalho Chehab
2020-10-13 15:53   ` Wolfram Sang
2020-10-13 12:14 ` [PATCH v2 14/24] docs: conf.py: disable automarkup for Sphinx 3.x Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 15/24] docs: net: statistics.rst: remove a duplicated kernel-doc Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 16/24] seqlock: fix two kernel-doc warnings Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 17/24] docs: hwmon: mp2975.rst: address some html build warnings Mauro Carvalho Chehab
2020-10-13 16:48   ` Guenter Roeck
2020-10-13 12:14 ` [PATCH v2 18/24] docs: userspace-api: add iommu.rst to the index file Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 19/24] net: phy: remove kernel-doc duplication Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 20/24] MAINTAINERS: fix broken doc refs due to yaml conversion Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 21/24] crypto: sun8x-ce*: update entries to its documentation Mauro Carvalho Chehab
2020-10-13 12:14   ` Mauro Carvalho Chehab
2020-10-13 12:14 ` [PATCH v2 22/24] ice: docs fix a devlink info that broke a table Mauro Carvalho Chehab
2020-10-13 22:01   ` Jacob Keller
2020-10-13 12:14 ` [PATCH v2 23/24] RDMA: add a missing kernel-doc parameter markup Mauro Carvalho Chehab
2020-10-16 16:57   ` Jason Gunthorpe
2020-10-13 12:14 ` [PATCH v2 24/24] counters: docs: add a missing include Mauro Carvalho Chehab
2020-10-15  1:06   ` Shuah Khan

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=20201014175143.3d594341@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.