public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Damato <jdamato@fastly.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Leon Romanovsky <leon@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Simon Horman <horms@kernel.org>, Tariq Toukan <tariqt@nvidia.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yunsheng Lin <linyunsheng@huawei.com>
Subject: Re: [PATCH net-next 1/2] page_pool: Convert page_pool_recycle_stats to u64_stats_t.
Date: Fri, 21 Feb 2025 12:21:40 -0500	[thread overview]
Message-ID: <Z7i2JHiKX6rggsUz@LQ3V64L9R2> (raw)
In-Reply-To: <20250221115221.291006-2-bigeasy@linutronix.de>

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 ?

  reply	other threads:[~2025-02-21 17:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 11:52 [PATCH net-next 0/2] page_pool: Convert stats to u64_stats_t Sebastian Andrzej Siewior
2025-02-21 11:52 ` [PATCH net-next 1/2] page_pool: Convert page_pool_recycle_stats " Sebastian Andrzej Siewior
2025-02-21 17:21   ` Joe Damato [this message]
2025-02-26 12:06     ` Sebastian Andrzej Siewior
2025-02-22  8:13   ` Yunsheng Lin
2025-02-25 11:27     ` Paolo Abeni
2025-02-26  9:28     ` Sebastian Andrzej Siewior
2025-02-21 11:52 ` [PATCH net-next 2/2] page_pool: Convert page_pool_alloc_stats " Sebastian Andrzej Siewior
2025-02-21 17:30   ` Joe Damato
2025-02-22  8:13   ` Yunsheng Lin
2025-02-21 17:10 ` [PATCH net-next 0/2] page_pool: Convert stats " Joe Damato
2025-02-26 10:27   ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7i2JHiKX6rggsUz@LQ3V64L9R2 \
    --to=jdamato@fastly.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox