Re: [PATCH net v3 3/7] net/sched: act_gate: build schedule and RCU-swap

From
Victor Nogueira <hidden>
Date
2026-01-21 19:43:25
Also in
lkml, stable
Reply to
Paul Moses, 2026-01-21
On 21/01/2026 10:20, Paul Moses wrote:
quoted hunk ↗ jump to hunk
Build a fresh params snapshot and swap it in with rcu_replace_pointer(),
then free the old snapshot via call_rcu(). This is the same publish+defer
pattern used in taprio sched swapping (sch_taprio.c, commit d5c4546062fd6f)
and in act_pedit param updates (act_pedit.c, commit 52cf89f78c01bf).

When REPLACE omits TCA_GATE_ENTRY_LIST, carry forward the old snapshot fields
(basetime/clockid/flags/cycletime/priority) and only override provided attrs,
so partial updates don’t reset unrelated state.

Parse entry lists with GFP_KERNEL and explicit error handling, matching taprio’s
schedule parsing (sch_taprio.c, commit 5a781ccbd19e46).
[...]
@@ -388,32 +416,92 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
  
  	gact = to_gate(*a);
  
-	err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
-	if (err < 0)
+	p = kzalloc(sizeof(*p), GFP_KERNEL);
+	if (!p) {
+		err = -ENOMEM;
  		goto release_idr;
+	}
+	INIT_LIST_HEAD(&p->entries);
[...]    	if (!cycletime) {
@@ -425,20 +513,26 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
  		cycletime = cycle;
  		if (!cycletime) {
  			err = -EINVAL;
-			goto chain_put;
+			goto release_mem;
  		}
  	}
  	p->tcfg_cycletime = cycletime;
You are always using the just allocated params pointer (p) when iterating
through the entries [1]. So cycletime will always be 0 when the user
doesn't specify it. This is breaking tdc:

not ok 1119 3719 - Replace gate base-time action
# Command exited with 255, expected 0
# RTNETLINK answers: Invalid argument
# We have an error talking to the kernel

[1] https://elixir.bootlin.com/linux/v6.18.6/source/net/sched/act_gate.c#L402
Thread (26 messages) 26 messages, 3 authors, last reply 2026-02-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help