[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250417101820.Cd0BZc0G@linutronix.de>
Date: Thu, 17 Apr 2025 12:18:20 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Aaron Conole <aconole@...hat.com>, netdev@...r.kernel.org,
linux-rt-devel@...ts.linux.dev,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Eelco Chaudron <echaudro@...hat.com>,
Ilya Maximets <i.maximets@....org>, dev@...nvswitch.org
Subject: Re: [PATCH net-next v2 12/18] openvswitch: Move
ovs_frag_data_storage into the struct ovs_pcpu_storage
On 2025-04-17 11:48:03 [+0200], Paolo Abeni wrote:
>
>
> On 4/17/25 11:08 AM, Sebastian Andrzej Siewior wrote:
> > On 2025-04-17 10:01:17 [+0200], Paolo Abeni wrote:
> >> @Sebastian: I think the 'owner' assignment could be optimized out at
> >> compile time for non RT build - will likely not matter for performances,
> >> but I think it will be 'nicer', could you please update the patches to
> >> do that?
> >
> > If we don't assign the `owner' then we can't use the lock even on !RT
> > because lockdep should complain. What about this then:
> >
> > diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> > index a3989d450a67f..b8f766978466d 100644
> > --- a/net/openvswitch/datapath.c
> > +++ b/net/openvswitch/datapath.c
> > @@ -294,8 +294,11 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
> > sf_acts = rcu_dereference(flow->sf_acts);
> > /* This path can be invoked recursively: Use the current task to
> > * identify recursive invocation - the lock must be acquired only once.
> > + * Even with disabled bottom halves this can be preempted on PREEMPT_RT.
> > + * Limit the provecc to RT to avoid assigning `owner' if it can be
> > + * avoided.
> > */
> > - if (ovs_pcpu->owner != current) {
> > + if (IS_ENABLED(CONFIG_PREEMPT_RT) && ovs_pcpu->owner != current) {
> > local_lock_nested_bh(&ovs_pcpu_storage.bh_lock);
> > ovs_pcpu->owner = current;
> > ovs_pcpu_locked = true;
> > @@ -687,9 +690,11 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
> >
> > local_bh_disable();
> > local_lock_nested_bh(&ovs_pcpu_storage.bh_lock);
> > - this_cpu_write(ovs_pcpu_storage.owner, current);
> > + if (IS_ENABLED(CONFIG_PREEMPT_RT))
> > + this_cpu_write(ovs_pcpu_storage.owner, current);
>
> Perhaps implement the above 2 lines in an helper, to keep the code tidy?
> otherwise LGTM.
I've been thinking about it but the two cases are slightly different.
Maybe open coding right next to the comment isn't that bad.
> Thanks,
>
> Paolo
Sebastian
Powered by blists - more mailing lists