Skip to content

Commit 53742e6

Browse files
Madhuparna Bhowmikdavem330
authored andcommitted
datapath.c: Use built-in RCU list checking
hlist_for_each_entry_rcu() has built-in RCU and lock checking. Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled by default. Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fed4842 commit 53742e6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎net/openvswitch/datapath.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no)
179179
struct hlist_head *head;
180180

181181
head = vport_hash_bucket(dp, port_no);
182-
hlist_for_each_entry_rcu(vport, head, dp_hash_node) {
182+
hlist_for_each_entry_rcu(vport, head, dp_hash_node,
183+
lockdep_ovsl_is_held()) {
183184
if (vport->port_no == port_no)
184185
return vport;
185186
}
@@ -2042,7 +2043,8 @@ static unsigned int ovs_get_max_headroom(struct datapath *dp)
20422043
int i;
20432044

20442045
for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) {
2045-
hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node) {
2046+
hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node,
2047+
lockdep_ovsl_is_held()) {
20462048
dev = vport->dev;
20472049
dev_headroom = netdev_get_fwd_headroom(dev);
20482050
if (dev_headroom > max_headroom)
@@ -2061,7 +2063,8 @@ static void ovs_update_headroom(struct datapath *dp, unsigned int new_headroom)
20612063

20622064
dp->max_headroom = new_headroom;
20632065
for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++)
2064-
hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node)
2066+
hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node,
2067+
lockdep_ovsl_is_held())
20652068
netdev_set_rx_headroom(vport->dev, new_headroom);
20662069
}
20672070

0 commit comments

Comments
 (0)