[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7i2JHiKX6rggsUz@LQ3V64L9R2>
Date: Fri, 21 Feb 2025 12:21:40 -0500
From: Joe Damato <jdamato@...tly.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Andrew Lunn <andrew+netdev@...n.ch>,
Eric Dumazet <edumazet@...gle.com>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Leon Romanovsky <leon@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Saeed Mahameed <saeedm@...dia.com>, Simon Horman <horms@...nel.org>,
Tariq Toukan <tariqt@...dia.com>,
Thomas Gleixner <tglx@...utronix.de>,
Yunsheng Lin <linyunsheng@...wei.com>
Subject: Re: [PATCH net-next 1/2] page_pool: Convert page_pool_recycle_stats
to u64_stats_t.
On Fri, Feb 21, 2025 at 12:52:20PM +0100, Sebastian Andrzej Siewior wrote:
> Using u64 for statistics can lead to inconsistency on 32bit because an
> update and a read requires to access two 32bit values.
> This can be avoided by using u64_stats_t for the counters and
> u64_stats_sync for the required synchronisation on 32bit platforms. The
> synchronisation is a NOP on 64bit architectures.
As mentioned in my response to the cover letter, I'd want to see
before/after 32bit assembly to ensure that this assertion is
correct.
[...]
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
> index 611ec4b6f3709..baff961970f25 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
> @@ -501,7 +501,7 @@ static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
> {
> struct mlx5e_rq_stats *rq_stats = c->rq.stats;
> struct page_pool *pool = c->rq.page_pool;
> - struct page_pool_stats stats = { 0 };
> + struct page_pool_stats stats = { };
>
> if (!page_pool_get_stats(pool, &stats))
> return;
> @@ -513,11 +513,11 @@ static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
> rq_stats->pp_alloc_waive = stats.alloc_stats.waive;
> rq_stats->pp_alloc_refill = stats.alloc_stats.refill;
>
> - rq_stats->pp_recycle_cached = stats.recycle_stats.cached;
> - rq_stats->pp_recycle_cache_full = stats.recycle_stats.cache_full;
> - rq_stats->pp_recycle_ring = stats.recycle_stats.ring;
> - rq_stats->pp_recycle_ring_full = stats.recycle_stats.ring_full;
> - rq_stats->pp_recycle_released_ref = stats.recycle_stats.released_refcnt;
> + rq_stats->pp_recycle_cached = u64_stats_read(&stats.recycle_stats.cached);
> + rq_stats->pp_recycle_cache_full = u64_stats_read(&stats.recycle_stats.cache_full);
> + rq_stats->pp_recycle_ring = u64_stats_read(&stats.recycle_stats.ring);
> + rq_stats->pp_recycle_ring_full = u64_stats_read(&stats.recycle_stats.ring_full);
> + rq_stats->pp_recycle_released_ref = u64_stats_read(&stats.recycle_stats.released_refcnt);
> }
> #else
> static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
It might be better to convert mlx5 to
page_pool_ethtool_stats_get_strings and
page_pool_ethtool_stats_get_count instead ?
Powered by blists - more mailing lists