Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net_sched-extend-rcu-use-in-dump-methods-ii'

Eric Dumazet says:

====================
net_sched: extend RCU use in dump() methods (II)

Second series adding RCU dump() to three actions

First patch removes BH blocking on modules done in the first series.
====================

Link: https://patch.msgid.link/20250827125349.3505302-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+49 -52
+1
include/net/tc_act/tc_skbmod.h
··· 12 12 struct tcf_skbmod_params { 13 13 struct rcu_head rcu; 14 14 u64 flags; /*up to 64 types of operations; extend if needed */ 15 + int action; 15 16 u8 eth_dst[ETH_ALEN]; 16 17 u16 eth_type; 17 18 u8 eth_src[ETH_ALEN];
+1
include/net/tc_act/tc_tunnel_key.h
··· 14 14 struct tcf_tunnel_key_params { 15 15 struct rcu_head rcu; 16 16 int tcft_action; 17 + int action; 17 18 struct metadata_dst *tcft_enc_metadata; 18 19 }; 19 20
+1
include/net/tc_act/tc_vlan.h
··· 10 10 #include <linux/tc_act/tc_vlan.h> 11 11 12 12 struct tcf_vlan_params { 13 + int action; 13 14 int tcfv_action; 14 15 unsigned char tcfv_push_dst[ETH_ALEN]; 15 16 unsigned char tcfv_push_src[ETH_ALEN];
+2 -2
net/sched/act_connmark.c
··· 169 169 170 170 nparms->action = parm->action; 171 171 172 - spin_lock_bh(&ci->tcf_lock); 172 + spin_lock(&ci->tcf_lock); 173 173 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 174 174 oparms = rcu_replace_pointer(ci->parms, nparms, lockdep_is_held(&ci->tcf_lock)); 175 - spin_unlock_bh(&ci->tcf_lock); 175 + spin_unlock(&ci->tcf_lock); 176 176 177 177 if (goto_ch) 178 178 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_csum.c
··· 101 101 params_new->update_flags = parm->update_flags; 102 102 params_new->action = parm->action; 103 103 104 - spin_lock_bh(&p->tcf_lock); 104 + spin_lock(&p->tcf_lock); 105 105 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 106 106 params_new = rcu_replace_pointer(p->params, params_new, 107 107 lockdep_is_held(&p->tcf_lock)); 108 - spin_unlock_bh(&p->tcf_lock); 108 + spin_unlock(&p->tcf_lock); 109 109 110 110 if (goto_ch) 111 111 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_ct.c
··· 1410 1410 goto cleanup; 1411 1411 1412 1412 params->action = parm->action; 1413 - spin_lock_bh(&c->tcf_lock); 1413 + spin_lock(&c->tcf_lock); 1414 1414 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 1415 1415 params = rcu_replace_pointer(c->params, params, 1416 1416 lockdep_is_held(&c->tcf_lock)); 1417 - spin_unlock_bh(&c->tcf_lock); 1417 + spin_unlock(&c->tcf_lock); 1418 1418 1419 1419 if (goto_ch) 1420 1420 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_ctinfo.c
··· 258 258 259 259 cp_new->action = actparm->action; 260 260 261 - spin_lock_bh(&ci->tcf_lock); 261 + spin_lock(&ci->tcf_lock); 262 262 goto_ch = tcf_action_set_ctrlact(*a, actparm->action, goto_ch); 263 263 cp_new = rcu_replace_pointer(ci->params, cp_new, 264 264 lockdep_is_held(&ci->tcf_lock)); 265 - spin_unlock_bh(&ci->tcf_lock); 265 + spin_unlock(&ci->tcf_lock); 266 266 267 267 if (goto_ch) 268 268 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_mpls.c
··· 296 296 htons(ETH_P_MPLS_UC)); 297 297 p->action = parm->action; 298 298 299 - spin_lock_bh(&m->tcf_lock); 299 + spin_lock(&m->tcf_lock); 300 300 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 301 301 p = rcu_replace_pointer(m->mpls_p, p, lockdep_is_held(&m->tcf_lock)); 302 - spin_unlock_bh(&m->tcf_lock); 302 + spin_unlock(&m->tcf_lock); 303 303 304 304 if (goto_ch) 305 305 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_nat.c
··· 95 95 96 96 p = to_tcf_nat(*a); 97 97 98 - spin_lock_bh(&p->tcf_lock); 98 + spin_lock(&p->tcf_lock); 99 99 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 100 100 oparm = rcu_replace_pointer(p->parms, nparm, lockdep_is_held(&p->tcf_lock)); 101 - spin_unlock_bh(&p->tcf_lock); 101 + spin_unlock(&p->tcf_lock); 102 102 103 103 if (goto_ch) 104 104 tcf_chain_put_by_act(goto_ch);
+2 -2
net/sched/act_pedit.c
··· 280 280 281 281 p = to_pedit(*a); 282 282 nparms->action = parm->action; 283 - spin_lock_bh(&p->tcf_lock); 283 + spin_lock(&p->tcf_lock); 284 284 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 285 285 oparms = rcu_replace_pointer(p->parms, nparms, 1); 286 - spin_unlock_bh(&p->tcf_lock); 286 + spin_unlock(&p->tcf_lock); 287 287 288 288 if (oparms) 289 289 call_rcu(&oparms->rcu, tcf_pedit_cleanup_rcu);
+2 -2
net/sched/act_skbedit.c
··· 261 261 params_new->mask = *mask; 262 262 263 263 params_new->action = parm->action; 264 - spin_lock_bh(&d->tcf_lock); 264 + spin_lock(&d->tcf_lock); 265 265 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 266 266 params_new = rcu_replace_pointer(d->params, params_new, 267 267 lockdep_is_held(&d->tcf_lock)); 268 - spin_unlock_bh(&d->tcf_lock); 268 + spin_unlock(&d->tcf_lock); 269 269 if (params_new) 270 270 kfree_rcu(params_new, rcu); 271 271 if (goto_ch)
+12 -14
net/sched/act_skbmod.c
··· 27 27 struct tcf_result *res) 28 28 { 29 29 struct tcf_skbmod *d = to_skbmod(a); 30 - int action, max_edit_len, err; 31 30 struct tcf_skbmod_params *p; 31 + int max_edit_len, err; 32 32 u64 flags; 33 33 34 34 tcf_lastuse_update(&d->tcf_tm); 35 35 bstats_update(this_cpu_ptr(d->common.cpu_bstats), skb); 36 36 37 - action = READ_ONCE(d->tcf_action); 38 - if (unlikely(action == TC_ACT_SHOT)) 37 + p = rcu_dereference_bh(d->skbmod_p); 38 + if (unlikely(p->action == TC_ACT_SHOT)) 39 39 goto drop; 40 40 41 41 max_edit_len = skb_mac_header_len(skb); 42 - p = rcu_dereference_bh(d->skbmod_p); 43 42 flags = p->flags; 44 43 45 44 /* tcf_skbmod_init() guarantees "flags" to be one of the following: ··· 84 85 INET_ECN_set_ce(skb); 85 86 86 87 out: 87 - return action; 88 + return p->action; 88 89 89 90 drop: 90 91 qstats_overlimit_inc(this_cpu_ptr(d->common.cpu_qstats)); ··· 192 193 } 193 194 194 195 p->flags = lflags; 195 - 196 + p->action = parm->action; 196 197 if (ovr) 197 - spin_lock_bh(&d->tcf_lock); 198 + spin_lock(&d->tcf_lock); 198 199 /* Protected by tcf_lock if overwriting existing action. */ 199 200 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 200 201 p_old = rcu_dereference_protected(d->skbmod_p, 1); ··· 208 209 209 210 rcu_assign_pointer(d->skbmod_p, p); 210 211 if (ovr) 211 - spin_unlock_bh(&d->tcf_lock); 212 + spin_unlock(&d->tcf_lock); 212 213 213 214 if (p_old) 214 215 kfree_rcu(p_old, rcu); ··· 247 248 opt.index = d->tcf_index; 248 249 opt.refcnt = refcount_read(&d->tcf_refcnt) - ref; 249 250 opt.bindcnt = atomic_read(&d->tcf_bindcnt) - bind; 250 - spin_lock_bh(&d->tcf_lock); 251 - opt.action = d->tcf_action; 252 - p = rcu_dereference_protected(d->skbmod_p, 253 - lockdep_is_held(&d->tcf_lock)); 251 + rcu_read_lock(); 252 + p = rcu_dereference(d->skbmod_p); 253 + opt.action = p->action; 254 254 opt.flags = p->flags; 255 255 if (nla_put(skb, TCA_SKBMOD_PARMS, sizeof(opt), &opt)) 256 256 goto nla_put_failure; ··· 267 269 if (nla_put_64bit(skb, TCA_SKBMOD_TM, sizeof(t), &t, TCA_SKBMOD_PAD)) 268 270 goto nla_put_failure; 269 271 270 - spin_unlock_bh(&d->tcf_lock); 272 + rcu_read_unlock(); 271 273 return skb->len; 272 274 nla_put_failure: 273 - spin_unlock_bh(&d->tcf_lock); 275 + rcu_read_unlock(); 274 276 nlmsg_trim(skb, b); 275 277 return -1; 276 278 }
+9 -11
net/sched/act_tunnel_key.c
··· 29 29 { 30 30 struct tcf_tunnel_key *t = to_tunnel_key(a); 31 31 struct tcf_tunnel_key_params *params; 32 - int action; 33 32 34 33 params = rcu_dereference_bh(t->params); 35 34 36 35 tcf_lastuse_update(&t->tcf_tm); 37 36 tcf_action_update_bstats(&t->common, skb); 38 - action = READ_ONCE(t->tcf_action); 39 37 40 38 switch (params->tcft_action) { 41 39 case TCA_TUNNEL_KEY_ACT_RELEASE: ··· 49 51 break; 50 52 } 51 53 52 - return action; 54 + return params->action; 53 55 } 54 56 55 57 static const struct nla_policy ··· 530 532 params_new->tcft_action = parm->t_action; 531 533 params_new->tcft_enc_metadata = metadata; 532 534 533 - spin_lock_bh(&t->tcf_lock); 535 + params_new->action = parm->action; 536 + spin_lock(&t->tcf_lock); 534 537 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 535 538 params_new = rcu_replace_pointer(t->params, params_new, 536 539 lockdep_is_held(&t->tcf_lock)); 537 - spin_unlock_bh(&t->tcf_lock); 540 + spin_unlock(&t->tcf_lock); 538 541 tunnel_key_release_params(params_new); 539 542 if (goto_ch) 540 543 tcf_chain_put_by_act(goto_ch); ··· 725 726 }; 726 727 struct tcf_t tm; 727 728 728 - spin_lock_bh(&t->tcf_lock); 729 - params = rcu_dereference_protected(t->params, 730 - lockdep_is_held(&t->tcf_lock)); 731 - opt.action = t->tcf_action; 729 + rcu_read_lock(); 730 + params = rcu_dereference(t->params); 731 + opt.action = params->action; 732 732 opt.t_action = params->tcft_action; 733 733 734 734 if (nla_put(skb, TCA_TUNNEL_KEY_PARMS, sizeof(opt), &opt)) ··· 764 766 if (nla_put_64bit(skb, TCA_TUNNEL_KEY_TM, sizeof(tm), 765 767 &tm, TCA_TUNNEL_KEY_PAD)) 766 768 goto nla_put_failure; 767 - spin_unlock_bh(&t->tcf_lock); 769 + rcu_read_unlock(); 768 770 769 771 return skb->len; 770 772 771 773 nla_put_failure: 772 - spin_unlock_bh(&t->tcf_lock); 774 + rcu_read_unlock(); 773 775 nlmsg_trim(skb, b); 774 776 return -1; 775 777 }
+9 -11
net/sched/act_vlan.c
··· 25 25 { 26 26 struct tcf_vlan *v = to_vlan(a); 27 27 struct tcf_vlan_params *p; 28 - int action; 29 28 int err; 30 29 u16 tci; 31 30 ··· 36 37 */ 37 38 if (skb_at_tc_ingress(skb)) 38 39 skb_push_rcsum(skb, skb->mac_len); 39 - 40 - action = READ_ONCE(v->tcf_action); 41 40 42 41 p = rcu_dereference_bh(v->vlan_p); 43 42 ··· 94 97 skb_pull_rcsum(skb, skb->mac_len); 95 98 96 99 skb_reset_mac_len(skb); 97 - return action; 100 + return p->action; 98 101 99 102 drop: 100 103 tcf_action_inc_drop_qstats(&v->common); ··· 252 255 ETH_ALEN); 253 256 } 254 257 255 - spin_lock_bh(&v->tcf_lock); 258 + p->action = parm->action; 259 + spin_lock(&v->tcf_lock); 256 260 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 257 261 p = rcu_replace_pointer(v->vlan_p, p, lockdep_is_held(&v->tcf_lock)); 258 - spin_unlock_bh(&v->tcf_lock); 262 + spin_unlock(&v->tcf_lock); 259 263 260 264 if (goto_ch) 261 265 tcf_chain_put_by_act(goto_ch); ··· 295 297 }; 296 298 struct tcf_t t; 297 299 298 - spin_lock_bh(&v->tcf_lock); 299 - opt.action = v->tcf_action; 300 - p = rcu_dereference_protected(v->vlan_p, lockdep_is_held(&v->tcf_lock)); 300 + rcu_read_lock(); 301 + p = rcu_dereference(v->vlan_p); 302 + opt.action = p->action; 301 303 opt.v_action = p->tcfv_action; 302 304 if (nla_put(skb, TCA_VLAN_PARMS, sizeof(opt), &opt)) 303 305 goto nla_put_failure; ··· 323 325 tcf_tm_dump(&t, &v->tcf_tm); 324 326 if (nla_put_64bit(skb, TCA_VLAN_TM, sizeof(t), &t, TCA_VLAN_PAD)) 325 327 goto nla_put_failure; 326 - spin_unlock_bh(&v->tcf_lock); 328 + rcu_read_unlock(); 327 329 328 330 return skb->len; 329 331 330 332 nla_put_failure: 331 - spin_unlock_bh(&v->tcf_lock); 333 + rcu_read_unlock(); 332 334 nlmsg_trim(skb, b); 333 335 return -1; 334 336 }