From: John Glotzer <jglotzer@gmail.com>
To: sergio.callegari@unibo.it
Cc: Aaron.Hou@mediatek.com, Chris.Lu@mediatek.com,
Deren.Wu@mediatek.com, Hao.Qin@mediatek.com,
Sean.Wang@mediatek.com, johan.hedberg@gmail.com,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org, luiz.dentz@gmail.com,
marc.payne@mdpsys.co.uk, marcel@holtmann.org,
regressions@lists.linux.dev, steve.lee@mediatek.com,
tiwai@suse.de
Subject: Re: [PATCH] Bluetooth: btmtk: Remove resetting mt7921 before downloading the fw
Date: Sat, 18 Jan 2025 10:58:40 -0600 [thread overview]
Message-ID: <20250118165840.73110-1-jglotzer@gmail.com> (raw)
In-Reply-To: <9ae25475-e8f4-4ee1-8022-7621fbe8ebc6@unibo.it>
(Note: additional discussion has taken place under
Re: [REGRESSION] bluetooth: mt7921: Crash on Resume From Suspend And Hibernate)
Hi,
I have dug further into this issue and I think I have a root cause analysis that
makes sense (at least it does for me :) ).
The TLDR is that the root cause is the following commit that was introduced with the 6.11 kernel.
https://github.com/torvalds/linux/commit/d53ab629cff57
Furthermore, the problem must be the call to usleep_range() in
drivers/net/wireless/mediatek/mt76/mt792x_core.c as this is the only behavioral change.
Notice that this commit first shows up in v6.11-rc1 and is present for all subsequent releases,
which matches perfectly the breakage pattern seen by the user community.
What, then, is the evidence for this?
First of all the entire community has been unanimous in the observation that the issue
started with the 6.11 kernel. The universal experience has been that any kernel prior
to that had no issues, and all kernels starting with 6.11 were affected. Also no attempts
to mitigate the issue in code by attacking the problem via the firmware download code paths have
been fruitful.
The next piece of solid data is outlined here:
https://github.com/alimert-t/suspend-freeze-fix-for-mt7921e
Here the lead paragraph states:
"A suspend/resume issue occurs on systems with the MediaTek MT7921 Wi-Fi adapter when
running on Kernel 6.11.-. After suspending, the system fails to resume / freezes and requires a hard
reset."
The mitigation for this issue has consisted of one of two approches:
- rfkill bluetooth and wifi on sleep and reverse the process on wake
- add the parameter mt7921e.disable_aspm=y to the kernel command line
(anecdotally I have seen reports of people doing things like turning off bluetooth
and/or wifi before suspending or for that matter rmmod mt7921e before suspending).
I personally have used both of these methods with a sucess rate of 100%.
The way to unlock the puzzle is to examine the 6.11 code with an eye towards
- what changed between v6.10 and v6.11?
- what is the intersection between this changeset and the disable_aspm paramter?
To cut to the chase the answer to both these questions is just the contents of
https://github.com/torvalds/linux/commit/d53ab629cff57. I confirmed this by
diffing v6.10 and v6.11 and then going through the diff looking for disable_aspm.
The following lines were added to drivers/net/wireless/mediatek/mt76/mt7921/pci.c
if (!mt7921_disable_aspm && mt76_pci_aspm_supported(pdev))
dev->aspm_supported = true;
The bitfield aspm_supported was added to the struct mt792x_dev in drivers/net/wireless/mediatek/mt76/mt792x.h
and if this bitfield is true then the call to usleep_range is made in __mt792xe_mcu_drv_pmctrl()
in drivers/net/wireless/mediatek/mt76/mt792x_core.c.
if (dev->aspm_supported)
usleep_range(2000, 3000);
By setting mt7921e.disable_aspm=y on the kernel command line, this code pathway is avoided
and no crash or lockup happens when the device is woken back up.
Disclaimers:
- I don't claim to know the root cause for why the call to usleep_range() leads to a crash or a
freeze.
- I don't know the details of the specific issue the code for commit d53ab629cff57 was designed
to fix, hence I don't know the consequences of removing the call to usleep_range(). However,
I do know that the user experience has been significantly impacted negatively by the introduction
of d53ab629cff57 into the 6.11 kernel.
Thanks for your attention,
John Glotzer
next prev parent reply other threads:[~2025-01-18 16:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 5:23 Hao Qin
2024-09-10 17:09 ` Marc Payne
2024-09-12 7:09 ` Chris Lu (陸稚泓)
2024-09-17 19:53 ` marc.payne
[not found] ` <9bfbbf24ac2480d94d3455f7e33e4b5502b38ced.camel@mediatek.com>
2024-09-18 13:37 ` Luiz Augusto von Dentz
2024-09-19 3:26 ` Chris Lu (陸稚泓)
2024-09-19 22:25 ` marc.payne
2024-09-20 6:27 ` Chris Lu (陸稚泓)
2024-10-14 9:29 ` Linux regression tracking (Thorsten Leemhuis)
2024-10-22 10:56 ` Takashi Iwai
2024-10-30 9:21 ` Thorsten Leemhuis
2024-10-30 11:03 ` Chris Lu (陸稚泓)
2024-10-30 11:29 ` Thorsten Leemhuis
2024-11-01 7:11 ` Chris Lu (陸稚泓)
2024-11-01 14:22 ` Thorsten Leemhuis
2024-11-02 10:04 ` Takashi Iwai
2024-11-11 9:21 ` Linux regression tracking (Thorsten Leemhuis)
2025-01-13 22:18 ` Sergio Callegari
2025-01-18 16:58 ` John Glotzer [this message]
2025-01-28 0:04 ` Bitterblue Smith
2025-01-29 18:31 ` John Glotzer
2024-11-27 23:14 ` [REGRESSION] bluetooth: mt7921: Crash on Resume From Suspend And Hibernate John Glotzer
2024-12-05 12:59 ` Sergio Callegari
2024-12-06 2:29 ` John Glotzer
2024-12-21 9:52 ` Sergio Callegari
2024-09-18 16:02 ` [PATCH] Bluetooth: btmtk: Remove resetting mt7921 before downloading the fw marc.payne
2025-01-10 9:55 Hao Qin
2025-01-14 17:20 ` patchwork-bot+bluetooth
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250118165840.73110-1-jglotzer@gmail.com \
--to=jglotzer@gmail.com \
--cc=Aaron.Hou@mediatek.com \
--cc=Chris.Lu@mediatek.com \
--cc=Deren.Wu@mediatek.com \
--cc=Hao.Qin@mediatek.com \
--cc=Sean.Wang@mediatek.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=luiz.dentz@gmail.com \
--cc=marc.payne@mdpsys.co.uk \
--cc=marcel@holtmann.org \
--cc=regressions@lists.linux.dev \
--cc=sergio.callegari@unibo.it \
--cc=steve.lee@mediatek.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome