Skip to contentSkip to conversation

docs: net: fix documentation on .ndo_get_stats

PATCH Superseded Jakub Kicinski 2 participants 5 messages Dec 31, 2020 – Jan 5, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 docs: net: fix documentation on .ndo_get_stats

Fix calling context.

---
 Documentation/networking/netdevices.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/networking/netdevices.rst +2 -2
index 5a85fcc80c76..a80676f5477d 100644
@@ -64,8 +64,8 @@ struct net_device synchronization rules
 	Context: process
 
 ndo_get_stats:
-	Synchronization: dev_base_lock rwlock.
-	Context: nominally process, but don't sleep inside an rwlock
+	Synchronization: rtnl_lock() semaphore, or RCU.
+	Context: atomic
 
 ndo_start_xmit:
 	Synchronization: __netif_tx_lock spinlock.
Signature · 1 line
2.26.2
#1 lore raw
Quoted 25 lines · Jakub Kicinski

Fix calling context.

---
 Documentation/networking/netdevices.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/networking/netdevices.rst +2 -2
index 5a85fcc80c76..a80676f5477d 100644
@@ -64,8 +64,8 @@ struct net_device synchronization rules
 	Context: process
 
 ndo_get_stats:
-	Synchronization: dev_base_lock rwlock.
-	Context: nominally process, but don't sleep inside an rwlock
+	Synchronization: rtnl_lock() semaphore, or RCU.
+	Context: atomic
 
 ndo_start_xmit:
 	Synchronization: __netif_tx_lock spinlock.
Signature · 1 line
2.26.2

And what happened to dev_base_lock? Did it suddenly go away?

author maintainer
#2 lore raw
Quoted 21 lines · On Mon, 4 Jan 2021 12:42:27 +0200 Vladimir Oltean wrote:
Quoted 20 lines · Jakub Kicinski

Fix calling context.

---
 Documentation/networking/netdevices.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/networking/netdevices.rst +2 -2
index 5a85fcc80c76..a80676f5477d 100644
@@ -64,8 +64,8 @@ struct net_device synchronization rules
 	Context: process
 
 ndo_get_stats:
-	Synchronization: dev_base_lock rwlock.
-	Context: nominally process, but don't sleep inside an rwlock
+	Synchronization: rtnl_lock() semaphore, or RCU.
+	Context: atomic
 
Quoted 4 lines

Documentation/networking/netdevices.rst struct net_device synchronization rules · line 71

Quoted 2 lines
Documentation/networking/netdevices.rst +0 -0
 ndo_start_xmit:
 	Synchronization: __netif_tx_lock spinlock.

And what happened to dev_base_lock? Did it suddenly go away?

I thought all callers switched to RCU. You investigated this in depth, did I miss something? I'm sending this correction because I have a series which adds to other sections of this file and this jumped out to me as incorrect.

#3 lore raw
Quoted 27 lines · Jakub Kicinski
Quoted 21 lines · On Mon, 4 Jan 2021 12:42:27 +0200 Vladimir Oltean wrote:
Quoted 20 lines · Jakub Kicinski

Fix calling context.

---
 Documentation/networking/netdevices.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/networking/netdevices.rst +2 -2
index 5a85fcc80c76..a80676f5477d 100644
@@ -64,8 +64,8 @@ struct net_device synchronization rules
 	Context: process
 
 ndo_get_stats:
-	Synchronization: dev_base_lock rwlock.
-	Context: nominally process, but don't sleep inside an rwlock
+	Synchronization: rtnl_lock() semaphore, or RCU.
+	Context: atomic
 
Quoted 4 lines

Documentation/networking/netdevices.rst struct net_device synchronization rules · line 71

Quoted 2 lines
Documentation/networking/netdevices.rst +0 -0
 ndo_start_xmit:
 	Synchronization: __netif_tx_lock spinlock.

And what happened to dev_base_lock? Did it suddenly go away?

Quoted 4 lines

I thought all callers switched to RCU. You investigated this in depth, did I miss something? I'm sending this correction because I have a series which adds to other sections of this file and this jumped out to me as incorrect.

Well, there's netstat_show from net/core/net-sysfs.c still. I couldn't figure why that lock exists, it doesn't seem to protect something in particular.

author maintainer
#4 lore raw
Quoted 4 lines · On Tue, 5 Jan 2021 03:03:27 +0200 Vladimir Oltean wrote:
Quoted 3 lines · Jakub Kicinski
Quoted 1 line · On Mon, 4 Jan 2021 12:42:27 +0200 Vladimir Oltean wrote:

And what happened to dev_base_lock? Did it suddenly go away?

Quoted 8 lines
Quoted 4 lines

I thought all callers switched to RCU. You investigated this in depth, did I miss something? I'm sending this correction because I have a series which adds to other sections of this file and this jumped out to me as incorrect.

Well, there's netstat_show from net/core/net-sysfs.c still. I couldn't figure why that lock exists, it doesn't seem to protect something in particular.

Ah, thanks for pointing that out, in that case I should just add RCU to the list of locks that may be held.