2019-11-04 01:38:04

by Can Guo

[permalink] [raw]
Subject: [PATCH v2 4/7] scsi: ufs: Fix register dump caused sleep in atomic context

ufshcd_print_host_regs() can be called by interrupt handler, but it may
sleep due to ufshcd_dump_regs() allocates the dump buffer memory with flag
GFP_KERNEL. Fix it by changing GFP_KERNEL to GFP_ATMOIC.

Signed-off-by: Can Guo <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f12f5a7..671ea2a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -117,7 +117,7 @@ int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
if (offset % 4 != 0 || len % 4 != 0) /* keep readl happy */
return -EINVAL;

- regs = kzalloc(len, GFP_KERNEL);
+ regs = kzalloc(len, GFP_ATOMIC);
if (!regs)
return -ENOMEM;

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2019-11-04 13:51:35

by Bean Huo (beanhuo)

[permalink] [raw]
Subject: RE: [EXT] [PATCH v2 4/7] scsi: ufs: Fix register dump caused sleep in atomic context

>
> ufshcd_print_host_regs() can be called by interrupt handler, but it may sleep due
> to ufshcd_dump_regs() allocates the dump buffer memory with flag
> GFP_KERNEL. Fix it by changing GFP_KERNEL to GFP_ATMOIC.
>
> Signed-off-by: Can Guo <[email protected]>
Reviewed-by: Bean Huo <[email protected]>