mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Victor Nogueira <victor@mojatatu.com>
To: Paul Moses <p@1g4.org>, netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v3 3/7] net/sched: act_gate: build schedule and RCU-swap
Date: Wed, 21 Jan 2026 16:43:16 -0300	[thread overview]
Message-ID: <cab42321-cc54-4599-aaee-c631082f936c@mojatatu.com> (raw)
In-Reply-To: <20260121131954.2710459-4-p@1g4.org>

On 21/01/2026 10:20, Paul Moses wrote:
> 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

  reply	other threads:[~2026-01-21 19:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 13:20 [PATCH net v3 0/7] net/sched: act_gate RCU schedule update fixes Paul Moses
2026-01-21 13:20 ` [PATCH net v3 1/7] net/sched: act_gate: zero-initialize netlink dump struct Paul Moses
2026-01-21 13:25   ` Eric Dumazet
2026-01-21 13:39     ` Paul Moses
2026-01-21 13:48       ` Eric Dumazet
2026-01-21 14:01         ` Paul Moses
2026-01-21 14:03           ` Eric Dumazet
2026-01-21 15:26             ` Paul Moses
2026-01-21 15:46               ` Eric Dumazet
2026-01-21 13:20 ` [PATCH net v3 2/7] net/sched: act_gate: add RCU support for parameter update Paul Moses
2026-01-21 19:42   ` Victor Nogueira
2026-01-22 15:51     ` Paul Moses
2026-01-21 13:20 ` [PATCH net v3 3/7] net/sched: act_gate: build schedule and RCU-swap Paul Moses
2026-01-21 19:43   ` Victor Nogueira [this message]
2026-01-21 13:20 ` [PATCH net v3 4/7] net/sched: act_gate: read schedule via RCU Paul Moses
2026-01-21 19:44   ` Victor Nogueira
2026-01-21 13:20 ` [PATCH net v3 5/7] net/sched: act_gate: cancel timer outside tcf_lock Paul Moses
2026-01-21 13:20 ` [PATCH net v3 6/7] net/sched: act_gate: reject empty schedule list Paul Moses
2026-01-21 19:44   ` Victor Nogueira
2026-01-21 21:48     ` Victor Nogueira
2026-01-26  8:53       ` Paul Moses
2026-01-26 12:05         ` Victor Nogueira
2026-01-31 15:00           ` Paul Moses
2026-02-02 12:44             ` Victor Nogueira
2026-01-21 13:21 ` [PATCH net v3 7/7] net/sched: act_gate: guard NULL params in accessors Paul Moses
2026-01-21 19:47   ` Victor Nogueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cab42321-cc54-4599-aaee-c631082f936c@mojatatu.com \
    --to=victor@mojatatu.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p@1g4.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®