mbox series

[00/10] wifi: ath12k: support suspend/resume

Message ID 20240412060620.27519-1-quic_bqiang@quicinc.com (mailing list archive)
Headers show
Series wifi: ath12k: support suspend/resume | expand

Message

Baochen Qiang April 12, 2024, 6:06 a.m. UTC
Now that the MHI&QRTR patches [1] are merged, we can add
suspend/resume support for ath12k.

The whole design is quite similar to that in ath11k: firmware
is powered down when going to suspend and powered up when
resume, this makes hibernation work as well in addition to
suspend.

To summary, this series first does some preparations in the
first 8 patches. Then in patch [9/10] suspend/resume callbacks
are implemented. And at last in [10/10] we enable suspend/resume
functionality for WCN7850 because it's the only chip supporting
it for now.

[1] https://lore.kernel.org/linux-wireless/20240305021320.3367-1-quic_bqiang@quicinc.com/

Baochen Qiang (10):
  wifi: ath12k: rearrange IRQ enable/disable in reset path
  wifi: ath12k: remove MHI LOOPBACK channels
  wifi: ath12k: do not dump SRNG statistics during resume
  wifi: ath12k: fix warning on DMA ring capabilities event
  wifi: ath12k: decrease MHI channel buffer length to 8KB
  wifi: ath12k: flush all packets before suspend
  wifi: ath12k: no need to handle pktlog during suspend/resume
  wifi: ath12k: avoid stopping mac80211 queues in ath12k_core_restart()
  wifi: ath12k: support suspend/resume
  wifi: ath12k: change supports_suspend to true for WCN7850

 drivers/net/wireless/ath/ath12k/core.c  | 108 ++++++++++++++----------
 drivers/net/wireless/ath/ath12k/core.h  |   4 +
 drivers/net/wireless/ath/ath12k/dp_rx.c |  48 -----------
 drivers/net/wireless/ath/ath12k/dp_rx.h |   2 -
 drivers/net/wireless/ath/ath12k/hif.h   |  14 ++-
 drivers/net/wireless/ath/ath12k/hw.c    |   2 +-
 drivers/net/wireless/ath/ath12k/mac.c   |  28 ++++--
 drivers/net/wireless/ath/ath12k/mac.h   |   1 +
 drivers/net/wireless/ath/ath12k/mhi.c   |  91 +++++++-------------
 drivers/net/wireless/ath/ath12k/mhi.h   |   5 +-
 drivers/net/wireless/ath/ath12k/pci.c   |  41 +++++++--
 drivers/net/wireless/ath/ath12k/pci.h   |   2 +-
 drivers/net/wireless/ath/ath12k/qmi.c   |   3 +-
 drivers/net/wireless/ath/ath12k/wmi.c   |   1 +
 14 files changed, 175 insertions(+), 175 deletions(-)


base-commit: 363e7193eaf258fe7f04e8db560bd8a282a12cd9

Comments

Jeff Johnson April 12, 2024, 6:05 p.m. UTC | #1
On 4/11/2024 11:06 PM, Baochen Qiang wrote:
> Now that the MHI&QRTR patches [1] are merged, we can add
> suspend/resume support for ath12k.
> 
> The whole design is quite similar to that in ath11k: firmware
> is powered down when going to suspend and powered up when
> resume, this makes hibernation work as well in addition to
> suspend.
> 
> To summary, this series first does some preparations in the
> first 8 patches. Then in patch [9/10] suspend/resume callbacks
> are implemented. And at last in [10/10] we enable suspend/resume
> functionality for WCN7850 because it's the only chip supporting
> it for now.
> 
> [1] https://lore.kernel.org/linux-wireless/20240305021320.3367-1-quic_bqiang@quicinc.com/
> 
> Baochen Qiang (10):
>   wifi: ath12k: rearrange IRQ enable/disable in reset path
>   wifi: ath12k: remove MHI LOOPBACK channels
>   wifi: ath12k: do not dump SRNG statistics during resume
>   wifi: ath12k: fix warning on DMA ring capabilities event
>   wifi: ath12k: decrease MHI channel buffer length to 8KB
>   wifi: ath12k: flush all packets before suspend
>   wifi: ath12k: no need to handle pktlog during suspend/resume
>   wifi: ath12k: avoid stopping mac80211 queues in ath12k_core_restart()
>   wifi: ath12k: support suspend/resume
>   wifi: ath12k: change supports_suspend to true for WCN7850
> 
>  drivers/net/wireless/ath/ath12k/core.c  | 108 ++++++++++++++----------
>  drivers/net/wireless/ath/ath12k/core.h  |   4 +
>  drivers/net/wireless/ath/ath12k/dp_rx.c |  48 -----------
>  drivers/net/wireless/ath/ath12k/dp_rx.h |   2 -

My Qualcomm Innovation Center copyright checker reports:
drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024

>  drivers/net/wireless/ath/ath12k/hif.h   |  14 ++-
>  drivers/net/wireless/ath/ath12k/hw.c    |   2 +-
>  drivers/net/wireless/ath/ath12k/mac.c   |  28 ++++--
>  drivers/net/wireless/ath/ath12k/mac.h   |   1 +
>  drivers/net/wireless/ath/ath12k/mhi.c   |  91 +++++++-------------
>  drivers/net/wireless/ath/ath12k/mhi.h   |   5 +-
>  drivers/net/wireless/ath/ath12k/pci.c   |  41 +++++++--
>  drivers/net/wireless/ath/ath12k/pci.h   |   2 +-
>  drivers/net/wireless/ath/ath12k/qmi.c   |   3 +-
>  drivers/net/wireless/ath/ath12k/wmi.c   |   1 +
>  14 files changed, 175 insertions(+), 175 deletions(-)
> 
> 
> base-commit: 363e7193eaf258fe7f04e8db560bd8a282a12cd9

patch 6 of this series conflicts with:
wifi: ath12k: add support to handle beacon miss for WCN7850

So I was not able to take this series into my local verification tree

patch 7 of this series conflicts with:
wifi: ath12k: fix mac id extraction when MSDU spillover in rx error path

So this conflicts with a patch already in the pending branch

So FYI at some point you'll need to rebase.
Baochen Qiang April 15, 2024, 5:51 a.m. UTC | #2
On 4/13/2024 2:05 AM, Jeff Johnson wrote:
> On 4/11/2024 11:06 PM, Baochen Qiang wrote:
>> Now that the MHI&QRTR patches [1] are merged, we can add
>> suspend/resume support for ath12k.
>>
>> The whole design is quite similar to that in ath11k: firmware
>> is powered down when going to suspend and powered up when
>> resume, this makes hibernation work as well in addition to
>> suspend.
>>
>> To summary, this series first does some preparations in the
>> first 8 patches. Then in patch [9/10] suspend/resume callbacks
>> are implemented. And at last in [10/10] we enable suspend/resume
>> functionality for WCN7850 because it's the only chip supporting
>> it for now.
>>
>> [1] https://lore.kernel.org/linux-wireless/20240305021320.3367-1-quic_bqiang@quicinc.com/
>>
>> Baochen Qiang (10):
>>   wifi: ath12k: rearrange IRQ enable/disable in reset path
>>   wifi: ath12k: remove MHI LOOPBACK channels
>>   wifi: ath12k: do not dump SRNG statistics during resume
>>   wifi: ath12k: fix warning on DMA ring capabilities event
>>   wifi: ath12k: decrease MHI channel buffer length to 8KB
>>   wifi: ath12k: flush all packets before suspend
>>   wifi: ath12k: no need to handle pktlog during suspend/resume
>>   wifi: ath12k: avoid stopping mac80211 queues in ath12k_core_restart()
>>   wifi: ath12k: support suspend/resume
>>   wifi: ath12k: change supports_suspend to true for WCN7850
>>
>>  drivers/net/wireless/ath/ath12k/core.c  | 108 ++++++++++++++----------
>>  drivers/net/wireless/ath/ath12k/core.h  |   4 +
>>  drivers/net/wireless/ath/ath12k/dp_rx.c |  48 -----------
>>  drivers/net/wireless/ath/ath12k/dp_rx.h |   2 -
> My Qualcomm Innovation Center copyright checker reports:
> drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024
Got it.
>
>>  drivers/net/wireless/ath/ath12k/hif.h   |  14 ++-
>>  drivers/net/wireless/ath/ath12k/hw.c    |   2 +-
>>  drivers/net/wireless/ath/ath12k/mac.c   |  28 ++++--
>>  drivers/net/wireless/ath/ath12k/mac.h   |   1 +
>>  drivers/net/wireless/ath/ath12k/mhi.c   |  91 +++++++-------------
>>  drivers/net/wireless/ath/ath12k/mhi.h   |   5 +-
>>  drivers/net/wireless/ath/ath12k/pci.c   |  41 +++++++--
>>  drivers/net/wireless/ath/ath12k/pci.h   |   2 +-
>>  drivers/net/wireless/ath/ath12k/qmi.c   |   3 +-
>>  drivers/net/wireless/ath/ath12k/wmi.c   |   1 +
>>  14 files changed, 175 insertions(+), 175 deletions(-)
>>
>>
>> base-commit: 363e7193eaf258fe7f04e8db560bd8a282a12cd9
> patch 6 of this series conflicts with:
> wifi: ath12k: add support to handle beacon miss for WCN7850
>
> So I was not able to take this series into my local verification tree
>
> patch 7 of this series conflicts with:
> wifi: ath12k: fix mac id extraction when MSDU spillover in rx error path
>
> So this conflicts with a patch already in the pending branch
>
> So FYI at some point you'll need to rebase.

So I should rebase after these two patches got merged in master branch?
Kalle Valo April 16, 2024, 8:28 a.m. UTC | #3
Baochen Qiang <quic_bqiang@quicinc.com> writes:

>> patch 6 of this series conflicts with:
>> wifi: ath12k: add support to handle beacon miss for WCN7850
>>
>> So I was not able to take this series into my local verification tree
>>
>> patch 7 of this series conflicts with:
>> wifi: ath12k: fix mac id extraction when MSDU spillover in rx error path
>>
>> So this conflicts with a patch already in the pending branch
>>
>> So FYI at some point you'll need to rebase.
>
> So I should rebase after these two patches got merged in master branch?

No need to rebase at this time. In the pending branch I was able to fix
the conflict in patch 7. Please check:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=b92086862c7be6e6810eca204052cada50fc0f5f
Baochen Qiang April 16, 2024, 10:31 a.m. UTC | #4
On 4/16/2024 4:28 PM, Kalle Valo wrote:
> Baochen Qiang <quic_bqiang@quicinc.com> writes:
>
>>> patch 6 of this series conflicts with:
>>> wifi: ath12k: add support to handle beacon miss for WCN7850
>>>
>>> So I was not able to take this series into my local verification tree
>>>
>>> patch 7 of this series conflicts with:
>>> wifi: ath12k: fix mac id extraction when MSDU spillover in rx error path
>>>
>>> So this conflicts with a patch already in the pending branch
>>>
>>> So FYI at some point you'll need to rebase.
>> So I should rebase after these two patches got merged in master branch?
> No need to rebase at this time. In the pending branch I was able to fix
> the conflict in patch 7. Please check:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=b92086862c7be6e6810eca204052cada50fc0f5f
Thanks and LGTM.
Kalle Valo April 17, 2024, 2:22 p.m. UTC | #5
Jeff Johnson <quic_jjohnson@quicinc.com> writes:

> On 4/11/2024 11:06 PM, Baochen Qiang wrote:
>
>> Now that the MHI&QRTR patches [1] are merged, we can add
>> suspend/resume support for ath12k.
>> 
>> The whole design is quite similar to that in ath11k: firmware
>> is powered down when going to suspend and powered up when
>> resume, this makes hibernation work as well in addition to
>> suspend.
>> 
>> To summary, this series first does some preparations in the
>> first 8 patches. Then in patch [9/10] suspend/resume callbacks
>> are implemented. And at last in [10/10] we enable suspend/resume
>> functionality for WCN7850 because it's the only chip supporting
>> it for now.
>> 
>> [1] https://lore.kernel.org/linux-wireless/20240305021320.3367-1-quic_bqiang@quicinc.com/
>> 
>> Baochen Qiang (10):
>>   wifi: ath12k: rearrange IRQ enable/disable in reset path
>>   wifi: ath12k: remove MHI LOOPBACK channels
>>   wifi: ath12k: do not dump SRNG statistics during resume
>>   wifi: ath12k: fix warning on DMA ring capabilities event
>>   wifi: ath12k: decrease MHI channel buffer length to 8KB
>>   wifi: ath12k: flush all packets before suspend
>>   wifi: ath12k: no need to handle pktlog during suspend/resume
>>   wifi: ath12k: avoid stopping mac80211 queues in ath12k_core_restart()
>>   wifi: ath12k: support suspend/resume
>>   wifi: ath12k: change supports_suspend to true for WCN7850
>> 
>>  drivers/net/wireless/ath/ath12k/core.c  | 108 ++++++++++++++----------
>>  drivers/net/wireless/ath/ath12k/core.h  |   4 +
>>  drivers/net/wireless/ath/ath12k/dp_rx.c |  48 -----------
>>  drivers/net/wireless/ath/ath12k/dp_rx.h |   2 -
>
> My Qualcomm Innovation Center copyright checker reports:
> drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024

I fixed this in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6b928df55a671d2c9a15edc746f6b42ef544928e

Jeff, what do you think of the patchset? Is it ready to take?
Jeff Johnson April 17, 2024, 11:32 p.m. UTC | #6
On 4/17/2024 7:22 AM, Kalle Valo wrote:
> Jeff Johnson <quic_jjohnson@quicinc.com> writes:
>> My Qualcomm Innovation Center copyright checker reports:
>> drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024
> 
> I fixed this in the pending branch:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6b928df55a671d2c9a15edc746f6b42ef544928e
> 
> Jeff, what do you think of the patchset? Is it ready to take?

My laptop didn't boot with this patchset in place, let me debug.
Jeff Johnson April 18, 2024, 6:06 a.m. UTC | #7
On 4/17/2024 4:32 PM, Jeff Johnson wrote:
> On 4/17/2024 7:22 AM, Kalle Valo wrote:
>> Jeff Johnson <quic_jjohnson@quicinc.com> writes:
>>> My Qualcomm Innovation Center copyright checker reports:
>>> drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024
>>
>> I fixed this in the pending branch:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6b928df55a671d2c9a15edc746f6b42ef544928e
>>
>> Jeff, what do you think of the patchset? Is it ready to take?
> 
> My laptop didn't boot with this patchset in place, let me debug.

I was originally trying to test with the entire 'pending' branch, but my
laptop crashes during initial boot.

So I just tested with master+the hibernation patchset, and upon resume I'm
getting a bunch of the following:

Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Requested to power ON
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Power on setup success
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Wait for device to enter SBL or Mission mode
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi wifi fw qmi service connected
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: no valid response from PHY capability, choose default num_phy 2
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi firmware request memory request
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi mem seg type 1 size 7077888
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi mem seg type 4 size 8454144
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi dma allocation failed (7077888 B type 1), will try later with small size
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: BUG: Bad page state in process kworker/u16:54  pfn:36e80
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36e80
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: flags: 0xfffffe0000000(node=0|zone=1|lastcpupid=0x3fffff)
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page_type: 0xffffffff()
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 000fffffe0000000 0000000000000000 dead000000000122 0000000000000000
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page dumped because: nonzero _refcount
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Modules linked in: ccm michael_mic bnep amdgpu snd_hda_codec_hdmi amdxcp drm_exec gpu_sched binfmt_misc qrtr_mhi nls_iso8859_1 i915 qrtr ath12k qmi_helpers mac80211 snd_ctl_led ledtrig_audio radeon snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component intel_rapl_msr intel_rapl_common snd_hda_intel snd_intel_dspcfg x86_pkg_temp_thermal snd_intel_sdw_acpi intel_powerclamp snd_hda_codec mei_hdcp uvcvideo snd_hda_core cfg80211 snd_hwdep snd_pcm drm_suballoc_helper coretemp drm_ttm_helper drm_buddy videobuf2_vmalloc btusb crct10dif_pclmul uvc ttm ghash_clmulni_intel btrtl sha512_ssse3 videobuf2_memops btintel sha256_ssse3 snd_seq_midi btbcm sha1_ssse3 snd_seq_midi_event drm_display_helper aesni_intel videobuf2_v4l2 snd_rawmidi videodev btmtk cec snd_seq bluetooth crypto_simd cryptd rc_core videobuf2_common snd_seq_device rapl drm_kms_helper libarc4 mc snd_timer intel_cstate mhi snd i2c_algo_bit ecdh_generic mei_me ecc joydev input_leds soundcore mei serio_raw at24 wmi_bmof mac_hid wireless_hotkey
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  tpm_infineon sch_fq_codel msr parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 cdc_ether usbnet mii rtsx_pci_sdmmc crc32_pclmul video e1000e i2c_i801 psmouse rtsx_pci ahci i2c_smbus libahci xhci_pci lpc_ich xhci_pci_renesas wmi
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: CPU: 2 PID: 55152 Comm: kworker/u16:54 Not tainted 6.9.0-rc3-wt-ath+ #28
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Hardware name: Hewlett-Packard HP ZBook 14 G2/2216, BIOS M71 Ver. 01.31 02/24/2020
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Workqueue: qmi_msg_handler qmi_data_ready_work [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Call Trace:
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  <TASK>
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack_lvl+0x70/0x90
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack+0x14/0x20
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  bad_page+0x71/0x100
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  free_page_is_bad_report+0x86/0x90
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages_ok+0x3b3/0x410
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages+0xe7/0x110
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_direct_free+0xb9/0x180
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_free_attrs+0x3f/0x60
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_free_target_mem_chunk+0x75/0x140 [ath12k]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_msg_mem_request_cb+0x1fb/0x370 [ath12k]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_invoke_handler+0xa3/0xd0 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_handle_message+0x6f/0x190 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_data_ready_work+0x288/0x460 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? raw_spin_rq_unlock+0x14/0x40
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  process_one_work+0x1a0/0x3f0
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  worker_thread+0x351/0x500
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_worker_thread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  kthread+0xf8/0x130
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork+0x40/0x60
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork_asm+0x1a/0x30
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  </TASK>
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Disabling lock debugging due to kernel taint
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: BUG: Bad page state in process kworker/u16:54  pfn:36f00
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36f00
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: flags: 0xfffffe0000000(node=0|zone=1|lastcpupid=0x3fffff)
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page_type: 0xffffffff()
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 000fffffe0000000 0000000000000000 dead000000000122 0000000000000000
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page dumped because: nonzero _refcount
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Modules linked in: ccm michael_mic bnep amdgpu snd_hda_codec_hdmi amdxcp drm_exec gpu_sched binfmt_misc qrtr_mhi nls_iso8859_1 i915 qrtr ath12k qmi_helpers mac80211 snd_ctl_led ledtrig_audio radeon snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component intel_rapl_msr intel_rapl_common snd_hda_intel snd_intel_dspcfg x86_pkg_temp_thermal snd_intel_sdw_acpi intel_powerclamp snd_hda_codec mei_hdcp uvcvideo snd_hda_core cfg80211 snd_hwdep snd_pcm drm_suballoc_helper coretemp drm_ttm_helper drm_buddy videobuf2_vmalloc btusb crct10dif_pclmul uvc ttm ghash_clmulni_intel btrtl sha512_ssse3 videobuf2_memops btintel sha256_ssse3 snd_seq_midi btbcm sha1_ssse3 snd_seq_midi_event drm_display_helper aesni_intel videobuf2_v4l2 snd_rawmidi videodev btmtk cec snd_seq bluetooth crypto_simd cryptd rc_core videobuf2_common snd_seq_device rapl drm_kms_helper libarc4 mc snd_timer intel_cstate mhi snd i2c_algo_bit ecdh_generic mei_me ecc joydev input_leds soundcore mei serio_raw at24 wmi_bmof mac_hid wireless_hotkey
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  tpm_infineon sch_fq_codel msr parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 cdc_ether usbnet mii rtsx_pci_sdmmc crc32_pclmul video e1000e i2c_i801 psmouse rtsx_pci ahci i2c_smbus libahci xhci_pci lpc_ich xhci_pci_renesas wmi
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: CPU: 2 PID: 55152 Comm: kworker/u16:54 Tainted: G    B              6.9.0-rc3-wt-ath+ #28
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Hardware name: Hewlett-Packard HP ZBook 14 G2/2216, BIOS M71 Ver. 01.31 02/24/2020
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Workqueue: qmi_msg_handler qmi_data_ready_work [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Call Trace:
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  <TASK>
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack_lvl+0x70/0x90
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack+0x14/0x20
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  bad_page+0x71/0x100
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  free_page_is_bad_report+0x86/0x90
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages_ok+0x3b3/0x410
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages+0xe7/0x110
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_direct_free+0xb9/0x180
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_free_attrs+0x3f/0x60
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_free_target_mem_chunk+0x75/0x140 [ath12k]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_msg_mem_request_cb+0x1fb/0x370 [ath12k]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_invoke_handler+0xa3/0xd0 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_handle_message+0x6f/0x190 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_data_ready_work+0x288/0x460 [qmi_helpers]
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? raw_spin_rq_unlock+0x14/0x40
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  process_one_work+0x1a0/0x3f0
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  worker_thread+0x351/0x500
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_worker_thread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  kthread+0xf8/0x130
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork+0x40/0x60
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork_asm+0x1a/0x30
Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  </TASK>
Baochen Qiang April 18, 2024, 10:43 a.m. UTC | #8
On 4/18/2024 2:06 PM, Jeff Johnson wrote:
> On 4/17/2024 4:32 PM, Jeff Johnson wrote:
>> On 4/17/2024 7:22 AM, Kalle Valo wrote:
>>> Jeff Johnson <quic_jjohnson@quicinc.com> writes:
>>>> My Qualcomm Innovation Center copyright checker reports:
>>>> drivers/net/wireless/ath/ath12k/dp_rx.h copyright missing 2024
>>> I fixed this in the pending branch:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6b928df55a671d2c9a15edc746f6b42ef544928e
>>>
>>> Jeff, what do you think of the patchset? Is it ready to take?
>> My laptop didn't boot with this patchset in place, let me debug.
> I was originally trying to test with the entire 'pending' branch, but my
> laptop crashes during initial boot.
>
> So I just tested with master+the hibernation patchset, and upon resume I'm
> getting a bunch of the following:
>
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Requested to power ON
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Power on setup success
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: mhi mhi0: Wait for device to enter SBL or Mission mode
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: mhi notify status reason MHI_CB_EE_MISSION_MODE
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi wifi fw qmi service connected
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: no valid response from PHY capability, choose default num_phy 2
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi firmware request memory request
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi mem seg type 1 size 7077888
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi mem seg type 4 size 8454144
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: ath12k_pci 0000:03:00.0: qmi dma allocation failed (7077888 B type 1), will try later with small size
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: BUG: Bad page state in process kworker/u16:54  pfn:36e80
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36e80
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: flags: 0xfffffe0000000(node=0|zone=1|lastcpupid=0x3fffff)
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page_type: 0xffffffff()
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 000fffffe0000000 0000000000000000 dead000000000122 0000000000000000
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page dumped because: nonzero _refcount
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Modules linked in: ccm michael_mic bnep amdgpu snd_hda_codec_hdmi amdxcp drm_exec gpu_sched binfmt_misc qrtr_mhi nls_iso8859_1 i915 qrtr ath12k qmi_helpers mac80211 snd_ctl_led ledtrig_audio radeon snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component intel_rapl_msr intel_rapl_common snd_hda_intel snd_intel_dspcfg x86_pkg_temp_thermal snd_intel_sdw_acpi intel_powerclamp snd_hda_codec mei_hdcp uvcvideo snd_hda_core cfg80211 snd_hwdep snd_pcm drm_suballoc_helper coretemp drm_ttm_helper drm_buddy videobuf2_vmalloc btusb crct10dif_pclmul uvc ttm ghash_clmulni_intel btrtl sha512_ssse3 videobuf2_memops btintel sha256_ssse3 snd_seq_midi btbcm sha1_ssse3 snd_seq_midi_event drm_display_helper aesni_intel videobuf2_v4l2 snd_rawmidi videodev btmtk cec snd_seq bluetooth crypto_simd cryptd rc_core videobuf2_common snd_seq_device rapl drm_kms_helper libarc4 mc snd_timer intel_cstate mhi snd i2c_algo_bit ecdh_generic mei_me ecc joydev input_leds soundcore mei serio_raw at24 wmi_bmof mac_hid wireless_hotkey
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  tpm_infineon sch_fq_codel msr parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 cdc_ether usbnet mii rtsx_pci_sdmmc crc32_pclmul video e1000e i2c_i801 psmouse rtsx_pci ahci i2c_smbus libahci xhci_pci lpc_ich xhci_pci_renesas wmi
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: CPU: 2 PID: 55152 Comm: kworker/u16:54 Not tainted 6.9.0-rc3-wt-ath+ #28
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Hardware name: Hewlett-Packard HP ZBook 14 G2/2216, BIOS M71 Ver. 01.31 02/24/2020
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Workqueue: qmi_msg_handler qmi_data_ready_work [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Call Trace:
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  <TASK>
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack_lvl+0x70/0x90
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack+0x14/0x20
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  bad_page+0x71/0x100
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  free_page_is_bad_report+0x86/0x90
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages_ok+0x3b3/0x410
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages+0xe7/0x110
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_direct_free+0xb9/0x180
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_free_attrs+0x3f/0x60
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_free_target_mem_chunk+0x75/0x140 [ath12k]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_msg_mem_request_cb+0x1fb/0x370 [ath12k]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_invoke_handler+0xa3/0xd0 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_handle_message+0x6f/0x190 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_data_ready_work+0x288/0x460 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? raw_spin_rq_unlock+0x14/0x40
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  process_one_work+0x1a0/0x3f0
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  worker_thread+0x351/0x500
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_worker_thread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  kthread+0xf8/0x130
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork+0x40/0x60
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork_asm+0x1a/0x30
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  </TASK>
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Disabling lock debugging due to kernel taint
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: BUG: Bad page state in process kworker/u16:54  pfn:36f00
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36f00
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: flags: 0xfffffe0000000(node=0|zone=1|lastcpupid=0x3fffff)
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page_type: 0xffffffff()
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 000fffffe0000000 0000000000000000 dead000000000122 0000000000000000
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: page dumped because: nonzero _refcount
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Modules linked in: ccm michael_mic bnep amdgpu snd_hda_codec_hdmi amdxcp drm_exec gpu_sched binfmt_misc qrtr_mhi nls_iso8859_1 i915 qrtr ath12k qmi_helpers mac80211 snd_ctl_led ledtrig_audio radeon snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component intel_rapl_msr intel_rapl_common snd_hda_intel snd_intel_dspcfg x86_pkg_temp_thermal snd_intel_sdw_acpi intel_powerclamp snd_hda_codec mei_hdcp uvcvideo snd_hda_core cfg80211 snd_hwdep snd_pcm drm_suballoc_helper coretemp drm_ttm_helper drm_buddy videobuf2_vmalloc btusb crct10dif_pclmul uvc ttm ghash_clmulni_intel btrtl sha512_ssse3 videobuf2_memops btintel sha256_ssse3 snd_seq_midi btbcm sha1_ssse3 snd_seq_midi_event drm_display_helper aesni_intel videobuf2_v4l2 snd_rawmidi videodev btmtk cec snd_seq bluetooth crypto_simd cryptd rc_core videobuf2_common snd_seq_device rapl drm_kms_helper libarc4 mc snd_timer intel_cstate mhi snd i2c_algo_bit ecdh_generic mei_me ecc joydev input_leds soundcore mei serio_raw at24 wmi_bmof mac_hid wireless_hotkey
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  tpm_infineon sch_fq_codel msr parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 cdc_ether usbnet mii rtsx_pci_sdmmc crc32_pclmul video e1000e i2c_i801 psmouse rtsx_pci ahci i2c_smbus libahci xhci_pci lpc_ich xhci_pci_renesas wmi
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: CPU: 2 PID: 55152 Comm: kworker/u16:54 Tainted: G    B              6.9.0-rc3-wt-ath+ #28
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Hardware name: Hewlett-Packard HP ZBook 14 G2/2216, BIOS M71 Ver. 01.31 02/24/2020
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Workqueue: qmi_msg_handler qmi_data_ready_work [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel: Call Trace:
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  <TASK>
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack_lvl+0x70/0x90
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dump_stack+0x14/0x20
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  bad_page+0x71/0x100
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  free_page_is_bad_report+0x86/0x90
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages_ok+0x3b3/0x410
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  __free_pages+0xe7/0x110
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_direct_free+0xb9/0x180
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  dma_free_attrs+0x3f/0x60
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_free_target_mem_chunk+0x75/0x140 [ath12k]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ath12k_qmi_msg_mem_request_cb+0x1fb/0x370 [ath12k]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_invoke_handler+0xa3/0xd0 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_handle_message+0x6f/0x190 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  qmi_data_ready_work+0x288/0x460 [qmi_helpers]
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? raw_spin_rq_unlock+0x14/0x40
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  process_one_work+0x1a0/0x3f0
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  worker_thread+0x351/0x500
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_worker_thread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  kthread+0xf8/0x130
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork+0x40/0x60
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ? __pfx_kthread+0x10/0x10
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  ret_from_fork_asm+0x1a/0x30
> Apr 17 21:38:04 qca-HP-ZBook-14-G2 kernel:  </TASK>

Thanks for testing. I am able to reproduce this issue (although not exactly same crash signature) after disabling DMA remap. Just submit below patch to fix this issue, please help review.

     wifi: ath12k: fix kernel crash during resume

>
>