FAILED: patch "[PATCH] net/sched: act_gate: snapshot parameters with RCU on replace" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 62413a9c3cb183afb9bb6e94dd68caf4e4145f4c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026031253-strudel-sleet-23ef@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 62413a9c3cb183afb9bb6e94dd68caf4e4145f4c Mon Sep 17 00:00:00 2001
From: Paul Moses <[email protected]>
Date: Mon, 23 Feb 2026 15:05:44 +0000
Subject: [PATCH] net/sched: act_gate: snapshot parameters with RCU on replace
The gate action can be replaced while the hrtimer callback or dump path is walking the schedule list.
Convert the parameters to an RCU-protected snapshot and swap updates under tcf_lock, freeing the previous snapshot via call_rcu(). When REPLACE omits the entry list, preserve the existing schedule so the effective state is unchanged.
include/net/tc_act/tc_gate.h +26 -7
@@ -32,6 +32,7 @@ struct tcf_gate_params {s32 tcfg_clockid;size_t num_entries;struct list_head entries; +struct rcu_head rcu; };#define GATE_ACT_GATE_OPEN BIT(0)
@@ -39,7 +40,7 @@ struct tcf_gate_params {struct tcf_gate {struct tc_action common; -struct tcf_gate_params param; +struct tcf_gate_params __rcu *param;u8 current_gate_status;ktime_t current_close_time;u32 current_entry_octets;
@@ -51,47 +52,65 @@ struct tcf_gate {#define to_gate (a) ((struct tcf_gate *)a) +static inline struct tcf_gate_params *tcf_gate_params_locked (const struct tc_action *a) +{ +struct tcf_gate *gact =to_gate (a); + +return rcu_dereference_protected (gact->param, +lockdep_is_held (&gact->tcf_lock)); +} +static inline s32 tcf_gate_prio (const struct tc_action *a) { +struct tcf_gate_params *p;s32 tcfg_prio; - tcfg_prio =to_gate (a)->param.tcfg_priority; + p =tcf_gate_params_locked (a); + tcfg_prio = p->tcfg_priority;return tcfg_prio; }static inline u64 tcf_gate_basetime (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_basetime; - tcfg_basetime =to_gate (a)->param.tcfg_basetime; + p =tcf_gate_params_locked (a); + tcfg_basetime = p->tcfg_basetime;return tcfg_basetime; }static inline u64 tcf_gate_cycletime (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_cycletime; - tcfg_cycletime =to_gate (a)->param.tcfg_cycletime; + p =tcf_gate_params_locked (a); + tcfg_cycletime = p->tcfg_cycletime;return tcfg_cycletime; }static inline u64 tcf_gate_cycletimeext (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_cycletimeext; - tcfg_cycletimeext =to_gate (a)->param.tcfg_cycletime_ext; + p =tcf_gate_params_locked (a); + tcfg_cycletimeext = p->tcfg_cycletime_ext;return tcfg_cycletimeext; }static inline u32 tcf_gate_num_entries (const struct tc_action *a) { +struct tcf_gate_params *p;u32 num_entries; - num_entries =to_gate (a)->param.num_entries; + p =tcf_gate_params_locked (a); + num_entries = p->num_entries;return num_entries; }
@@ -105,7 +124,7 @@ static inline struct action_gate_entryu32 num_entries;int i =0 ; - p = &to_gate (a)->param; + p =tcf_gate_params_locked (a); num_entries = p->num_entries;list_for_each_entry (entry, &p->entries, list)
net/sched/act_gate.c +187 -80
386 lines not on this page · raw message
Sasha Levin
maintainerPATCH 1/1 net/sched: act_gate: snapshot parameters with RCU on replace
From: Paul Moses <[email protected]>
[ Upstream commit 62413a9c3cb183afb9bb6e94dd68caf4e4145f4c ]
The gate action can be replaced while the hrtimer callback or dump path is walking the schedule list.
Convert the parameters to an RCU-protected snapshot and swap updates under tcf_lock, freeing the previous snapshot via call_rcu(). When REPLACE omits the entry list, preserve the existing schedule so the effective state is unchanged.
--- include/net/tc_act/tc_gate.h | 33 ++++- net/sched/act_gate.c | 262 ++++++++++++++++++++++++----------- 2 files changed, 210 insertions(+), 85 deletions(-)
include/net/tc_act/tc_gate.h +26 -7
@@ -32,6 +32,7 @@ struct tcf_gate_params {s32 tcfg_clockid;size_t num_entries;struct list_head entries; +struct rcu_head rcu; };#define GATE_ACT_GATE_OPEN BIT(0)
@@ -39,7 +40,7 @@ struct tcf_gate_params {struct tcf_gate {struct tc_action common; -struct tcf_gate_params param; +struct tcf_gate_params __rcu *param;u8 current_gate_status;ktime_t current_close_time;u32 current_entry_octets;
@@ -60,47 +61,65 @@ static inline bool is_tcf_gate(const struct tc_action *a)return false; } +static inline struct tcf_gate_params *tcf_gate_params_locked (const struct tc_action *a) +{ +struct tcf_gate *gact =to_gate (a); + +return rcu_dereference_protected (gact->param, +lockdep_is_held (&gact->tcf_lock)); +} +static inline s32 tcf_gate_prio (const struct tc_action *a) { +struct tcf_gate_params *p;s32 tcfg_prio; - tcfg_prio =to_gate (a)->param.tcfg_priority; + p =tcf_gate_params_locked (a); + tcfg_prio = p->tcfg_priority;return tcfg_prio; }static inline u64 tcf_gate_basetime (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_basetime; - tcfg_basetime =to_gate (a)->param.tcfg_basetime; + p =tcf_gate_params_locked (a); + tcfg_basetime = p->tcfg_basetime;return tcfg_basetime; }static inline u64 tcf_gate_cycletime (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_cycletime; - tcfg_cycletime =to_gate (a)->param.tcfg_cycletime; + p =tcf_gate_params_locked (a); + tcfg_cycletime = p->tcfg_cycletime;return tcfg_cycletime; }static inline u64 tcf_gate_cycletimeext (const struct tc_action *a) { +struct tcf_gate_params *p;u64 tcfg_cycletimeext; - tcfg_cycletimeext =to_gate (a)->param.tcfg_cycletime_ext; + p =tcf_gate_params_locked (a); + tcfg_cycletimeext = p->tcfg_cycletime_ext;return tcfg_cycletimeext; }static inline u32 tcf_gate_num_entries (const struct tc_action *a) { +struct tcf_gate_params *p;u32 num_entries; - num_entries =to_gate (a)->param.num_entries; + p =tcf_gate_params_locked (a); + num_entries = p->num_entries;return num_entries; }
@@ -114,7 +133,7 @@ static inline struct action_gate_entryu32 num_entries;int i =0 ; - p = &to_gate (a)->param; + p =tcf_gate_params_locked (a); num_entries = p->num_entries;list_for_each_entry (entry, &p->entries, list)
net/sched/act_gate.c +184 -78
382 lines not on this page · raw message
Signature · 1 line
2.51.0