LKML Archive on
help / color / mirror / Atom feed
From: Guangbin Huang <>
To: <>, <>, <>
Cc: <>, <>,
	<>, <>,
Subject: [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs
Date: Fri, 26 Nov 2021 20:03:17 +0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Hao Chen <>

Currently, when user queries page pool info by debugfs command
"cat page_pool_info", the cnt of allocated page for page pool may be
incorrect because of memory inconsistency problem caused by compiler

So this patch uses READ_ONCE() to read value of pages_state_hold_cnt to
fix this problem.

Fixes: 850bfb912a6d ("net: hns3: debugfs add support dumping page pool info")
Signed-off-by: Hao Chen <>
Signed-off-by: Guangbin Huang <>
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index fbb8a5f08222..081295bff765 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -1081,7 +1081,8 @@ static void hns3_dump_page_pool_info(struct hns3_enet_ring *ring,
 	u32 j = 0;
 	sprintf(result[j++], "%u", index);
-	sprintf(result[j++], "%u", ring->page_pool->pages_state_hold_cnt);
+	sprintf(result[j++], "%u",
+		READ_ONCE(ring->page_pool->pages_state_hold_cnt));
 	sprintf(result[j++], "%u",
 	sprintf(result[j++], "%u", ring->page_pool->p.pool_size);

  parent reply	other threads:[~2021-11-26 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 12:03 [PATCH net 0/4] net: hns3: add some fixes for -net Guangbin Huang
2021-11-26 12:03 ` [PATCH net 1/4] net: hns3: fix VF RSS failed problem after PF enable multi-TCs Guangbin Huang
2021-11-26 12:03 ` [PATCH net 2/4] net: hns3: add check NULL address for page pool Guangbin Huang
2021-11-26 12:03 ` Guangbin Huang [this message]
2021-11-26 12:03 ` [PATCH net 4/4] net: hns3: fix incorrect components info of ethtool --reset command Guangbin Huang
2021-11-26 19:40 ` [PATCH net 0/4] net: hns3: add some fixes for -net patchwork-bot+netdevbpf

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH net 3/4] net: hns3: fix one incorrect value of page pool info when queried by debugfs' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).