diff mbox series

[net-next] vrf: Remove unnecessary RCU-bh critical section

Message ID 20230821142339.1889961-1-idosch@nvidia.com (mailing list archive)
State Accepted
Commit 504fc6f4f7f681d2a03aa5f68aad549d90eab853
Delegated to: Netdev Maintainers
Headers show
Series [net-next] vrf: Remove unnecessary RCU-bh critical section | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ido Schimmel Aug. 21, 2023, 2:23 p.m. UTC
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

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/vrf.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Simon Horman Aug. 22, 2023, 7:32 a.m. UTC | #1
On Mon, Aug 21, 2023 at 05:23:39PM +0300, Ido Schimmel 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.
> 
> [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
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>
David Ahern Aug. 22, 2023, 3:29 p.m. UTC | #2
On 8/21/23 8:23 AM, Ido Schimmel 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.
> 
> [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
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  drivers/net/vrf.c | 2 --
>  1 file changed, 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Aug. 22, 2023, 6:10 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 6043e63b42f9..43f374444684 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -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);
 	}