scsi: Fix qemu boot hang problem
PATCH 1/1 scsi: Fix qemu boot hang problem
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3
Bisect points to commit 71e75c97f97a ("scsi: convert device_busy to atomic_t"). Code inspection shows the following suspicious change in scsi_request_fn.
out_delay:
- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev))
+ if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))
blk_delay_queue(q, SCSI_QUEUE_DELAY); }
'sdev->device_busy == 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.
--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +1 -1
@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }
Signature · 1 line
1.9.1
Quoted 39 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +0
-0
drivers/scsi/scsi_lib.c static void scsi_request_fn(struct request_queue *q) · line 1780
Quoted 8 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }
Cheers,
Hannes
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 39 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +0
-0
drivers/scsi/scsi_lib.c static void scsi_request_fn(struct request_queue *q) · line 1780
Quoted 8 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }
That's a no-brainer obvious fix!
Signature · 1 line
Jens Axboe
Venkatesh Srinivas
Reviewed-byShould we wrap the sdev->device_busy read and test in a new scsi_device_busy(), so as to preserve the old polarity?
Quoted 65 lines · Jens Axboe
Quoted 42 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) &&!scsi_device_blocked(sdev))
blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)',
meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +0
-0drivers/scsi/scsi_lib.c static void scsi_request_fn(struct request_queue · line 1780
Quoted 8 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }That's a no-brainer obvious fix!
Acked-by Jens Axboe <[email protected]>--
Jens Axboe--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Venkatesh Srinivas
Should we wrap the
sdev->device_busyread and test in a newscsi_device_busy(), so as to preserve the old polarity?
I don't see a difference in polarity, or at least replacing '== 0' with '!' is not a reverse in polarity for me. Anyway, I don't really care if or how this is wrapped, as long as it is getting fixed.
Thanks,
Guenter
ping ... the problem fixed by this patch still affects the upstream kernel (v3.16-11383-gc9d2642) as well as -next (20140815).
Guenter
Quoted 47 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }
Quoted 2 lines · Guenter Roeck
ping ... the problem fixed by this patch still affects the upstream kernel (v3.16-11383-gc9d2642) as well as -next (20140815).
James, could you upstream this one in time for -rc1?
Signature · 1 line
Jens Axboe
Quoted 38 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +0
-0
drivers/scsi/scsi_lib.c static void scsi_request_fn(struct request_queue *q) · line 1779
Quoted 7 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }
Good catch!
Quoted 5 lines · Jens Axboe
Quoted 2 lines · Guenter Roeck
ping ... the problem fixed by this patch still affects the upstream kernel (v3.16-11383-gc9d2642) as well as -next (20140815).
James, could you upstream this one in time for -rc1?
It's in the core-for-3.17 updates I sent to James yesterday, just needs to be forwarded..
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Jens Axboe
Quoted 2 lines · Guenter Roeck
ping ... the problem fixed by this patch still affects the upstream kernel (v3.16-11383-gc9d2642) as well as -next (20140815).
James, could you upstream this one in time for -rc1?
It's in the core-for-3.17 updates I sent to James yesterday, just needs to be forwarded..
Great, thanks a lot!
Guenter
James, can you please send this on ASAP? Sitting for oever a week on a boot regression that comes with a patch isn't reasonable.
Quoted 53 lines · Guenter Roeck
The latest kernel fails to boot qemu arm images when using scsi for disk access. Boot gets stuck after the following messages.
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev0x0at pci 0000:00:0c.0 irq 93
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3Bisect points to commit
71e75c97f97a("scsi: convertdevice_busytoatomic_t"). Code inspection shows the following suspicious change inscsi_request_fn.
out_delay:(quoted diff) +1
-1- if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) + if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev))blk_delay_queue(q, SCSI_QUEUE_DELAY); }'
sdev->device_busy== 0' was replaced with 'atomic_read(&sdev->device_busy)', meaning the logic was reversed. Changing this expression to '!atomic_read(&sdev->device_busy)' fixes the problem.Cc Christoph Hellwig <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Webb Scales <[email protected]>Cc Jens Axboe <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_lib.c +1
-1@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q)blk_requeue_request (q, req);atomic_dec (&sdev->device_busy); out_delay: -if (atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev)) +if (!atomic_read (&sdev->device_busy) && !scsi_device_blocked (sdev))blk_delay_queue (q,SCSI_QUEUE_DELAY ); }Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---