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 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev