Skip to contentSkip to conversation

net: qrtr: resend HELLO on MHI resume

PATCH In review Daniel J Blueman 7 participants 11 messages Sep 9 – Sep 21

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: qrtr: resend HELLO on MHI resume

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +13 -0
index 78347c937af7..2ffcfc2fdb4a 100644
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep)
+{
+	struct qrtr_node *node = ep->node;
+
+	mutex_lock(&node->ep_lock);
+	node->hello_sent = false;
+	mutex_unlock(&node->ep_lock);
+
+	schedule_delayed_work(&node->say_hello, 0);
+}
+EXPORT_SYMBOL_GPL(qrtr_endpoint_hello);
+
 /**
  * qrtr_endpoint_register() - register a new endpoint
  * @ep: endpoint to register
net/qrtr/mhi.c +8 -1
index 3990da1a65dc..50326ffa3401 100644
@@ -183,6 +183,7 @@ static int __maybe_unused qcom_mhi_qrtr_pm_suspend_late(struct device *dev)
 static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 {
 	struct mhi_device *mhi_dev = container_of(dev, struct mhi_device, dev);
+	struct qrtr_mhi_dev *qdev = dev_get_drvdata(dev);
 	enum mhi_state state;
 	int rc;
 
@@ -201,7 +201,13 @@ static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 		return rc;
 	}
 
-	return qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	rc = qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	if (rc)
+		return rc;
+
+	qrtr_endpoint_hello(&qdev->ep);
+
+	return 0;
 }
 
 static const struct dev_pm_ops qcom_mhi_qrtr_pm_ops = {
net/qrtr/qrtr.h +2 -0
index 3f2d28696062..de2de69a6199 100644
@@ -27,6 +27,8 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid);
 
 void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
 
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep);
+
 int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
 
 int qrtr_ns_init(void);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 27 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +0 -0
index 78347c937af7..2ffcfc2fdb4a 100644

net/qrtr/af_qrtr.c static void qrtr_hello_work(struct work_struct *work) · line 626

Quoted 4 lines
net/qrtr/af_qrtr.c +1 -0
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */

Use proper kernel-doc please.

Rest LGTM, thanks!

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#2 lore raw
Quoted 31 lines · Manivannan Sadhasivam
Quoted 30 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +0 -0
index 78347c937af7..2ffcfc2fdb4a 100644
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
Quoted 3 lines

net/qrtr/af_qrtr.c static void qrtr_hello_work(struct work_struct *work) · line 626

Quoted 1 line
net/qrtr/af_qrtr.c +1 -0
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */

Use proper kernel-doc please.

Please prioritize merging this sooner than later (it's a regression from 7.3-rc2 that would hit people if it made it to 7.3 final) even if it means fixing up non-critical aspects later, or by maintainer upon merging.

Thanks,
Vlastimil

Quoted 4 lines

Rest LGTM, thanks!

- Mani

Tested-by
#3 lore raw
Quoted 32 lines · Vlastimil Babka
Quoted 31 lines · Manivannan Sadhasivam
Quoted 30 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +0 -0
index 78347c937af7..2ffcfc2fdb4a 100644
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
Quoted 7 lines
Quoted 3 lines

net/qrtr/af_qrtr.c static void qrtr_hello_work(struct work_struct *work) · line 626

Quoted 1 line
net/qrtr/af_qrtr.c +1 -0
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */

Use proper kernel-doc please.

Please prioritize merging this sooner than later (it's a regression from 7.3-rc2 that would hit people if it made it to 7.3 final) even if it means fixing up non-critical aspects later, or by maintainer upon merging.

Concur. I recently fast-forwarded my ath tree and picked up the buggy commit, so everyone using my tree is now affected.

And just want to point out that many of the function comments in this file do not use kernel-doc format, so I would not consider that a blocker. But it also would be trivial for the maintainer to add.

I've tested this on my HP ZBook 14 where I've replaced the OEM Wi-Fi adapter with WCN7850...

/jeff

#4 lore raw
Quoted 23 lines · Jeff Johnson
Quoted 21 lines · Vlastimil Babka
Quoted 20 lines · Manivannan Sadhasivam
Quoted 13 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

[...]
Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
[...]
net/qrtr/af_qrtr.c +0 -0
index 78347c937af7..2ffcfc2fdb4a 100644

net/qrtr/af_qrtr.c static void qrtr_hello_work(struct work_struct *work) · line 626

Quoted 4 lines
net/qrtr/af_qrtr.c +1 -0
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */

Use proper kernel-doc please.

Quoted 6 lines
Quoted 3 lines

Please prioritize merging this sooner than later (it's a regression from 7.3-rc2 that would hit people if it made it to 7.3 final) even if it means fixing up non-critical aspects later, or by maintainer upon merging.

Concur. I recently fast-forwarded my ath tree and picked up the buggy commit, so everyone using my tree is now affected.

I wonder if we need somebody (Daniel?) to repost this patch to at least have a chance to get it into the next -rc, as I didn't find the fix in netdev's patchwork when I just looked -- maybe I missed something, but I guess that's because the patch wasn't CCed to netdev.

Ciao, Thorsten

Quoted 11 lines

And just want to point out that many of the function comments in this file do not use kernel-doc format, so I would not consider that a blocker. But it also would be trivial for the maintainer to add.

I've tested this on my HP ZBook 14 where I've replaced the OEM Wi-Fi adapter with WCN7850...

/jeff

#5 lore raw
In reply to Daniel J Blueman
Quoted 5 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

Quoted 8 lines

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

For the record: Takashi ran into this regression as well and provided a different fix, but withdrew it after I pointed out this fix, which worked for Takashi. For details see:
https://lore.kernel.org/all/[email protected]/

Ciao, Thorsten

Quoted 72 lines
Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +13 -0
index 78347c937af7..2ffcfc2fdb4a 100644
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep)
+{
+	struct qrtr_node *node = ep->node;
+
+	mutex_lock(&node->ep_lock);
+	node->hello_sent = false;
+	mutex_unlock(&node->ep_lock);
+
+	schedule_delayed_work(&node->say_hello, 0);
+}
+EXPORT_SYMBOL_GPL(qrtr_endpoint_hello);
+
 /**
  * qrtr_endpoint_register() - register a new endpoint
  * @ep: endpoint to register
net/qrtr/mhi.c +8 -1
index 3990da1a65dc..50326ffa3401 100644
@@ -183,6 +183,7 @@ static int __maybe_unused qcom_mhi_qrtr_pm_suspend_late(struct device *dev)
 static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 {
 	struct mhi_device *mhi_dev = container_of(dev, struct mhi_device, dev);
+	struct qrtr_mhi_dev *qdev = dev_get_drvdata(dev);
 	enum mhi_state state;
 	int rc;
 
@@ -201,7 +201,13 @@ static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 		return rc;
 	}
 
-	return qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	rc = qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	if (rc)
+		return rc;
+
+	qrtr_endpoint_hello(&qdev->ep);
+
+	return 0;
 }
 
 static const struct dev_pm_ops qcom_mhi_qrtr_pm_ops = {
net/qrtr/qrtr.h +2 -0
index 3f2d28696062..de2de69a6199 100644
@@ -27,6 +27,8 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid);
 
 void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
 
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep);
+
 int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
 
 int qrtr_ns_init(void);
Tested-by
#6 lore raw
Quoted 13 lines · Thorsten Leemhuis
Quoted 11 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Quoted 7 lines
Quoted 2 lines

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

For the record: Takashi ran into this regression as well and provided a different fix, but withdrew it after I pointed out this fix, which worked for Takashi. For details see:
https://lore.kernel.org/all/[email protected]/

Yep, feel free to take my tested-by tag, too:

thanks,

Takashi

Tested-by Vlastimil Babka (SUSE)
#7 lore raw
In reply to Thorsten Leemhuis
Quoted 12 lines · Thorsten Leemhuis
Quoted 11 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Quoted 7 lines
Quoted 2 lines

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

For the record: Takashi ran into this regression as well and provided a different fix, but withdrew it after I pointed out this fix, which worked for Takashi. For details see:
https://lore.kernel.org/all/[email protected]/

Thanks to Thorsten pointing me there I skipped the bisect and applied this patch instead and it works.

My laptop is T14s AMD Gen3 with ath11k_pci. Since rc2 the wifi would stop working on suspend/resume, making the resume freeze for a while (I initially thought it was frozen completely and was shutting off the laptop).

Interestingly the card doesn't recover after reboot, but only after a full power off/on cycle. But if the HELLO handshake is sent after a boot, shouldn't it recover? Maybe the hardware gets too confused to recover. Dunno. Hm maybe I can try if 7.2 kernel (and/or 7.3 with this patch) recovers it without poweroff/on after a 7.3 without this patch suspend/resume wedges it.

But anyway this prevents the suspend/resume issue for me from happening in the first place on 7.3-rc3, so:

Quoted 74 lines

Ciao, Thorsten

Quoted 72 lines
Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")
---
 net/qrtr/af_qrtr.c | 13 +++++++++++++
 net/qrtr/mhi.c     | 10 +++++++++-
 net/qrtr/qrtr.h    |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +13 -0
index 78347c937af7..2ffcfc2fdb4a 100644
@@ -623,6 +623,19 @@ static void qrtr_hello_work(struct work_struct *work)
 	qrtr_port_put(ctrl);
 }
 
+/* Trigger the HELLO handshake after the remote has been reset, eg on resume */
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep)
+{
+	struct qrtr_node *node = ep->node;
+
+	mutex_lock(&node->ep_lock);
+	node->hello_sent = false;
+	mutex_unlock(&node->ep_lock);
+
+	schedule_delayed_work(&node->say_hello, 0);
+}
+EXPORT_SYMBOL_GPL(qrtr_endpoint_hello);
+
 /**
  * qrtr_endpoint_register() - register a new endpoint
  * @ep: endpoint to register
net/qrtr/mhi.c +8 -1
index 3990da1a65dc..50326ffa3401 100644
@@ -183,6 +183,7 @@ static int __maybe_unused qcom_mhi_qrtr_pm_suspend_late(struct device *dev)
 static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 {
 	struct mhi_device *mhi_dev = container_of(dev, struct mhi_device, dev);
+	struct qrtr_mhi_dev *qdev = dev_get_drvdata(dev);
 	enum mhi_state state;
 	int rc;
 
@@ -201,7 +201,13 @@ static int __maybe_unused qcom_mhi_qrtr_pm_resume_early(struct device *dev)
 		return rc;
 	}
 
-	return qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	rc = qcom_mhi_qrtr_queue_dl_buffers(mhi_dev);
+	if (rc)
+		return rc;
+
+	qrtr_endpoint_hello(&qdev->ep);
+
+	return 0;
 }
 
 static const struct dev_pm_ops qcom_mhi_qrtr_pm_ops = {
net/qrtr/qrtr.h +2 -0
index 3f2d28696062..de2de69a6199 100644
@@ -27,6 +27,8 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid);
 
 void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
 
+void qrtr_endpoint_hello(struct qrtr_endpoint *ep);
+
 int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
 
 int qrtr_ns_init(void);
#8 lore raw
Quoted 28 lines · Vlastimil Babka
Quoted 12 lines · Thorsten Leemhuis
Quoted 11 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Quoted 7 lines
Quoted 2 lines

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

For the record: Takashi ran into this regression as well and provided a different fix, but withdrew it after I pointed out this fix, which worked for Takashi. For details see:
https://lore.kernel.org/all/[email protected]/

Thanks to Thorsten pointing me there I skipped the bisect and applied this patch instead and it works.

My laptop is T14s AMD Gen3 with ath11k_pci. Since rc2 the wifi would stop working on suspend/resume, making the resume freeze for a while (I initially thought it was frozen completely and was shutting off the laptop).

Quoted 6 lines

Interestingly the card doesn't recover after reboot, but only after a full power off/on cycle. But if the HELLO handshake is sent after a boot, shouldn't it recover? Maybe the hardware gets too confused to recover. Dunno. Hm maybe I can try if 7.2 kernel (and/or 7.3 with this patch) recovers it without poweroff/on after a 7.3 without this patch suspend/resume wedges it.

Neither 7.2 nor 7.3 + patch was able to recover the card on reboot, so while that's not great, at least 7.3+patch isn't worse in this aspect.

maintainer Reviewed-by on v1 1/1
#9 lore raw
In reply to Daniel J Blueman

+ netdev

Quoted 8 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Quoted 8 lines

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")

Since this patch fixes a regression in linux-next, it'd be good to get it merged asap.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#10 lore raw
Quoted 17 lines · Manivannan Sadhasivam

+ netdev

Quoted 14 lines · Daniel J Blueman

Since the MHI HELLO exchange was relocated, it is sent only at device registration. During a suspend-resume cycle, the firmware in WiFi cards such as WCN7850 indefinitely waits for another HELLO, triggering:

ath12k_wifi7_pci 0004:01:00.0: timeout while waiting for restart complete ath12k_wifi7_pci 0004:01:00.0: failed to resume core: -110

Fix this by triggering the handshake from resume_early in the MHI transport.

Validated on Qualcomm X1E-801800 on Lenovo Slim 7x across 10 suspend-resume cycles.

Quoted 7 lines
Quoted 2 lines
Fixes 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register")

Since this patch fixes a regression in linux-next, it'd be good to get it merged asap.

Linus merged it directly for rc4 as 6a5719cc3ef2 ("net: qrtr: resend HELLO on MHI resume")

Quoted 2 lines

- Mani