netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH,net-next,v2][resend] virtio_net: Remove u64_stats_update_begin()/end() for stats fetch
@ 2024-06-25  1:34 Li RongQing
  2024-06-25 23:47 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2024-06-25  1:34 UTC (permalink / raw)
  To: netdev; +Cc: Li RongQing

This place is fetching the stats, u64_stats_update_begin()/end()
should not be used, and the fetcher of stats is in the same context
as the updater of the stats, so don't need any protection

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/virtio_net.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index b1f8b72..f212977 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2382,12 +2382,13 @@ static void virtnet_rx_dim_update(struct virtnet_info *vi, struct receive_queue
 	if (!rq->packets_in_napi)
 		return;
 
-	u64_stats_update_begin(&rq->stats.syncp);
+	/* Don't need protection when fetching stats, since fetcher and
+	 * updater of the stats are in same context
+	 */
 	dim_update_sample(rq->calls,
 			  u64_stats_read(&rq->stats.packets),
 			  u64_stats_read(&rq->stats.bytes),
 			  &cur_sample);
-	u64_stats_update_end(&rq->stats.syncp);
 
 	net_dim(&rq->dim, cur_sample);
 	rq->packets_in_napi = 0;
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH,net-next,v2][resend] virtio_net: Remove u64_stats_update_begin()/end() for stats fetch
  2024-06-25  1:34 [PATCH,net-next,v2][resend] virtio_net: Remove u64_stats_update_begin()/end() for stats fetch Li RongQing
@ 2024-06-25 23:47 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-06-25 23:47 UTC (permalink / raw)
  To: Li RongQing; +Cc: netdev

On Tue, 25 Jun 2024 09:34:07 +0800 Li RongQing wrote:
> This place is fetching the stats, u64_stats_update_begin()/end()
> should not be used, and the fetcher of stats is in the same context
> as the updater of the stats, so don't need any protection
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-25 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25  1:34 [PATCH,net-next,v2][resend] virtio_net: Remove u64_stats_update_begin()/end() for stats fetch Li RongQing
2024-06-25 23:47 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).