On 1/23/26 5:21 PM, David Yang wrote:
> On 64bit arches, struct u64_stats_sync is empty and provides no help
> against load/store tearing. struct copying should not be considered
> tear-free. Use u64_stats_reads() instead.
> 
> Signed-off-by: David Yang <[email protected]>
> ---
>  net/openvswitch/datapath.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index d5b6e2002bc1..8ba94df7f942 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -770,7 +770,8 @@ static void get_dp_stats(const struct datapath *dp, 
> struct ovs_dp_stats *stats,
>  
>               do {
>                       start = u64_stats_fetch_begin(&percpu_stats->syncp);
> -                     local_stats = *percpu_stats;
> +                     u64_stats_reads(&local_stats, percpu_stats,
> +                                     sizeof(local_stats));

I suppose, you'll either need to use offset of 'syncp' field here,
or copy fields one by one, which is not great.

Best regards, Ilya Maximets.

>               } while (u64_stats_fetch_retry(&percpu_stats->syncp, start));
>  
>               stats->n_hit += local_stats.n_hit;

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to