RE: [PATCH v1] locking/memory-barriers.txt: Improve documentation for writel() usage

From: Parav Pandit
Date: Mon Oct 03 2022 - 01:55:19 EST


Hi Joel,

> From: Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>
> Sent: Friday, September 30, 2022 7:41 AM
>
> Hi,
>
> > On Sep 29, 2022, at 10:04 PM, Parav Pandit <parav@xxxxxxxxxx> wrote:
> >
> > The cited commit describes that when using writel(), explcit wmb() is
> > not needed. wmb() is an expensive barrier. writel() uses the needed
> > I/O barrier instead of expensive wmb().
>
> Because you mentioned it in the commit message, Why not mention in the
> documentation text as well that writel() has the needed I/O barrier in it?
>
It is already documented in [1].
Though [1] is doesn’t describe about using I/O barrier.

To keep [1] and above example in sync, and to address Akira's comment [2], it makes sense to drop I/O barrier from the above example and reword the line as below

"Note that, when using writel(), a prior barrier is not needed".

[1] https://elixir.bootlin.com/linux/latest/source/Documentation/memory-barriers.txt#L2559
[2] https://lore.kernel.org/lkml/5db465f3-698f-ebee-a668-1740a705ce9c@xxxxxxxxx/
> >
> > Hence update the example to be more accurate that matches the current
> > implementation.
>
> That would make it more accurate, since accuracy is your goal.
>
Yes. Above modified text looks more aligned to writeX() doc.
Will send v2.