From: Vladimir Oltean <[email protected]>
[ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
Since the writer-side lock is taken here, we do not need to open an RCU
read-side critical section, instead we can use rtnl_dereference() to
tell lockdep we are serialized with concurrent writes.
Signed-off-by: Vladimir Oltean <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
net/sched/sch_taprio.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index ab8835a72cee..d70a5c4aafe5 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1480,10 +1480,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
}
INIT_LIST_HEAD(&new_admin->entries);
- rcu_read_lock();
- oper = rcu_dereference(q->oper_sched);
- admin = rcu_dereference(q->admin_sched);
- rcu_read_unlock();
+ oper = rtnl_dereference(q->oper_sched);
+ admin = rtnl_dereference(q->admin_sched);
/* no changes - no new mqprio settings */
if (!taprio_mqprio_cmp(dev, mqprio))
@@ -1843,9 +1841,8 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
struct nlattr *nest, *sched_nest;
unsigned int i;
- rcu_read_lock();
- oper = rcu_dereference(q->oper_sched);
- admin = rcu_dereference(q->admin_sched);
+ oper = rtnl_dereference(q->oper_sched);
+ admin = rtnl_dereference(q->admin_sched);
opt.num_tc = netdev_get_num_tc(dev);
memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map));
@@ -1889,8 +1886,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
nla_nest_end(skb, sched_nest);
done:
- rcu_read_unlock();
-
return nla_nest_end(skb, nest);
admin_error:
@@ -1900,7 +1895,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
nla_nest_cancel(skb, nest);
start_error:
- rcu_read_unlock();
return -ENOSPC;
}
--
2.35.1
On Sun, Oct 09, 2022 at 06:21:16PM -0400, Sasha Levin wrote:
> From: Vladimir Oltean <[email protected]>
>
> [ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
>
> Since the writer-side lock is taken here, we do not need to open an RCU
> read-side critical section, instead we can use rtnl_dereference() to
> tell lockdep we are serialized with concurrent writes.
>
> Signed-off-by: Vladimir Oltean <[email protected]>
> Signed-off-by: Jakub Kicinski <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
Not needed for stable kernels, please drop, thanks.
On Tue, Oct 18, 2022 at 11:44:15AM +0200, Pavel Machek wrote:
> Hi!
>
> > From: Vladimir Oltean <[email protected]>
> >
> > [ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
> >
> > Since the writer-side lock is taken here, we do not need to open an RCU
> > read-side critical section, instead we can use rtnl_dereference() to
> > tell lockdep we are serialized with concurrent writes.
>
> This is cleanup, not a bugfix. We should not have it in 5.10.
Agreed, looks like I missed this one when replying to Sasha for all the others.
On Tue, Oct 18, 2022 at 12:46:53PM +0300, Vladimir Oltean wrote:
> On Tue, Oct 18, 2022 at 11:44:15AM +0200, Pavel Machek wrote:
> > Hi!
> >
> > > From: Vladimir Oltean <[email protected]>
> > >
> > > [ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
> > >
> > > Since the writer-side lock is taken here, we do not need to open an RCU
> > > read-side critical section, instead we can use rtnl_dereference() to
> > > tell lockdep we are serialized with concurrent writes.
> >
> > This is cleanup, not a bugfix. We should not have it in 5.10.
>
> Agreed, looks like I missed this one when replying to Sasha for all the others.
Ah, I do see that I did in fact respond to this already.
https://lore.kernel.org/lkml/20221010133337.4q75fsa6m2v5ttk7@skbuf/
Not sure how you put your eyes on this particular patch?
Hi!
> From: Vladimir Oltean <[email protected]>
>
> [ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
>
> Since the writer-side lock is taken here, we do not need to open an RCU
> read-side critical section, instead we can use rtnl_dereference() to
> tell lockdep we are serialized with concurrent writes.
This is cleanup, not a bugfix. We should not have it in 5.10.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany