mirror_ubuntu-kernels/drivers/net/ethernet/qlogic/qed
Manish Chopra 42510dffd0 qed/qede: Fix scheduling while atomic
Statistics read through bond interface via sysfs causes
below bug and traces as it triggers the bonding module to
collect the slave device statistics while holding the spinlock,
beneath that qede->qed driver statistics flow gets scheduled out
due to usleep_range() used in PTT acquire logic

[ 3673.988874] Hardware name: HPE ProLiant DL365 Gen10 Plus/ProLiant DL365 Gen10 Plus, BIOS A42 10/29/2021
[ 3673.988878] Call Trace:
[ 3673.988891]  dump_stack_lvl+0x34/0x44
[ 3673.988908]  __schedule_bug.cold+0x47/0x53
[ 3673.988918]  __schedule+0x3fb/0x560
[ 3673.988929]  schedule+0x43/0xb0
[ 3673.988932]  schedule_hrtimeout_range_clock+0xbf/0x1b0
[ 3673.988937]  ? __hrtimer_init+0xc0/0xc0
[ 3673.988950]  usleep_range+0x5e/0x80
[ 3673.988955]  qed_ptt_acquire+0x2b/0xd0 [qed]
[ 3673.988981]  _qed_get_vport_stats+0x141/0x240 [qed]
[ 3673.989001]  qed_get_vport_stats+0x18/0x80 [qed]
[ 3673.989016]  qede_fill_by_demand_stats+0x37/0x400 [qede]
[ 3673.989028]  qede_get_stats64+0x19/0xe0 [qede]
[ 3673.989034]  dev_get_stats+0x5c/0xc0
[ 3673.989045]  netstat_show.constprop.0+0x52/0xb0
[ 3673.989055]  dev_attr_show+0x19/0x40
[ 3673.989065]  sysfs_kf_seq_show+0x9b/0xf0
[ 3673.989076]  seq_read_iter+0x120/0x4b0
[ 3673.989087]  new_sync_read+0x118/0x1a0
[ 3673.989095]  vfs_read+0xf3/0x180
[ 3673.989099]  ksys_read+0x5f/0xe0
[ 3673.989102]  do_syscall_64+0x3b/0x90
[ 3673.989109]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 3673.989115] RIP: 0033:0x7f8467d0b082
[ 3673.989119] Code: c0 e9 b2 fe ff ff 50 48 8d 3d ca 05 08 00 e8 35 e7 01 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24
[ 3673.989121] RSP: 002b:00007ffffb21fd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[ 3673.989127] RAX: ffffffffffffffda RBX: 000000000100eca0 RCX: 00007f8467d0b082
[ 3673.989128] RDX: 00000000000003ff RSI: 00007ffffb21fdc0 RDI: 0000000000000003
[ 3673.989130] RBP: 00007f8467b96028 R08: 0000000000000010 R09: 00007ffffb21ec00
[ 3673.989132] R10: 00007ffffb27b170 R11: 0000000000000246 R12: 00000000000000f0
[ 3673.989134] R13: 0000000000000003 R14: 00007f8467b92000 R15: 0000000000045a05
[ 3673.989139] CPU: 30 PID: 285188 Comm: read_all Kdump: loaded Tainted: G        W  OE

Fix this by collecting the statistics asynchronously from a periodic
delayed work scheduled at default stats coalescing interval and return
the recent copy of statisitcs from .ndo_get_stats64(), also add ability
to configure/retrieve stats coalescing interval using below commands -

ethtool -C ethx stats-block-usecs <val>
ethtool -c ethx

Fixes: 133fac0eed ("qede: Add basic ethtool support")
Cc: Sudarsana Kalluru <skalluru@marvell.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Manish Chopra <manishc@marvell.com>
Link: https://lore.kernel.org/r/20230605112600.48238-1-manishc@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-06-06 13:56:18 +02:00
..
Makefile qed: Remove IP services API. 2022-04-22 15:15:23 -07:00
qed_chain.c
qed_cxt.c
qed_cxt.h
qed_dbg_hsi.h qed: fix typos in comments 2022-05-22 20:44:30 +01:00
qed_dcbx.c
qed_dcbx.h
qed_debug.c qed: allow sleep in qed_mcp_trace_dump() 2023-01-04 20:32:56 -08:00
qed_debug.h
qed_dev_api.h
qed_dev.c qed/qed_dev: guard against a possible division by zero 2023-03-13 16:55:02 -07:00
qed_devlink.c qed: remove pointless call to devlink_param_driverinit_value_set() 2023-01-27 12:32:02 +00:00
qed_devlink.h
qed_fcoe.c
qed_fcoe.h
qed_hsi.h
qed_hw.c
qed_hw.h
qed_init_fw_funcs.c
qed_init_ops.c
qed_init_ops.h
qed_int.c net: ethernet: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:26 -07:00
qed_int.h
qed_iro_hsi.h
qed_iscsi.c
qed_iscsi.h
qed_iwarp.c
qed_iwarp.h
qed_l2.c qed/qede: Fix scheduling while atomic 2023-06-06 13:56:18 +02:00
qed_l2.h
qed_ll2.c qed: remove unused num_ooo_add_to_peninsula variable 2023-03-27 19:43:45 -07:00
qed_ll2.h
qed_main.c qed: Drop redundant pci_enable_pcie_error_reporting() 2023-03-08 23:34:38 -08:00
qed_mcp.c qed: avoid defines prefixed with CONFIG 2022-11-25 08:13:09 +00:00
qed_mcp.h
qed_mfw_hsi.h
qed_mng_tlv.c qed/qed_mng_tlv: correctly zero out ->min instead of ->hour 2023-03-16 21:08:36 -07:00
qed_nvmetcp_fw_funcs.c
qed_nvmetcp_fw_funcs.h
qed_nvmetcp.c
qed_nvmetcp.h
qed_ooo.c
qed_ooo.h
qed_ptp.c
qed_ptp.h
qed_rdma.c qed: Use bitmap_empty() 2022-07-06 19:55:14 -07:00
qed_rdma.h
qed_reg_addr.h
qed_roce.c qed: replace bitmap_weight with bitmap_empty in qed_roce_stop() 2022-05-02 06:30:40 -07:00
qed_roce.h
qed_selftest.c
qed_selftest.h
qed_sp_commands.c
qed_sp.h
qed_spq.c
qed_sriov.c qed/qed_sriov: guard against NULL derefs from qed_iov_get_vf_info 2023-03-19 08:40:48 +00:00
qed_sriov.h
qed_vf.c
qed_vf.h qed: fix typos in comments 2022-05-22 20:44:30 +01:00
qed.h