Skip to contentSkip to conversation

Patch "net: qlge: Eliminate duplicate barriers on weakly-ordered archs" has been added to the 4.16-stable tree

DISCUSSION Sinan Kaya 2 participants 2 messages May 1, 2018 1 message not in the archive Stable branch

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Sinan Kaya

author
#1 lore raw
Quoted 8 lines · On 5/1/2018 6:32 PM, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

net: qlge: Eliminate duplicate barriers on weakly-ordered archs

to the 4.16-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 7 lines

The filename of the patch is:
net-qlge-eliminate-duplicate-barriers-on-weakly-ordered-archs.patch
and it can be found in the queue-4.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

I don't think these should be pulled at this moment. There is still more barrier work to be done and the patch below goes in the wrong direction after discussion with Linus.

I'm waiting for all architectures to reach to functional parity at the end of 4.17 to pick up from where I left.

There are still few architectures still violating writel() guarantee.

Quoted 71 lines
Quoted 2 lines
Quoted 2 lines

From foo@baz Tue May 1 14:59:17 PDT 2018

From: Sinan Kaya <[email protected]>
Date: Sun, 25 Mar 2018 10:39:19 -0400
Subject: net: qlge: Eliminate duplicate barriers on weakly-ordered archs

From: Sinan Kaya <[email protected]>

[ Upstream commit e42d8cee343a545ac2d9557a3b28708bbca2bd31 ]

Code includes wmb() followed by writel(). writel() already has a barrier on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the register write.

Create a new wrapper function with relaxed write operator. Use the new wrapper when a write is following a wmb().

---
 drivers/net/ethernet/qlogic/qlge/qlge.h      |   16 ++++++++++++++++
 drivers/net/ethernet/qlogic/qlge/qlge_main.c |    3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlge/qlge.h +16 -0
@@ -2185,6 +2185,22 @@ static inline void ql_write_db_reg(u32 v
 }
 
 /*
+ * Doorbell Registers:
+ * Doorbell registers are virtual registers in the PCI memory space.
+ * The space is allocated by the chip during PCI initialization.  The
+ * device driver finds the doorbell address in BAR 3 in PCI config space.
+ * The registers are used to control outbound and inbound queues. For
+ * example, the producer index for an outbound queue.  Each queue uses
+ * 1 4k chunk of memory.  The lower half of the space is for outbound
+ * queues. The upper half is for inbound queues.
+ * Caller has to guarantee ordering.
+ */
+static inline void ql_write_db_reg_relaxed(u32 val, void __iomem *addr)
+{
+	writel_relaxed(val, addr);
+}
+
+/*
  * Shadow Registers:
  * Outbound queues have a consumer index that is maintained by the chip.
  * Inbound queues have a producer index that is maintained by the chip.
drivers/net/ethernet/qlogic/qlge/qlge_main.c +2 -1
@@ -2700,7 +2700,8 @@ static netdev_tx_t qlge_send(struct sk_b
 		tx_ring->prod_idx = 0;
 	wmb();
 
-	ql_write_db_reg(tx_ring->prod_idx, tx_ring->prod_idx_db_reg);
+	ql_write_db_reg_relaxed(tx_ring->prod_idx, tx_ring->prod_idx_db_reg);
+	mmiowb();
 	netif_printk(qdev, tx_queued, KERN_DEBUG, qdev->ndev,
 		     "tx queued, slot %d, len %d\n",
 		     tx_ring->prod_idx, skb->len);

Patches currently in stable-queue which might be from [email protected] are

queue-4.16/net-qlge-eliminate-duplicate-barriers-on-weakly-ordered-archs.patch

Signature · 3 lines
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.
maintainer
#2 lore raw
Quoted 17 lines · Sinan Kaya
Quoted 8 lines · On 5/1/2018 6:32 PM, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

net: qlge: Eliminate duplicate barriers on weakly-ordered archs

to the 4.16-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 7 lines

The filename of the patch is:
net-qlge-eliminate-duplicate-barriers-on-weakly-ordered-archs.patch
and it can be found in the queue-4.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 8 lines

I don't think these should be pulled at this moment. There is still more barrier work to be done and the patch below goes in the wrong direction after discussion with Linus.

I'm waiting for all architectures to reach to functional parity at the end of 4.17 to pick up from where I left.

There are still few architectures still violating writel() guarantee.

Fair enough, thanks for the information, I'll drop this now.

greg k-h