[hns-1126]net: hns3: fix GFP flag error in hclge_mac_update_stats()

Bug #1853968 reported by Fred Kimmy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kunpeng920
Fix Released
Undecided
Unassigned
Ubuntu-18.04
Invalid
Undecided
Unassigned
Ubuntu-18.04-hwe
Fix Released
Undecided
Unassigned
Ubuntu-19.04
Invalid
Undecided
Unassigned
Ubuntu-19.10
Invalid
Undecided
Unassigned
Ubuntu-20.04
Fix Released
Undecided
Unassigned
Upstream-kernel
Fix Released
Undecided
Unassigned

Bug Description

"[Bug Description]
When CONFIG_DEBUG_ATOMIC_SLEEP on, calling kzalloc with
GFP_KERNEL in hclge_mac_update_stats() will get below warning:
[ 52.514677] BUG: sleeping function called from invalid context at mm/slab.h:501
[ 52.522051] in_atomic(): 0, irqs_disabled(): 0, pid: 1015, name: ifconfig
[ 52.528827] 2 locks held by ifconfig/1015:
[ 52.532921] #0: (____ptrval____) (&p->lock){....}, at: seq_read+0x54/0x748
[ 52.539878] #1: (____ptrval____) (rcu_read_lock){....}, at: dev_seq_start+0x0/0x140
[ 52.547610] CPU: 16 PID: 1015 Comm: ifconfig Not tainted 5.3.0-rc3-00697-g20b80be #98
[ 52.555408] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B050.01 08/08/2019
[ 52.564242] Call trace:
[ 52.566687] dump_backtrace+0x0/0x1f8
[ 52.570338] show_stack+0x14/0x20
[ 52.573646] dump_stack+0xb4/0xec
[ 52.576950] ___might_sleep+0x178/0x198
[ 52.580773] __might_sleep+0x74/0xe0
[ 52.584338] __kmalloc+0x244/0x2d8
[ 52.587744] hclge_mac_update_stats+0xc8/0x1f8 [hclge]
[ 52.592870] hclge_update_stats+0xe0/0x170 [hclge]
[ 52.597651] hns3_nic_get_stats64+0xa0/0x458 [hns3]
[ 52.602514] dev_get_stats+0x58/0x138
[ 52.606165] dev_seq_printf_stats+0x8c/0x280
[ 52.610420] dev_seq_show+0x14/0x40
[ 52.613898] seq_read+0x574/0x748
[ 52.617205] proc_reg_read+0xb4/0x108
[ 52.620857] __vfs_read+0x54/0xa8
[ 52.624162] vfs_read+0xa0/0x190
[ 52.627380] ksys_read+0xc8/0x178
[ 52.630685] __arm64_sys_read+0x40/0x50
[ 52.634509] el0_svc_common.constprop.0+0x120/0x1e0
[ 52.639369] el0_svc_handler+0x50/0x90
[ 52.643106] el0_svc+0x8/0xc

[Steps to Reproduce]
1.upgrade kernel with CONFIG_DEBUG_ATOMIC_SLEEP on
2.load PF driver
3.link up port

[Actual Results]
print bug message

[Expected Results]
ok

[Reproducibility]
Inevitably

[Additional information]
Hardware: D06
Firmware: NA
Kernel: NA

[Resolution]
This patch uses GFP_ATOMIC instead of GFP_KERNEL to fix it."

net: hns3: fix GFP flag error in hclge_mac_update_stats()
net: hns3: add statistics for PFC frames and MAC control frames

Revision history for this message
dann frazier (dannf) wrote :

From what I can tell, the following patch *introduced* the BUG():
  net: hns3: add statistics for PFC frames and MAC control frames
And the following patch fixes it:
  net: hns3: fix GFP flag error in hclge_mac_update_stats()

Both patches landed in v5.4. As long as we do not backport the first patch, we do not require the second.

Changed in kunpeng920:
status: New → Triaged
dann frazier (dannf)
Changed in kunpeng920:
status: Triaged → Fix Committed
Ike Panhc (ikepanhc)
Changed in kunpeng920:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.