Skip to contentSkip to conversation

vrf: Remove unnecessary RCU-bh critical section

PATCH Applied Ido Schimmel 4 participants 4 messages Aug 21, 2023 – Aug 22, 2023

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

PATCH 1/1 vrf: Remove unnecessary RCU-bh critical section

dev_queue_xmit_nit() already uses rcu_read_lock() / rcu_read_unlock() and nothing suggests that softIRQs should be disabled around it. Therefore, remove the rcu_read_lock_bh() / rcu_read_unlock_bh() surrounding it.

Tested using [1] with lockdep enabled.

[1]
#!/bin/bash

ip link add name vrf1 up type vrf table 100
ip link add name veth0 type veth peer name veth1
ip link set dev veth1 master vrf1
ip link set dev veth0 up
ip link set dev veth1 up
ip address add 192.0.2.1/24 dev veth0
ip address add 192.0.2.2/24 dev veth1
ip rule add pref 32765 table local
ip rule del pref 0
tcpdump -i vrf1 -c 20 -w /dev/null &
sleep 10
ping -i 0.1 -c 10 -q 192.0.2.2

---
 drivers/net/vrf.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/vrf.c +0 -2
index 6043e63b42f9..43f374444684 100644
@@ -638,9 +638,7 @@ static void vrf_finish_direct(struct sk_buff *skb)
 		eth_zero_addr(eth->h_dest);
 		eth->h_proto = skb->protocol;
 
-		rcu_read_lock_bh();
 		dev_queue_xmit_nit(skb, vrf_dev);
-		rcu_read_unlock_bh();
 
 		skb_pull(skb, ETH_HLEN);
 	}
Signature · 1 line
2.40.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Ido Schimmel

dev_queue_xmit_nit() already uses rcu_read_lock() / rcu_read_unlock() and nothing suggests that softIRQs should be disabled around it. Therefore, remove the rcu_read_lock_bh() / rcu_read_unlock_bh() surrounding it.

Tested using [1] with lockdep enabled.

[1]
#!/bin/bash

ip link add name vrf1 up type vrf table 100
ip link add name veth0 type veth peer name veth1
ip link set dev veth1 master vrf1
ip link set dev veth0 up
ip link set dev veth1 up
ip address add 192.0.2.1/24 dev veth0
ip address add 192.0.2.2/24 dev veth1
ip rule add pref 32765 table local
ip rule del pref 0
tcpdump -i vrf1 -c 20 -w /dev/null &
sleep 10
ping -i 0.1 -c 10 -q 192.0.2.2

Quoted 1 line
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Ido Schimmel
Quoted 23 lines · Ido Schimmel

dev_queue_xmit_nit() already uses rcu_read_lock() / rcu_read_unlock() and nothing suggests that softIRQs should be disabled around it. Therefore, remove the rcu_read_lock_bh() / rcu_read_unlock_bh() surrounding it.

Tested using [1] with lockdep enabled.

[1]
#!/bin/bash

ip link add name vrf1 up type vrf table 100
ip link add name veth0 type veth peer name veth1
ip link set dev veth1 master vrf1
ip link set dev veth0 up
ip link set dev veth1 up
ip address add 192.0.2.1/24 dev veth0
ip address add 192.0.2.2/24 dev veth1
ip rule add pref 32765 table local
ip rule del pref 0
tcpdump -i vrf1 -c 20 -w /dev/null &
sleep 10
ping -i 0.1 -c 10 -q 192.0.2.2

Quoted 5 lines
---
 drivers/net/vrf.c | 2 --
 1 file changed, 2 deletions(-)
#3 lore raw
In reply to Ido Schimmel
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 21 Aug 2023 17:23:39 +0300 you wrote:

dev_queue_xmit_nit() already uses rcu_read_lock() / rcu_read_unlock() and nothing suggests that softIRQs should be disabled around it. Therefore, remove the rcu_read_lock_bh() / rcu_read_unlock_bh() surrounding it.

Tested using [1] with lockdep enabled.

[...]

Here is the summary with links:
- [net-next] vrf: Remove unnecessary RCU-bh critical section

    https://git.kernel.org/netdev/net-next/c/504fc6f4f7f6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html