All of lore.kernel.org
 help / color / mirror / Atom feed
* Questioning requirement for ASSERT_RTNL in indirect code
@ 2021-09-14  6:05 Eli Cohen
  2021-09-14 14:26 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Cohen @ 2021-09-14  6:05 UTC (permalink / raw)
  To: john.hurley, sriharsha.basavapatna, ozsh, netdev

Hi,

I see the same assert and the same comment, "All callback list access
should be protected by RTNL.", in the following locations

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:1873
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c:303
drivers/net/ethernet/netronome/nfp/flower/offload.c:1770

I assume the source of this comment is the same. Can you guys explain
why is this necessary?

Currently, with
74fc4f828769 ("net: Fix offloading indirect devices dependency on qdisc order creation"

the assert will emit a warning into dmesg with no other noticable
effect. I am thinking maybe we need to remove this assert.

Comments?

- Eli


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Questioning requirement for ASSERT_RTNL in indirect code
  2021-09-14  6:05 Questioning requirement for ASSERT_RTNL in indirect code Eli Cohen
@ 2021-09-14 14:26 ` Jakub Kicinski
  2021-09-14 14:54   ` Eli Cohen
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2021-09-14 14:26 UTC (permalink / raw)
  To: Eli Cohen; +Cc: john.hurley, sriharsha.basavapatna, ozsh, netdev

On Tue, 14 Sep 2021 09:05:00 +0300 Eli Cohen wrote:
> I see the same assert and the same comment, "All callback list access
> should be protected by RTNL.", in the following locations
> 
> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:1873
> drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c:303
> drivers/net/ethernet/netronome/nfp/flower/offload.c:1770
> 
> I assume the source of this comment is the same. Can you guys explain
> why is this necessary?

Because most drivers (all but mlx5?) depend on rtnl_lock for
serializing tc offload operations.

> Currently, with
> 74fc4f828769 ("net: Fix offloading indirect devices dependency on qdisc order creation"
> 
> the assert will emit a warning into dmesg with no other noticable
> effect. I am thinking maybe we need to remove this assert.
> 
> Comments?

rtnl_lock must be held unless unlocked_driver_cb is set.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Questioning requirement for ASSERT_RTNL in indirect code
  2021-09-14 14:26 ` Jakub Kicinski
@ 2021-09-14 14:54   ` Eli Cohen
  2021-09-14 15:07     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Cohen @ 2021-09-14 14:54 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: john.hurley, sriharsha.basavapatna, ozsh, netdev

On Tue, Sep 14, 2021 at 07:26:29AM -0700, Jakub Kicinski wrote:
> On Tue, 14 Sep 2021 09:05:00 +0300 Eli Cohen wrote:
> > I see the same assert and the same comment, "All callback list access
> > should be protected by RTNL.", in the following locations
> > 
> > drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:1873
> > drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c:303
> > drivers/net/ethernet/netronome/nfp/flower/offload.c:1770
> > 
> > I assume the source of this comment is the same. Can you guys explain
> > why is this necessary?
> 
> Because most drivers (all but mlx5?) depend on rtnl_lock for
> serializing tc offload operations.
> 

But the assert I am referring to is called as part of setting up the
callback that will be used for offload operations, e.g. for adding a new
filter with tc. It's not the actual filter insetion code.

And as far as I can see this call sequence is already serialized by
flow_indr_block_lock.

> > Currently, with
> > 74fc4f828769 ("net: Fix offloading indirect devices dependency on qdisc order creation"
> > 
> > the assert will emit a warning into dmesg with no other noticable
> > effect. I am thinking maybe we need to remove this assert.
> > 
> > Comments?
> 
> rtnl_lock must be held unless unlocked_driver_cb is set.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Questioning requirement for ASSERT_RTNL in indirect code
  2021-09-14 14:54   ` Eli Cohen
@ 2021-09-14 15:07     ` Jakub Kicinski
  2021-09-14 16:32       ` Eli Cohen
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2021-09-14 15:07 UTC (permalink / raw)
  To: Eli Cohen; +Cc: john.hurley, sriharsha.basavapatna, ozsh, netdev

On Tue, 14 Sep 2021 17:54:39 +0300 Eli Cohen wrote:
> On Tue, Sep 14, 2021 at 07:26:29AM -0700, Jakub Kicinski wrote:
> > On Tue, 14 Sep 2021 09:05:00 +0300 Eli Cohen wrote:  
> > > I see the same assert and the same comment, "All callback list access
> > > should be protected by RTNL.", in the following locations
> > > 
> > > drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:1873
> > > drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c:303
> > > drivers/net/ethernet/netronome/nfp/flower/offload.c:1770
> > > 
> > > I assume the source of this comment is the same. Can you guys explain
> > > why is this necessary?  
> > 
> > Because most drivers (all but mlx5?) depend on rtnl_lock for
> > serializing tc offload operations.
> >   
> 
> But the assert I am referring to is called as part of setting up the
> callback that will be used for offload operations, e.g. for adding a new
> filter with tc. It's not the actual filter insetion code.
> 
> And as far as I can see this call sequence is already serialized by
> flow_indr_block_lock.

Hm, indeed, should've looked at the code. There doesn't seem to be
anything on the driver side this is protecting. The assert was added
before the flow/nftables rewrite of the infra, perhaps that's the
answer. IOW the lock did not exist back then.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Questioning requirement for ASSERT_RTNL in indirect code
  2021-09-14 15:07     ` Jakub Kicinski
@ 2021-09-14 16:32       ` Eli Cohen
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Cohen @ 2021-09-14 16:32 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: john.hurley, sriharsha.basavapatna, ozsh, netdev

On Tue, Sep 14, 2021 at 08:07:46AM -0700, Jakub Kicinski wrote:
> On Tue, 14 Sep 2021 17:54:39 +0300 Eli Cohen wrote:
> > On Tue, Sep 14, 2021 at 07:26:29AM -0700, Jakub Kicinski wrote:
> > > On Tue, 14 Sep 2021 09:05:00 +0300 Eli Cohen wrote:  
> > > > I see the same assert and the same comment, "All callback list access
> > > > should be protected by RTNL.", in the following locations
> > > > 
> > > > drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:1873
> > > > drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c:303
> > > > drivers/net/ethernet/netronome/nfp/flower/offload.c:1770
> > > > 
> > > > I assume the source of this comment is the same. Can you guys explain
> > > > why is this necessary?  
> > > 
> > > Because most drivers (all but mlx5?) depend on rtnl_lock for
> > > serializing tc offload operations.
> > >   
> > 
> > But the assert I am referring to is called as part of setting up the
> > callback that will be used for offload operations, e.g. for adding a new
> > filter with tc. It's not the actual filter insetion code.
> > 
> > And as far as I can see this call sequence is already serialized by
> > flow_indr_block_lock.
> 
> Hm, indeed, should've looked at the code. There doesn't seem to be
> anything on the driver side this is protecting. The assert was added
> before the flow/nftables rewrite of the infra, perhaps that's the
> answer. IOW the lock did not exist back then.

ok, so if there are no objections by my next morning, I will post a
patch to remove these.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-14 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  6:05 Questioning requirement for ASSERT_RTNL in indirect code Eli Cohen
2021-09-14 14:26 ` Jakub Kicinski
2021-09-14 14:54   ` Eli Cohen
2021-09-14 15:07     ` Jakub Kicinski
2021-09-14 16:32       ` Eli Cohen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.