From: okaya@codeaurora.org (Sinan Kaya)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 3/5] bnx2x: Eliminate duplicate barriers on weakly-ordered archs
Date: Fri, 23 Mar 2018 13:13:46 -0400 [thread overview]
Message-ID: <b4553d26-b326-15be-dcac-12594ea7c5b5@codeaurora.org> (raw)
In-Reply-To: <20180323.130418.2223623186761161723.davem@davemloft.net>
On 3/23/2018 1:04 PM, David Miller wrote:
> From: Sinan Kaya <okaya@codeaurora.org>
> Date: Fri, 23 Mar 2018 12:51:47 -0400
>
>> It could if txdata->tx_db was not a union. There is a data dependency
>> between txdata->tx_db.data.prod and txdata->tx_db.raw.
>>
>> So, no reordering.
>
> I don't see it that way, the code requires that:
>
> txdata->tx_db.data.prod += nbd;
>
> is visible before the doorbell update.>
> barrier() doesn't provide that.
>
> Neither does writel_relaxed(). However plain writel() does.
Correct for some architectures including ARM but not correct universally.
writel() just guarantees register read/writes before and after to be
ordered when HW observes it.
writel() doesn't guarantee that the memory update is visible to the HW
on all architectures.
If you need memory update visibility, that barrier() should have been a
wmb()
A correct multi-arch pattern is
wmb()
writel_relaxed()
mmiowb()
We have decided to drop a similar patch on Infiniband due to incorrect
usage of barrier(). If you feel strongly about it, I can remove the
DOORBELL change.
>
> Therefore the code is only correct as-is, and your change potentially
> adds a reordering problem.
>
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2018-03-23 17:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 17:09 [PATCH v5 0/5] netdev: Eliminate duplicate barriers on weakly-ordered archs Sinan Kaya
2018-03-22 17:09 ` [PATCH v5 1/5] net: qla3xxx: " Sinan Kaya
2018-03-22 17:09 ` [PATCH v5 2/5] qlcnic: " Sinan Kaya
2018-03-22 17:10 ` [PATCH v5 3/5] bnx2x: " Sinan Kaya
2018-03-23 16:20 ` David Miller
2018-03-23 16:31 ` Sinan Kaya
2018-03-23 16:43 ` David Miller
2018-03-23 16:51 ` Sinan Kaya
2018-03-23 17:04 ` David Miller
2018-03-23 17:13 ` Sinan Kaya [this message]
2018-03-23 17:16 ` David Miller
2018-03-24 14:30 ` Chopra, Manish
2018-03-24 14:57 ` Sinan Kaya
2018-03-22 17:10 ` [PATCH v5 4/5] net: qlge: " Sinan Kaya
2018-03-22 17:10 ` [PATCH v5 5/5] bnxt_en: " Sinan Kaya
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=b4553d26-b326-15be-dcac-12594ea7c5b5@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=linux-arm-kernel@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).