linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context
@ 2022-02-15  6:32 Christophe JAILLET
  2022-02-28  2:21 ` Martin K. Petersen
  2022-03-02  5:13 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-02-15  6:32 UTC (permalink / raw)
  To: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	MPT-FusionLinux.pdl, linux-scsi

Just a few lines below this kzalloc() we have a mutex_lock() which can
sleep.

More over, the only way to call this function is when a delayed work is
schedule. And delayed work can sleep.
  INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
    --> mptsas_firmware_event_work()
      --> mptsas_send_link_status_event()
        --> mptsas_expander_add()

So there is really no good reason to use GFP_ATOMIC here. Change it to
GFP_KERNEL to give more opportunities to the kernel.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/message/fusion/mptsas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 4acd8f9a48e1..34901bcd1ce8 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -3680,7 +3680,7 @@ mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle)
 	    MPI_SAS_EXPAND_PGAD_FORM_SHIFT), handle)))
 		return NULL;
 
-	port_info = kzalloc(sizeof(struct mptsas_portinfo), GFP_ATOMIC);
+	port_info = kzalloc(sizeof(struct mptsas_portinfo), GFP_KERNEL);
 	if (!port_info) {
 		dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
 		"%s: exit at line=%d\n", ioc->name,
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context
  2022-02-15  6:32 [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context Christophe JAILLET
@ 2022-02-28  2:21 ` Martin K. Petersen
  2022-03-02  5:13 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-02-28  2:21 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
	linux-kernel, kernel-janitors, MPT-FusionLinux.pdl, linux-scsi


Christophe,

> Just a few lines below this kzalloc() we have a mutex_lock() which can
> sleep.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context
  2022-02-15  6:32 [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context Christophe JAILLET
  2022-02-28  2:21 ` Martin K. Petersen
@ 2022-03-02  5:13 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-03-02  5:13 UTC (permalink / raw)
  To: Christophe JAILLET, Suganath Prabu Subramani, Sathya Prakash,
	Sreekanth Reddy
  Cc: Martin K . Petersen, linux-kernel, kernel-janitors,
	MPT-FusionLinux.pdl, linux-scsi

On Tue, 15 Feb 2022 07:32:34 +0100, Christophe JAILLET wrote:

> Just a few lines below this kzalloc() we have a mutex_lock() which can
> sleep.
> 
> More over, the only way to call this function is when a delayed work is
> schedule. And delayed work can sleep.
>   INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
>     --> mptsas_firmware_event_work()
>       --> mptsas_send_link_status_event()
>         --> mptsas_expander_add()
> 
> [...]

Applied to 5.18/scsi-queue, thanks!

[1/1] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context
      https://git.kernel.org/mkp/scsi/c/e3af2e3b0019

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-02  5:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  6:32 [PATCH] scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context Christophe JAILLET
2022-02-28  2:21 ` Martin K. Petersen
2022-03-02  5:13 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).