Skip to contentSkip to conversation

scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

PATCH Applied Can Guo 6 participants 11 messages Jun 18 – Jul 29 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Can Guo

author
#0 lore raw

PATCH v2 1/1 scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

This is preferred over tagging individual call sites with GFP_NOIO, as it automatically covers any future allocations added anywhere in the call tree without requiring each caller to be aware of this constraint.

Fixes 03e5d38e2f98 ("scsi: ufs: core: Add support for TX Equalization")

---
v1 -> v2:
- Replaced per-allocation GFP_NOIO usage with memalloc_noio_save/restore() around ufshcd_tx_eqtr() call tree.

 drivers/ufs/core/ufs-txeq.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/ufs/core/ufs-txeq.c +17 -2
index 4b264adfdf49..9dca0cd344b8 100644
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/sched/mm.h>
 #include <ufs/ufshcd.h>
 #include <ufs/unipro.h>
 #include "ufshcd-priv.h"
@@ -1212,14 +1213,25 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 			  struct ufs_pa_layer_attr *pwr_mode)
 {
 	struct ufs_pa_layer_attr old_pwr_info;
+	unsigned int noio_flag;
 	int ret;
 
+	/*
+	 * ufshcd_tx_eqtr() is called from a power-mode-change context where
+	 * I/O is suspended. Use memalloc_noio_save() to propagate GFP_NOIO
+	 * to all allocations in the call tree instead of tagging each call
+	 * site individually.
+	 */
+	noio_flag = memalloc_noio_save();
+
 	if (!params->eqtr_record) {
 		params->eqtr_record = devm_kzalloc(hba->dev,
 						   sizeof(*params->eqtr_record),
 						   GFP_KERNEL);
-		if (!params->eqtr_record)
-			return -ENOMEM;
+		if (!params->eqtr_record) {
+			ret = -ENOMEM;
+			goto out_noio_restore;
+		}
 	}
 
 	memcpy(&old_pwr_info, &hba->pwr_info, sizeof(struct ufs_pa_layer_attr));
@@ -1244,6 +1256,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 	if (ret)
 		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
 	return ret;
 }
 
Signature · 1 line
2.34.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] The POST_CHANGE notification is skipped on error paths in ufshcd_tx_eqtr(), leaving variant-specific hardware state unbalanced.
- [High] Missing cleanup of TX Equalization settings and Power Mode on error paths in ufs_qcom_get_rx_fom().
--

commit 8d8593416ad1701fbb78203bd1a0efec4ccc4895
Author: Can Guo <[email protected]>

scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

This patch uses memalloc_noio_save() and memalloc_noio_restore() in ufshcd_tx_eqtr() to prevent potential memory reclaim deadlocks. TX EQTR allocations in a quiesced UFS tagset context could trigger direct reclaim depending on UFS I/O, leading to deadlocks.

Quoted 5 lines

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

[Severity: High]
This is a pre-existing issue, but does ufs_qcom_get_rx_fom() skip cleanup on error paths?

The function overrides TX Equalization settings via ufshcd_apply_tx_eq_settings() and then alters the power mode to test the FOM.

If ufshcd_change_power_mode() or ufs_qcom_host_sw_rx_fom() fails, it returns the error directly:

drivers/ufs/host/ufs-qcom.c:ufs_qcom_get_rx_fom() {
    ...
    ret = ufs_qcom_host_sw_rx_fom(hba, pwr_mode->lane_rx, fom);
    if (ret) {
        dev_err(...);
        return ret;
    }
    ...
}

Does this direct return bypass the restoration of the original TX Equalization settings, permanently leaking the test PHY equalization settings into the hardware configuration?

Quoted 4 lines
drivers/ufs/core/ufs-txeq.c +0 -0
index aa64f2bf4f1ef..d20c478659157 100644

[ ... ]

drivers/ufs/core/ufs-txeq.c static int ufshcd_tx_eqtr(struct ufs_hba *hba, · line 1267

Quoted 9 lines
drivers/ufs/core/ufs-txeq.c +3 -0
@@ -1248,6 +1260,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 	if (ret)
 		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
 	return ret;
 }

[Severity: High]
This isn't a bug introduced by this patch, but does the error path in ufshcd_tx_eqtr() skip restoring the hardware state?

When ufshcd_vops_tx_eqtr_notify() is called with PRE_CHANGE, it saves critical PHY settings. If __ufshcd_tx_eqtr() fails, the code jumps to out and skips the POST_CHANGE notification:

drivers/ufs/core/ufs-txeq.c:ufshcd_tx_eqtr() {
    ...
    ret = ufshcd_vops_tx_eqtr_notify(hba, PRE_CHANGE, pwr_mode);
    if (ret)
        goto out;

    ret = __ufshcd_tx_eqtr(hba, params, pwr_mode);
    if (ret)
        goto out;

    ret = ufshcd_vops_tx_eqtr_notify(hba, POST_CHANGE, pwr_mode);
    ...
}

Since POST_CHANGE is exclusively responsible for restoring the saved hardware state, could skipping this permanently leave the PHY tuning registers corrupted and prevent UFS link recovery?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#2 lore raw
Quoted 44 lines · On 6/18/2026 10:21 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] The POST_CHANGE notification is skipped on error paths in ufshcd_tx_eqtr(), leaving variant-specific hardware state unbalanced.
- [High] Missing cleanup of TX Equalization settings and Power Mode on error paths in ufs_qcom_get_rx_fom().
--

commit 8d8593416ad1701fbb78203bd1a0efec4ccc4895
Author: Can Guo <[email protected]>

scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

This patch uses memalloc_noio_save() and memalloc_noio_restore() in ufshcd_tx_eqtr() to prevent potential memory reclaim deadlocks. TX EQTR allocations in a quiesced UFS tagset context could trigger direct reclaim depending on UFS I/O, leading to deadlocks.

Quoted 5 lines

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

[Severity: High]
This is a pre-existing issue, but does ufs_qcom_get_rx_fom() skip cleanup on error paths?

The function overrides TX Equalization settings via ufshcd_apply_tx_eq_settings() and then alters the power mode to test the FOM.

If ufshcd_change_power_mode() or ufs_qcom_host_sw_rx_fom() fails, it returns the error directly:

drivers/ufs/host/ufs-qcom.c:ufs_qcom_get_rx_fom() {
     ...
     ret = ufs_qcom_host_sw_rx_fom(hba, pwr_mode->lane_rx, fom);
     if (ret) {
         dev_err(...);
         return ret;
     }
     ...
}
Quoted 3 lines

Does this direct return bypass the restoration of the original TX Equalization settings, permanently leaking the test PHY equalization settings into the hardware configuration?

In the initial patch series, error handling was not the key consideration. Later on, this has been considered and addressed. After proper (error injection) test, the fixes shall be submitted.

Quoted 37 lines
Quoted 5 lines
drivers/ufs/core/ufs-txeq.c +0 -0
index aa64f2bf4f1ef..d20c478659157 100644

[ ... ]

drivers/ufs/core/ufs-txeq.c static int ufshcd_tx_eqtr(struct ufs_hba *hba, · line 1267

Quoted 9 lines
drivers/ufs/core/ufs-txeq.c +3 -0
@@ -1248,6 +1260,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
  	if (ret)
  		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
  	return ret;
  }

[Severity: High]
This isn't a bug introduced by this patch, but does the error path in ufshcd_tx_eqtr() skip restoring the hardware state?

When ufshcd_vops_tx_eqtr_notify() is called with PRE_CHANGE, it saves critical PHY settings. If __ufshcd_tx_eqtr() fails, the code jumps to out and skips the POST_CHANGE notification:

drivers/ufs/core/ufs-txeq.c:ufshcd_tx_eqtr() {
     ...
     ret = ufshcd_vops_tx_eqtr_notify(hba, PRE_CHANGE, pwr_mode);
     if (ret)
         goto out;

     ret = __ufshcd_tx_eqtr(hba, params, pwr_mode);
     if (ret)
         goto out;

     ret = ufshcd_vops_tx_eqtr_notify(hba, POST_CHANGE, pwr_mode);
     ...
}
Quoted 3 lines

Since POST_CHANGE is exclusively responsible for restoring the saved hardware state, could skipping this permanently leave the PHY tuning registers corrupted and prevent UFS link recovery?

It depends on what is implemented in POST_CHANGE. But this is a good point, I am considering to mandate the call to POST_CHANGE. If there is a change for this, the change will come along with the one mentioned above.

Thanks,
Can Guo.

Quoted 1 line
Reviewed-by on v2 1/1
#3 lore raw
In reply to Can Guo
Quoted 12 lines · Can Guo

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

Quoted 7 lines

This is preferred over tagging individual call sites with GFP_NOIO, as it automatically covers any future allocations added anywhere in the call tree without requiring each caller to be aware of this constraint.

Fixes 03e5d38e2f98 ("scsi: ufs: core: Add support for TX Equalization")
#4 lore raw
In reply to Can Guo

drivers/ufs/core/ufs-txeq.c static int ufshcd_tx_eqtr(struct ufs_hba *hba, · line 1264

Quoted 10 lines · Can Guo
drivers/ufs/core/ufs-txeq.c +3 -0
@@ -1244,6 +1256,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
  	if (ret)
  		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
  	return ret;
  }
 

This patch adds a new label "out_noio_restore" next to the existing label "out". Shouldn't the existing "out" label be renamed? Otherwise this patch looks good to me.

Thanks,

Bart.

Reviewed-by on v2 1/1
#5 lore raw
In reply to Can Guo
Quoted 12 lines · Can Guo

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

Quoted 7 lines

This is preferred over tagging individual call sites with GFP_NOIO, as it automatically covers any future allocations added anywhere in the call tree without requiring each caller to be aware of this constraint.

Fixes 03e5d38e2f98 ("scsi: ufs: core: Add support for TX Equalization")

- Mani

Quoted 60 lines

---
v1 -> v2:
- Replaced per-allocation GFP_NOIO usage with memalloc_noio_save/restore() around ufshcd_tx_eqtr() call tree.

 drivers/ufs/core/ufs-txeq.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/ufs/core/ufs-txeq.c +17 -2
index 4b264adfdf49..9dca0cd344b8 100644
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/sched/mm.h>
 #include <ufs/ufshcd.h>
 #include <ufs/unipro.h>
 #include "ufshcd-priv.h"
@@ -1212,14 +1213,25 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 			  struct ufs_pa_layer_attr *pwr_mode)
 {
 	struct ufs_pa_layer_attr old_pwr_info;
+	unsigned int noio_flag;
 	int ret;
 
+	/*
+	 * ufshcd_tx_eqtr() is called from a power-mode-change context where
+	 * I/O is suspended. Use memalloc_noio_save() to propagate GFP_NOIO
+	 * to all allocations in the call tree instead of tagging each call
+	 * site individually.
+	 */
+	noio_flag = memalloc_noio_save();
+
 	if (!params->eqtr_record) {
 		params->eqtr_record = devm_kzalloc(hba->dev,
 						   sizeof(*params->eqtr_record),
 						   GFP_KERNEL);
-		if (!params->eqtr_record)
-			return -ENOMEM;
+		if (!params->eqtr_record) {
+			ret = -ENOMEM;
+			goto out_noio_restore;
+		}
 	}
 
 	memcpy(&old_pwr_info, &hba->pwr_info, sizeof(struct ufs_pa_layer_attr));
@@ -1244,6 +1256,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 	if (ret)
 		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
 	return ret;
 }
 
Signature · 1 line
2.34.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்

A message that is not in the archive (sent off-list or not yet received): f1960bd5-b583-4104-a343-e217ef7ed63d@SJ0PR04MB7504.namprd04.prod.outlook.com

#7 lore raw

Re: Undeliverable: Re: [PATCH v2] scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

Quoted 5 lines · On Tue, Jul 07, 2026 at 03:58:12PM +0000…

Delivery has failed to these recipients or groups:

Avri Altman ([email protected])<mailto:[email protected]>
Your message wasn't delivered. Despite repeated attempts to deliver your message, a connection to the remote server couldn't be made.

Hi Avri,

Are you willing to continue your role as UFS reviewer? If so, could you please fix your email address to avoid bouncing?

I can also send a patch for that if you want. Let me know!

- Mani

Quoted 414 lines

Contact the recipient by some other means (by phone, for example) and ask them to tell their email admin that it appears that your email system is unable to connecto their email system. Give them the error details shown below. It's likely that the recipient's email admin is the only one who can fix this problem.

For more information and tips to fix this issue see this article: https://go.microsoft.com/fwlink/?LinkId=389361.

Diagnostic information for administrators:

Generating server: SJ0PR04MB7504.namprd04.prod.outlook.com Receiving server: SJ0PR04MB7504.namprd04.prod.outlook.com

[email protected]
7/7/2026 3:58:12 PM - Server at SJ0PR04MB7504.namprd04.prod.outlook.com returned '550 5.4.317 Message expired, cannot connect to remote server(Failed to connect. Winsock error code: 995, Win32 error code: 995)'
7/7/2026 3:48:53 PM - Server at 199.255.45.85 (199.255.45.85) returned '450 4.4.317 Cannot establish session with remote server [Message=Failed to connect. Winsock error code: 995, Win32 error code: 995] [LastAttemptedServerName=199.255.45.85] [LastAttemptedIP=199.255.45.85:25] [SmtpSecurity=-2;-2] [BL02EPF00046C14.namprd07.prod.outlook.com 2026-07-07T15:48:53.514Z 08DED27250BC5691](Failed to connect. Winsock error code: 995, Win32 error code: 995)'

Original message headers:

Received: from SA0PR04MB7354.namprd04.prod.outlook.com (2603:10b6:806:e9::12)
by SJ0PR04MB7504.namprd04.prod.outlook.com (2603:10b6:a03:32e::6) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.14; Tue, 7 Jul
2026 13:57:00 +0000
Received: from SN7PR04MB8601.namprd04.prod.outlook.com (2603:10b6:806:2e2::13)
by SA0PR04MB7354.namprd04.prod.outlook.com (2603:10b6:806:e9::12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.13; Tue, 7 Jul
2026 02:47:13 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=ZQZLmSN8ZFt3IqVJ+cvs0l6ccWzVpwOSpEyJmJ+buB9AuhTJPwhbh0sBEDya41YZzxREswQQdQgZArz7rlhFrshmUn0VawsFsux+pBziwly3isW6T1F2Hhk8JBXr7ukaSS+1J61bntprN3YvlN1DrlzF9cHOAhsMCmWYUB9EnXxzsUwkVj+ccysAKqnEps0pQtkuDqztDeHDgrXuVeykNEdM9JC+rwS9ghtX3onirrCGv+RR38kFe73WXnr9AZbH8wok6dwjqGskI1Qw9OYE5cAj5P1vqfftx72K8Ng24LG9j09bVkNQXNetb6nYT/JbtzIATbpvjEQHQPIf8l2p2g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=B+QafvzKcmkbe/vB2mZ7imHvd1YjyqLfJAKS3svHs6g=; b=J/ILygxivJqsAxfYKfiUxNvCyshbIBp4Q2AqjodvxDC7KtKpXBnGIxUSfV9HPxpNdBIRy8eVP4QGvCLHF1fsFhqg0xEN3LzRCbI5ikGA/Or3F/NhB7calx0W1Urnsbth9wz5NrxRW3Vn9rJcJxjxh0/355YgZzYiEWfIjBfAKQXPKfTnC0XkIMR2Ty5zU36tzGKdy6qpQO9ESLlEdRD9R/LYaO+h3Ed7inKJQGy7mlyIqa3QoVLJNPUxsW4Tbg3IEnBUjhfnQ+vBsHGhOGLD6pm1Nt+3ptcMJyEXX/jb6jkjD2X5uUlP8JiLjRP8a3AsU83aVkwVTsx36BfSyyTPjQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip
is 216.71.154.45) smtp.rcpttodomain=wdc.com smtp.mailfrom=kernel.org;
dmarc=pass (p=quarantine sp=quarantine pct=100) action=none
header.from=kernel.org; dkim=pass (signature was verified)
header.d=kernel.org; arc=none (0)
Received: from SJ0PR13CA0082.namprd13.prod.outlook.com (2603:10b6:a03:2c4::27)
by SN7PR04MB8601.namprd04.prod.outlook.com (2603:10b6:806:2e2::13) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.9; Mon, 6 Jul 2026
15:45:00 +0000
Received: from SJ1PEPF000023D2.namprd02.prod.outlook.com
(2603:10b6:a03:2c4:cafe::63) by SJ0PR13CA0082.outlook.office365.com
(2603:10b6:a03:2c4::27) with Microsoft SMTP Server (version=TLS1_3,
cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.9 via Frontend Transport; Mon, 6
Jul 2026 15:44:59 +0000
Authentication-Results: spf=softfail (sender IP is 216.71.154.45)
smtp.mailfrom=kernel.org; dkim=pass (signature was verified)
header.d=kernel.org;dmarc=pass action=none header.from=kernel.org;
Received-SPF: SoftFail (protection.outlook.com: domain of transitioning
kernel.org discourages use of 216.71.154.45 as permitted sender)
Received: from esa6.hgst.iphmx.com (216.71.154.45) by
SJ1PEPF000023D2.mail.protection.outlook.com (10.167.244.9) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.21.181.6 via Frontend Transport; Mon, 6 Jul 2026 15:44:59 +0000
X-CSE-ConnectionGUID: EZy8/M+xTm6Ity5uQCDGgQ==
X-CSE-MsgGUID: pKZerHYiT5iV8FUzkc0c7g==
Received-SPF: Pass (esa6.hgst.iphmx.com: domain of
[email protected] designates 172.234.252.31 as permitted
sender) identity=mailfrom; client-ip=172.234.252.31;
receiver=esa6.hgst.iphmx.com;
envelope-from="[email protected]"; x-sender="[email protected]";
x-conformance=spf_only; x-record-type="v=spf1";
x-record-text="v=spf1 ip4:52.25.139.140 ip4:172.105.4.254
ip4:172.234.252.31 ip4:172.234.120.38 ip4:172.105.64.184
~all"
Received-SPF: None (esa6.hgst.iphmx.com: no sender authenticity
information available from domain of
[email protected]) identity=helo;
client-ip=172.234.252.31; receiver=esa6.hgst.iphmx.com;
envelope-from="[email protected]";
x-sender="[email protected]";
x-conformance=spf_only
Authentication-Results-Original: esa6.hgst.iphmx.com; spf=Pass
[email protected]; spf=None
[email protected]; dkim=pass (signature verified)
[email protected]; dmarc=pass (p=quarantine dis=none) d=kernel.org
IronPort-SDR: 6a4bcd7a_OohJWw8r2oYesZY7iGnE/PXfIcBz+W9XHTzhDG1Fho2Yn94
tDmvoja1ScQGKub7dfIIYhyi6NgweZnBuXTTupA==
X-ThreatScanner-Verdict: Negative
X-IPAS-Result: =?us-ascii?q?A0FEAgCwzEtqhR/86qxTB4JZgkGBCl8zBAtJhFiIe4ZYW?=
=?us-ascii?q?wEBBoE+A4t0hneLMIF8AhMBDVEEAQEDBIFLgzQCjU4CHgcBNAkOAQIBAgEDA?=
=?us-ascii?q?gMBAQEBAQEBAQEBAQsBAQEEAQEBAgEBAgQDAQEBAQIQAQEBAUBJhk8NgluBL?=
=?us-ascii?q?IEmAQEBAQEBAQEBAQEBHQINfgEBAQMSEQQLAQ0BATcBDwkCGAICJgICVgYTC?=
=?us-ascii?q?BqCYAGCIgdKA54+jkQBgSk/AigBQAEMgQuKDn8zgQGCDAEBBgQDAgLcJIFpA?=
=?us-ascii?q?wYUAYEKLohbAYV2hAJ6Jxt9gRCEQD6EJQmDcIJqgiZ6EoJIjldSeBwDWSwBS?=
=?us-ascii?q?wo1DDMrRUMDgSkPPAU3ZRI/IR0fDh45AjgHBRIgERlBRSMDJ1k/OE4FgVkCZ?=
=?us-ascii?q?4EhTiMfAzl/gTB1Sjs+LYECAQIuCmxCJIEpA3g9NxQbjjIXD4IJIhEBWDYsg?=
=?us-ascii?q?gYFCSmTALN0hCehckkDlz2TGZkIqUKBaDqBXH0IgyJQAxkPjjoliFfJKUI1A?=
=?us-ascii?q?jsCBwIHDgMLkWgrCWtgAQE?=
IronPort-PHdr: A9a23:FxhfTxQF5ttbRiTEL72JY3DJltpsosyXAWYlg6HPa5pwe6iut67vI
FbYra00ygOSA8ODsrkb06KW6/mmBTdcp87Z8TgrS99la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V7mZniehILKFvAG0WKB+UyCJ8SWzIc0vs
1dmupFeb/N5DNB7foSjjPXL+od
X-Talos-CUID: =?us-ascii?q?9a23=3AdLJtsGuZAXq3ZxuG0nUS/jCt6IsIQGyNi1KTM3O?=
=?us-ascii?q?9V0d1WeCIcHS816xdxp8=3D?=
X-Talos-MUID: =?us-ascii?q?9a23=3Ao9c3+A2K3bbddxOV2lrmLo9bazUj+4ecBVotoJQ?=
=?us-ascii?q?65si6ZQJNKTSW1D/oTdpy?=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-AV: E=Sophos;i="6.25,149,1779120000";
d="scan'208";a="148946905"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from sea.source.kernel.org ([172.234.252.31])
by esa6.hgst.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Jul 2026 23:44:57 +0800
Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])

        by sea.source.kernel.org (Postfix) with ESMTP id C7CD1432F2;
        Mon,  6 Jul 2026 15:44:57 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2760F1F00A3D;
        Mon,  6 Jul 2026 15:44:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
        s=k20260515; t=1783352697;
        bh=B+QafvzKcmkbe/vB2mZ7imHvd1YjyqLfJAKS3svHs6g=;
        h=Date:From:To:Cc:Subject:References:In-Reply-To;
        b=HENOhOJQSxAGgJ8ISWGePG95mFkJTfbz42cn7IvTb/mUFxVVfvi+wYLz8Bhw8D5+H
         qbk7kwPjfCfAqvBg2047Js9c4ZhUt49p5cx+w/AwoRfiMlEPcNPNTHTMqUZygwJ33p
         e8e2DG0kW79o5rtd1hrLtuLeKdfxFa70dc+i5ClvPxp9TfyIZ8IQ6UiAqa305BIhFn
         3w1iX946iMJZ8wM3G//rt72yG4zeXaercXj1S9i8zXCbZfDZ3d57c9W/U8sFkQQmfF
         TFgUAElsSdNMSGQQw1FL0TksPoObm9qz/SGbb3USv/NEd9TlsteJAlkWwVeM8STgDS
         +IUcnn4B/HlvA==

Date: Mon, 6 Jul 2026 17:44:49 +0200
From: Manivannan Sadhasivam <[email protected]>
To: Can Guo <[email protected]>
CC: [email protected], [email protected], [email protected],
[email protected], [email protected],
Alim Akhtar <[email protected]>, Avri Altman <[email protected]>,
"James E.J. Bottomley" <[email protected]>, open list <[email protected]>
Subject: Re: [PATCH v2] scsi: ufs: core: Avoid possible memory reclaim
deadlock in TX EQTR context
Message-ID: <h5lsilzmxhu3jyujladib3w75nsute7yrkr4t5sg57nwzwb2ek@d4btnbylvrvu>
References: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <[email protected]>
Return-Path: [email protected]
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D2:EE_|SN7PR04MB8601:EE_|SA0PR04MB7354:EE_|SJ0PR04MB7504:EE_
X-MS-Office365-Filtering-Correlation-Id: cf9bede7-f8fe-44b9-1fef-08dedb758914
X-Microsoft-Antispam: BCL:0;ARA:13230040|2092899012|82310400026|3072899012|12012899012|13003099007|18002099003|16102099003|22082099003|11063799006|56012099006|19002099009|6133799003;
X-Microsoft-Antispam-Message-Info: =?utf-8?B?WjFDT0JNbDBwR0I0UGJsVUhVUUdVQTRhUEFTTnppbjdVMlJDQjBvOWdZNWlj?=
=?utf-8?B?RnhMdzk2Y21GNi94aEZuUDFOTVF2clJIWjdaWlBvQ1NvcFo2dGJ5dU1JRTRH?=
=?utf-8?B?WmdLejlYUHlHdFI2U3RXL09vSXZiK1NZVEU4V01kMnREeGdhRnFBYmlITlI1?=
=?utf-8?B?ZnhnUkZHZ2xqOE84NERjMG5qRU0vYzRTQUovTUkzdE9GUzlmZTNpdnVLTDFK?=
=?utf-8?B?cnN6eExwMDRQaGN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PV:NLI;SFV:NSPM;H:esa6.hgst.iphmx.com;PTR:esa6.hgst.iphmx.com;CAT:NONE;SFS:(13230040)(2092899012)(82310400026)(3072899012)(12012899012)(13003099007)(18002099003)(16102099003)(22082099003)(11063799006)(56012099006)(19002099009)(6133799003);DIR:INB; X-Exchange-RoutingPolicyChecked: S/XJuRvJovcKR05qjx1Et77PuLD5ORMxqVsIDMtLDKJHw9tHBciUtjihy6H6aqIkAHjjx/n20h0NwBiEIc9RP3Ddj2sGwFeFdfSB4+VxUjbOniaw6xlibypl7oN4sZytInt+83PczzwtMSX3eRwvwz5Vy5I4kSnmiOCOLzqLje5XKXcneVDVfRvRBGIEUXxXeLX5ZLzHnTIN7krqq5Pkwo+Rf2EaA+GwdzIJK0Vrm8UCiqeMAzPpLduEnj46qNDHKAKwboVDJ4z9cH5JLwXOKrJRz4wy3bqyfBe65bSje2jzH0UbDyTo0mc8tncnQYpBt1paDfhPw57TcH6N+7EQcg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2026 15:44:59.0030
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: cf9bede7-f8fe-44b9-1fef-08dedb758914
X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86;Ip=[216.71.154.45];Helo=[esa6.hgst.iphmx.com]
X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023D2.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR04MB8601
X-OrganizationHeadersPreserved: SN7PR04MB8601.namprd04.prod.outlook.com
X-OriginatorOrg: sharedspace.onmicrosoft.com
X-CrossPremisesHeadersFilteredByDsnGenerator:

        SJ0PR04MB7504.namprd04.prod.outlook.com

Reporting-MTA: dns;SJ0PR04MB7504.namprd04.prod.outlook.com
Received-From-MTA: dns;SA0PR04MB7354.namprd04.prod.outlook.com
Arrival-Date: Tue, 7 Jul 2026 13:57:00 +0000

Final-Recipient: rfc822;[email protected]
Action: failed
Status: 5.4.317
Diagnostic-Code: smtp;550 5.4.317 Message expired, cannot connect to remote server
X-Display-Name: Avri Altman

Date: Mon, 6 Jul 2026 17:44:49 +0200
From: Manivannan Sadhasivam <[email protected]>
To: Can Guo <[email protected]>
CC: [email protected], [email protected], [email protected],
[email protected], [email protected], Alim Akhtar
<[email protected]>, Avri Altman <[email protected]>, "James E.J. Bottomley" <[email protected]>, open list <[email protected]>
Subject: Re: [PATCH v2] scsi: ufs: core: Avoid possible memory reclaim
deadlock in TX EQTR context

Quoted 12 lines · Can Guo

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

Quoted 7 lines

This is preferred over tagging individual call sites with GFP_NOIO, as it automatically covers any future allocations added anywhere in the call tree without requiring each caller to be aware of this constraint.

Fixes 03e5d38e2f98 ("scsi: ufs: core: Add support for TX Equalization")

- Mani

Quoted 60 lines

---
v1 -> v2:
- Replaced per-allocation GFP_NOIO usage with memalloc_noio_save/restore() around ufshcd_tx_eqtr() call tree.

 drivers/ufs/core/ufs-txeq.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/ufs/core/ufs-txeq.c +17 -2
index 4b264adfdf49..9dca0cd344b8 100644
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/sched/mm.h>
 #include <ufs/ufshcd.h>
 #include <ufs/unipro.h>
 #include "ufshcd-priv.h"
@@ -1212,14 +1213,25 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 			  struct ufs_pa_layer_attr *pwr_mode)
 {
 	struct ufs_pa_layer_attr old_pwr_info;
+	unsigned int noio_flag;
 	int ret;
 
+	/*
+	 * ufshcd_tx_eqtr() is called from a power-mode-change context where
+	 * I/O is suspended. Use memalloc_noio_save() to propagate GFP_NOIO
+	 * to all allocations in the call tree instead of tagging each call
+	 * site individually.
+	 */
+	noio_flag = memalloc_noio_save();
+
 	if (!params->eqtr_record) {
 		params->eqtr_record = devm_kzalloc(hba->dev,
 						   sizeof(*params->eqtr_record),
 						   GFP_KERNEL);
-		if (!params->eqtr_record)
-			return -ENOMEM;
+		if (!params->eqtr_record) {
+			ret = -ENOMEM;
+			goto out_noio_restore;
+		}
 	}
 
 	memcpy(&old_pwr_info, &hba->pwr_info, sizeof(struct ufs_pa_layer_attr));
@@ -1244,6 +1256,9 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
 	if (ret)
 		ufshcd_tx_eqtr_unprepare(hba, &old_pwr_info);
 
+out_noio_restore:
+	memalloc_noio_restore(noio_flag);
+
 	return ret;
 }
 
Signature · 1 line
2.34.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#8 lore raw

Re: Undeliverable: Re: [PATCH v2] scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

Quoted 4 lines · Manivannan Sadhasivam

Are you willing to continue your role as UFS reviewer? If so, could you please fix your email address to avoid bouncing?

I can also send a patch for that if you want. Let me know!

Please take a look at upstream commit b65b608eb8ff ("scsi: mailmap:
Update Avri Altman's email address").

Bart.

#9 lore raw

Re: Undeliverable: Re: [PATCH v2] scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

Quoted 9 lines · Bart Van Assche
Quoted 4 lines · Manivannan Sadhasivam

Are you willing to continue your role as UFS reviewer? If so, could you please fix your email address to avoid bouncing?

I can also send a patch for that if you want. Let me know!

Please take a look at upstream commit b65b608eb8ff ("scsi: mailmap:
Update Avri Altman's email address").

Ah ok!

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#10 lore raw
In reply to Can Guo

Can,

Quoted 6 lines

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Applied to 7.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen
#11 lore raw
In reply to Can Guo
Quoted 6 lines · Can Guo

TX EQTR may run while devfreq gear scaling has quiesced the UFS tagset. In that context, functions ufshcd_tx_eqtr(), __ufshcd_tx_eqtr() and ufs_qcom_get_rx_fom() allocate memory with GFP_KERNEL. If direct reclaim is triggered, reclaim/writeback can depend on I/O to UFS device. Because the queue is quiesced, this can cause deadlock.

Quoted 7 lines

Use memalloc_noio_save/restore() in ufshcd_tx_eqtr() to cover all allocations in the TX EQTR call tree, including:
- params->eqtr_record in ufshcd_tx_eqtr()
- eqtr_data in __ufshcd_tx_eqtr()
- params in ufs_qcom_get_rx_fom()

[...]

Applied to 7.3/scsi-queue, thanks!

[1/1] scsi: ufs: core: Avoid possible memory reclaim deadlock in TX EQTR context

      https://git.kernel.org/mkp/scsi/c/760fc6f0e25a
Signature · 1 line
Martin K. Petersen