[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94076638-1bc7-4408-b09c-7c51f995d36f@redhat.com>
Date: Thu, 17 Apr 2025 11:48:03 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
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 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.
Thanks,
Paolo
Powered by blists - more mailing lists