Skip to contentSkip to conversation

drivers: net: Fix 64-bit statistics seqcount init

PATCH In review Florian Fainelli 6 participants 14 messages Aug 1, 2017 – Aug 2, 2017

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover drivers: net: Fix 64-bit statistics seqcount init

Hi all,

This patch series fixes a bunch of drivers to have their 64-bit statistics seqcount cookie be initialized correctly. Most of these drivers (except b44, gtp) are probably used on 64-bit only hosts and so the lockdep splat might have never been seen.

Florian Fainelli (7):
b44: Initialize 64-bit stats seqcount
i40e: Initialize 64-bit statistics TX ring seqcount
ixgbe: Initialize 64-bit stats seqcounts
nfp: Initialize RX and TX ring 64-bit stats seqcounts
gtp: Initialize 64-bit per-cpu stats correctly
netvsc: Initialize 64-bit stats seqcount
ipvlan: Fix 64-bit statistics seqcount initialization

 drivers/net/ethernet/broadcom/b44.c                 | 1 +
 drivers/net/ethernet/intel/i40e/i40e_txrx.c         | 2 ++
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c   | 4 ++++
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 ++
 drivers/net/gtp.c                                   | 2 +-
 drivers/net/hyperv/netvsc.c                         | 2 ++
 drivers/net/ipvlan/ipvlan_main.c                    | 2 +-
 7 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/7 b44: Initialize 64-bit stats seqcount

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes eeda8585522b ("b44: add 64 bit stats")
---
 drivers/net/ethernet/broadcom/b44.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/b44.c +1 -0
index f411936b744c..a1125d10c825 100644
@@ -2368,6 +2368,7 @@ static int b44_init_one(struct ssb_device *sdev,
 	bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE);
 
 	spin_lock_init(&bp->lock);
+	u64_stats_init(&bp->hw_stats.syncp);
 
 	bp->rx_pending = B44_DEF_RX_RING_PENDING;
 	bp->tx_pending = B44_DEF_TX_RING_PENDING;
Signature · 1 line
2.9.3
maintainer Acked-by on v1 1/7
#2 lore raw

Re: [PATCH net 1/7] b44: Initialize 64-bit stats seqcount

Quoted 6 lines · Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes eeda8585522b ("b44: add 64 bit stats")

Thanks.

#3 lore raw

PATCH 2/7 i40e: Initialize 64-bit statistics TX ring seqcount

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes 980e9b118642 ("i40e: Add support for 64 bit netstats")
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -0
index b936febc315a..2194960d5855 100644
@@ -1113,6 +1113,8 @@ int i40e_setup_tx_descriptors(struct i40e_ring *tx_ring)
 	if (!tx_ring->tx_bi)
 		goto err;
 
+	u64_stats_init(&tx_ring->syncp);
+
 	/* round up to nearest 4K */
 	tx_ring->size = tx_ring->count * sizeof(struct i40e_tx_desc);
 	/* add u32 for head writeback, align after this takes care of
Signature · 1 line
2.9.3
#4 lore raw

PATCH 3/7 ixgbe: Initialize 64-bit stats seqcounts

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes 4197aa7bb818 ("ixgbevf: provide 64 bit statistics")
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +4 -0
index 084c53582793..032f8ac06357 100644
@@ -2988,6 +2988,8 @@ int ixgbevf_setup_tx_resources(struct ixgbevf_ring *tx_ring)
 	if (!tx_ring->tx_buffer_info)
 		goto err;
 
+	u64_stats_init(&tx_ring->syncp);
+
 	/* round up to nearest 4K */
 	tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
 	tx_ring->size = ALIGN(tx_ring->size, 4096);
@@ -3046,6 +3048,8 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_ring *rx_ring)
 	if (!rx_ring->rx_buffer_info)
 		goto err;
 
+	u64_stats_init(&rx_ring->syncp);
+
 	/* Round up to nearest 4K */
 	rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
 	rx_ring->size = ALIGN(rx_ring->size, 4096);
Signature · 1 line
2.9.3
#5 lore raw

PATCH 4/7 nfp: Initialize RX and TX ring 64-bit stats seqcounts

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/netronome/nfp/nfp_net_common.c +2 -0
index 18750ff0ede6..4631ca8b8eb2 100644
@@ -513,6 +513,7 @@ nfp_net_tx_ring_init(struct nfp_net_tx_ring *tx_ring,
 	tx_ring->idx = idx;
 	tx_ring->r_vec = r_vec;
 	tx_ring->is_xdp = is_xdp;
+	u64_stats_init(&tx_ring->r_vec->tx_sync);
 
 	tx_ring->qcidx = tx_ring->idx * nn->stride_tx;
 	tx_ring->qcp_q = nn->tx_bar + NFP_QCP_QUEUE_OFF(tx_ring->qcidx);
@@ -532,6 +533,7 @@ nfp_net_rx_ring_init(struct nfp_net_rx_ring *rx_ring,
 
 	rx_ring->idx = idx;
 	rx_ring->r_vec = r_vec;
+	u64_stats_init(&rx_ring->r_vec->rx_sync);
 
 	rx_ring->fl_qcidx = rx_ring->idx * nn->stride_rx;
 	rx_ring->qcp_fl = nn->rx_bar + NFP_QCP_QUEUE_OFF(rx_ring->fl_qcidx);
Signature · 1 line
2.9.3
Reviewed-by on v1 4/7
#6 lore raw

Re: [PATCH net 4/7] nfp: Initialize RX and TX ring 64-bit stats seqcounts

Quoted 6 lines · Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.

Fixes 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")

FYI, Jakub is on leave this week.

#7 lore raw

PATCH 5/7 gtp: Initialize 64-bit per-cpu stats correctly

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that by using netdev_alloc_pcpu_stats() instead of an open coded allocation.

Fixes 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
---
 drivers/net/gtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gtp.c +1 -1
index 1542e837fdfa..f38e32a7ec9c 100644
@@ -364,7 +364,7 @@ static int gtp_dev_init(struct net_device *dev)
 
 	gtp->dev = dev;
 
-	dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
+	dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
 	if (!dev->tstats)
 		return -ENOMEM;
 
Signature · 1 line
2.9.3
maintainer Acked-by on v1 5/7
#8 lore raw

Re: [PATCH net 5/7] gtp: Initialize 64-bit per-cpu stats correctly

Quoted 7 lines · Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that by using netdev_alloc_pcpu_stats() instead of an open coded allocation.

Fixes 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")

Thanks!

#9 lore raw

PATCH 6/7 netvsc: Initialize 64-bit stats seqcount

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that. In commit 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics") netdev_alloc_pcpu_stats() was removed in favor of open-coding the 64-bits statistics, except that u64_stats_init() was missed.

Fixes 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics")
---
 drivers/net/hyperv/netvsc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/hyperv/netvsc.c +2 -0
index 0a9167dd72fb..96f90c75d1b7 100644
@@ -1302,6 +1302,8 @@ int netvsc_device_add(struct hv_device *device,
 		struct netvsc_channel *nvchan = &net_device->chan_table[i];
 
 		nvchan->channel = device->channel;
+		u64_stats_init(&nvchan->tx_stats.syncp);
+		u64_stats_init(&nvchan->rx_stats.syncp);
 	}
 
 	/* Enable NAPI handler before init callbacks */
Signature · 1 line
2.9.3
#10 lore raw

PATCH 6/7 netvsc: Initialize 64-bit stats seqcount

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that. In commit 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics") netdev_alloc_pcpu_stats() was removed in favor of open-coding the 64-bits statistics, except that u64_stats_init() was missed.

Fixes 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics")
---
 drivers/net/hyperv/netvsc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/hyperv/netvsc.c +2 -0
index 0a9167dd72fb..96f90c75d1b7 100644
@@ -1302,6 +1302,8 @@ int netvsc_device_add(struct hv_device *device,
 		struct netvsc_channel *nvchan = &net_device->chan_table[i];
 
 		nvchan->channel = device->channel;
+		u64_stats_init(&nvchan->tx_stats.syncp);
+		u64_stats_init(&nvchan->rx_stats.syncp);
 	}
 
 	/* Enable NAPI handler before init callbacks */
Signature · 1 line
2.9.3
#11 lore raw

Re: [PATCH net 6/7] netvsc: Initialize 64-bit stats seqcount

Quoted 18 lines · On Tue, 1 Aug 2017 12:11:12 -0700 Florian Fainelli <[email protected]>…

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that. In commit 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics") netdev_alloc_pcpu_stats() was removed in favor of open-coding the 64-bits statistics, except that u64_stats_init() was missed.

Fixes 6c80f3fc2398 ("netvsc: report per-channel stats in ethtool statistics")
---
 drivers/net/hyperv/netvsc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/hyperv/netvsc.c +0 -0
index 0a9167dd72fb..96f90c75d1b7 100644

drivers/net/hyperv/netvsc.c int netvsc_device_add(struct hv_device *device, · line 1309

Quoted 8 lines
drivers/net/hyperv/netvsc.c +2 -0
@@ -1302,6 +1302,8 @@ int netvsc_device_add(struct hv_device *device,
 		struct netvsc_channel *nvchan = &net_device->chan_table[i];
 
 		nvchan->channel = device->channel;
+		u64_stats_init(&nvchan->tx_stats.syncp);
+		u64_stats_init(&nvchan->rx_stats.syncp);
 	}
 
 	/* Enable NAPI handler before init callbacks */

Looks good, thanks. 32 bit guests are still supported but rarely tested.

#12 lore raw

PATCH 7/7 ipvlan: Fix 64-bit statistics seqcount initialization

In reply to Florian Fainelli

On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that by using the proper helper function: netdev_alloc_pcpu_stats().

Fixes 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
---
 drivers/net/ipvlan/ipvlan_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipvlan/ipvlan_main.c +1 -1
index f37e3c1fd4e7..8dab74a81303 100644
@@ -192,7 +192,7 @@ static int ipvlan_init(struct net_device *dev)
 
 	netdev_lockdep_set_classes(dev);
 
-	ipvlan->pcpu_stats = alloc_percpu(struct ipvl_pcpu_stats);
+	ipvlan->pcpu_stats = netdev_alloc_pcpu_stats(struct ipvl_pcpu_stats);
 	if (!ipvlan->pcpu_stats)
 		return -ENOMEM;
 
Signature · 1 line
2.9.3
maintainer
#13 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Tue, 1 Aug 2017 12:11:05 -0700

Quoted 4 lines

This patch series fixes a bunch of drivers to have their 64-bit statistics seqcount cookie be initialized correctly. Most of these drivers (except b44, gtp) are probably used on 64-bit only hosts and so the lockdep splat might have never been seen.

Series applied, thanks.