Skip to content

Commit 9c14791

Browse files
Hao Chenkuba-moo
authored andcommitted
net: hns3: fix one incorrect value of page pool info when queried by debugfs
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 optimization. So this patch uses READ_ONCE() to read value of pages_state_hold_cnt to fix this problem. Fixes: 850bfb9 ("net: hns3: debugfs add support dumping page pool info") Signed-off-by: Hao Chen <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b8af344 commit 9c14791

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,8 @@ static void hns3_dump_page_pool_info(struct hns3_enet_ring *ring,
10811081
u32 j = 0;
10821082

10831083
sprintf(result[j++], "%u", index);
1084-
sprintf(result[j++], "%u", ring->page_pool->pages_state_hold_cnt);
1084+
sprintf(result[j++], "%u",
1085+
READ_ONCE(ring->page_pool->pages_state_hold_cnt));
10851086
sprintf(result[j++], "%u",
10861087
atomic_read(&ring->page_pool->pages_state_release_cnt));
10871088
sprintf(result[j++], "%u", ring->page_pool->p.pool_size);

0 commit comments

Comments
 (0)