[ovs-dev] [PATCH 1/2] datapath: Fix recv path for CONFIG_PREEMPT_RCU.

Pravin B Shelar pshelar at nicira.com
Thu Oct 6 22:13:30 UTC 2011


I have modified this patch series according to comments from Jesse.

--8<--------------------------cut here-------------------------->8--

        In case CONFIG_PREEMPT_RCU, rcu grace wait only for RCU read
side critical sections that are delimited by rcu_read_lock() and
rcu_read_unlock(). internal_dev_xmit() is called in
rcu_read_lock_bh context. Therefore we need to explicitly take rcu
lock to prevent race with call_rcu() in PREEMPT_RCU case.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
Bug #7621
---
 datapath/vport-internal_dev.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index ecfb379..1c6897f 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -68,7 +68,7 @@ static int internal_dev_mac_addr(struct net_device *dev, void *p)
 	return 0;
 }
 
-/* Called with rcu_read_lock and bottom-halves disabled. */
+/* Called with rcu_read_lock_bh. */
 static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
 	if (unlikely(compute_ip_summed(skb, true))) {
@@ -79,7 +79,9 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
 	vlan_copy_skb_tci(skb);
 	OVS_CB(skb)->flow = NULL;
 
+	rcu_read_lock();
 	vport_receive(internal_dev_priv(netdev)->vport, skb);
+	rcu_read_unlock();
 	return 0;
 }
 
-- 
1.7.1




More information about the dev mailing list