[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <08200104-eda5-47f5-9538-b0be2b7fe1fc@ovn.org>
Date: Thu, 26 Jun 2025 19:16:26 +0200
From: Ilya Maximets <i.maximets@....org>
To: lihuawei <lihuawei_zzu@....com>
Cc: i.maximets@....org, davem@...emloft.net, netdev@...r.kernel.org,
edumazet@...gle.com, pabeni@...hat.com, kuba@...nel.org,
xiangxia.m.yue@...il.com
Subject: Re: net: openvswitch: incorrect usage in ovs_meters_exit?
On 6/26/25 2:59 PM, lihuawei wrote:
> hi, guys,
>
> Recently, I am working on ovs meter.c, after reading the code, I have two questions about the ovs_meters_exit function as bellow :
>
> void ovs_meters_exit(struct datapath *dp)
> {
> struct dp_meter_table *tbl = &dp->meter_tbl;
> struct dp_meter_instance *ti = rcu_dereference_raw(tbl->ti);
> int i;
>
> for (i = 0; i < ti->n_meters; i++)
> ovs_meter_free(rcu_dereference_raw(ti->dp_meters[i]));
>
> dp_meter_instance_free(ti);
> }
>
> 1. why use rcu_dereference_raw here and not rcu_dereference_ovsl?
> 2. why use dp_meter_instance_free here and not dp_meter_instance_free_rcu?
Hi. AFAICT, the ovs_meters_exit() is called only from two places:
1. As a cleanup for the datapath that we failed to fully allocate.
2. From the RCU-postponed destroy_dp_rcu() when the datapath is
being destroyed.
In both cases there should be no users of this datapath at the time
this function is called, so it doesn't make a lot of sense to hold
the lock or postpone the destruction of these internal fields again.
Half of the datapath structure is already freed here. So, unless
I'm missing something, we can just free the meters directly as well.
Best regards, Ilya Maximets.
Powered by blists - more mailing lists