* [bug report] [SCSI] mvumi: GFP_KERNEL under spin lock
@ 2012-08-14 14:59 Dan Carpenter
2012-09-28 11:30 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-08-14 14:59 UTC (permalink / raw)
To: jyli; +Cc: linux-scsi, linux-kernel
Hello Jianyun Li,
The patch f0c568a478f0: "[SCSI] mvumi: Add Marvell UMI driver" from
May 11, 2011, leads to the following warning:
drivers/scsi/mvumi.c:121 mvumi_alloc_mem_resource()
error: scheduling with locks held: 'spin_lock:host_lock'
The problem is that we do a couple GPF_KERNEL allocations in
mvumi_alloc_mem_resource() and this static analysis program sees a path
where that function is called with spin_locks held.
mvumi_isr_handler() <- takes a spin lock
-> mvumi_handshake()
-> mvumi_init_data()
-> mvumi_alloc_mem_resource() <- GFP_KERNEL
The IRQ handler does print a warning before calling mvumi_handshake()
so it seems like this path doesn't get exercised very much.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bug report] [SCSI] mvumi: GFP_KERNEL under spin lock
2012-08-14 14:59 [bug report] [SCSI] mvumi: GFP_KERNEL under spin lock Dan Carpenter
@ 2012-09-28 11:30 ` Dan Carpenter
2012-09-28 11:51 ` Dan Carpenter
2012-09-29 7:14 ` [patch] [SCSI] mvumi: use GFP_ATOMIC " Dan Carpenter
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-09-28 11:30 UTC (permalink / raw)
To: jyli; +Cc: linux-scsi, linux-kernel
Whatever happened with this? You could just change the GFP_KERNEL
to GFP_ATOMIC.
regards,
dan carpenter
On Tue, Aug 14, 2012 at 05:59:27PM +0300, Dan Carpenter wrote:
> Hello Jianyun Li,
>
> The patch f0c568a478f0: "[SCSI] mvumi: Add Marvell UMI driver" from
> May 11, 2011, leads to the following warning:
> drivers/scsi/mvumi.c:121 mvumi_alloc_mem_resource()
> error: scheduling with locks held: 'spin_lock:host_lock'
>
> The problem is that we do a couple GPF_KERNEL allocations in
> mvumi_alloc_mem_resource() and this static analysis program sees a path
> where that function is called with spin_locks held.
>
> mvumi_isr_handler() <- takes a spin lock
> -> mvumi_handshake()
> -> mvumi_init_data()
> -> mvumi_alloc_mem_resource() <- GFP_KERNEL
>
> The IRQ handler does print a warning before calling mvumi_handshake()
> so it seems like this path doesn't get exercised very much.
>
> regards,
> dan carpenter
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bug report] [SCSI] mvumi: GFP_KERNEL under spin lock
2012-09-28 11:30 ` Dan Carpenter
@ 2012-09-28 11:51 ` Dan Carpenter
2012-09-29 7:14 ` [patch] [SCSI] mvumi: use GFP_ATOMIC " Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-09-28 11:51 UTC (permalink / raw)
To: linux-scsi; +Cc: linux-kernel
On Fri, Sep 28, 2012 at 02:30:22PM +0300, Dan Carpenter wrote:
> Whatever happened with this? You could just change the GFP_KERNEL
> to GFP_ATOMIC.
>
Ah, that email address is dead is what happened. I'll send a patch
that changes this to GFP_ATOMIC.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] [SCSI] mvumi: use GFP_ATOMIC under spin lock
2012-09-28 11:30 ` Dan Carpenter
2012-09-28 11:51 ` Dan Carpenter
@ 2012-09-29 7:14 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-09-29 7:14 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel, kernel-janitors
This is called from the interrupt handler and with spin_locks held. Use
GFP_ATOMIC. The call tree looks like:
mvumi_isr_handler() <- takes a spin lock
-> mvumi_handshake()
-> mvumi_init_data()
-> mvumi_alloc_mem_resource() <- GFP_KERNEL
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 783edc7..5ad8da4 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -118,7 +118,7 @@ static int mvumi_map_pci_addr(struct pci_dev *dev, void **addr_array)
static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba,
enum resource_type type, unsigned int size)
{
- struct mvumi_res *res = kzalloc(sizeof(*res), GFP_KERNEL);
+ struct mvumi_res *res = kzalloc(sizeof(*res), GFP_ATOMIC);
if (!res) {
dev_err(&mhba->pdev->dev,
@@ -128,7 +128,7 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba,
switch (type) {
case RESOURCE_CACHED_MEMORY:
- res->virt_addr = kzalloc(size, GFP_KERNEL);
+ res->virt_addr = kzalloc(size, GFP_ATOMIC);
if (!res->virt_addr) {
dev_err(&mhba->pdev->dev,
"unable to allocate memory,size = %d.\n", size);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-29 7:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 14:59 [bug report] [SCSI] mvumi: GFP_KERNEL under spin lock Dan Carpenter
2012-09-28 11:30 ` Dan Carpenter
2012-09-28 11:51 ` Dan Carpenter
2012-09-29 7:14 ` [patch] [SCSI] mvumi: use GFP_ATOMIC " Dan Carpenter
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).