Skip to contentSkip to conversation

scsi: lsi problems since "unit attention on reset"

Qemu-devel Jan Kiszka 2 participants 9 messages Sep 26, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi Paolo,

I'm facing problems over latest qemu with our special guest OS that is using the LSI controller. It hangs during boot now. This can be resolved by reverting commit c7b488721d (scsi: report unit attention on reset).

I cannot exclude a bug in the guest driver at this point, but maybe you also have some idea what could go wrong in the SCSI stack or the LSI emulation. Any suggestions where to look at would be welcome.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#1 lore raw
Quoted 9 lines · Jan Kiszka

Hi Paolo,

I'm facing problems over latest qemu with our special guest OS that is using the LSI controller. It hangs during boot now. This can be resolved by reverting commit c7b488721d (scsi: report unit attention on reset).

I cannot exclude a bug in the guest driver at this point, but maybe you also have some idea what could go wrong in the SCSI stack or the LSI emulation. Any suggestions where to look at would be welcome.

It works for me under Linux, so I suspect it is a bug in the guest OS or the BIOS, which should send TEST UNIT READY before trying to communicate to the HBA. You can use tracing to detect that, it probably sends something like READ CAPACITY and fails because it does not expect that command to fail.

That said, since there are 3 out of 3 BIOSes that couldn't cope with that change---Linux and Windows work of course---it makes sense to revert it even though the patch by itself is correct. If you send it out, I'll gladly add my Acked-by.

Paolo

author
#2 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Jan Kiszka

Hi Paolo,

I'm facing problems over latest qemu with our special guest OS that is using the LSI controller. It hangs during boot now. This can be resolved by reverting commit c7b488721d (scsi: report unit attention on reset).

I cannot exclude a bug in the guest driver at this point, but maybe you also have some idea what could go wrong in the SCSI stack or the LSI emulation. Any suggestions where to look at would be welcome.

Quoted 5 lines

It works for me under Linux, so I suspect it is a bug in the guest OS or the BIOS, which should send TEST UNIT READY before trying to communicate to the HBA. You can use tracing to detect that, it probably sends something like READ CAPACITY and fails because it does not expect that command to fail.

I'm just getting these scsi events, then the guest stops:

scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0 scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0 scsi_req_alloc target 0 lun 0 tag 0 scsi_test_unit_ready target 0 lun 0 tag 0 scsi_req_build_sense target 0 lun 0 tag 0 key 0x6 asc 0x29 ascq 00 scsi_req_dequeue target 0 lun 0 tag 0

Quoted 5 lines

That said, since there are 3 out of 3 BIOSes that couldn't cope with that change---Linux and Windows work of course---it makes sense to revert it even though the patch by itself is correct. If you send it out, I'll gladly add my Acked-by.

We are currently checking the driver situation internally. But if you say you want it reverted in any case, I'll send a patch.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 6 lines · Jan Kiszka

scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0 scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0 scsi_req_alloc target 0 lun 0 tag 0 scsi_test_unit_ready target 0 lun 0 tag 0 scsi_req_build_sense target 0 lun 0 tag 0 key 0x6 asc 0x29 ascq 00 scsi_req_dequeue target 0 lun 0 tag 0

This looks good.

Try http://permalink.gmane.org/gmane.comp.emulators.qemu/118133 perhaps.

Paolo

author
#4 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 6 lines · Jan Kiszka

scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0 scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0 scsi_req_alloc target 0 lun 0 tag 0 scsi_test_unit_ready target 0 lun 0 tag 0 scsi_req_build_sense target 0 lun 0 tag 0 key 0x6 asc 0x29 ascq 00 scsi_req_dequeue target 0 lun 0 tag 0

This looks good.

Try http://permalink.gmane.org/gmane.comp.emulators.qemu/118133 perhaps.

Nope, no effect.

A colleague is parsing the lsi debug output ATM.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 10 lines · Jan Kiszka
Quoted 8 lines

scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0

Quoted 5 lines

scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0 scsi_req_alloc target 0 lun 0 tag 0 scsi_test_unit_ready target 0 lun 0 tag 0 scsi_req_build_sense target 0 lun 0 tag 0 key 0x6 asc 0x29 ascq 00 scsi_req_dequeue target 0 lun 0 tag 0

This looks good.

Nope, no effect.

How does the trace go on?

Paolo

author
#6 lore raw
In reply to Jan Kiszka
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Paolo Bonzini
Quoted 6 lines · Jan Kiszka

scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0 scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0 scsi_req_alloc target 0 lun 0 tag 0 scsi_test_unit_ready target 0 lun 0 tag 0 scsi_req_build_sense target 0 lun 0 tag 0 key 0x6 asc 0x29 ascq 00 scsi_req_dequeue target 0 lun 0 tag 0

Quoted 7 lines
Quoted 3 lines

This looks good.

Try http://permalink.gmane.org/gmane.comp.emulators.qemu/118133 perhaps.

Nope, no effect.

A colleague is parsing the lsi debug output ATM.

And you were right: it turned out to be a driver issue. The bug sneaked in while adapting the original driver to some specific differences between QEMU and real HW (here: lacking compat bit support).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#7 lore raw
Quoted 3 lines · Jan Kiszka

And you were right: it turned out to be a driver issue. The bug sneaked in while adapting the original driver to some specific differences between QEMU and real HW (here: lacking compat bit support).

Cool, then we can leave in the patch I think. I originally did it in hope of detecting possible bugs with (upcoming) migration support, which will use unit attention to make the guest requeue all requests on the destination. It looks like my goal has been attained.

Out of curiosity, have you ever looked into (or are you interested into) using multiple LUNs per target with the LSI driver? It crashes miserably for me with a page fault in the Linux ISR, and that's when I started using another device. :)

You can play with them on the scsi-addr branch of git://github.com/bonzini/qemu.git; just create two scsi-disk devices, with lun=0 and lun=1, and they will get the same target ID but two different LUNs. It's of course possible the bug is in my code, but then I got the same failure with two completely different implementations of the feature so...

Paolo

author
#8 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 3 lines · Jan Kiszka

And you were right: it turned out to be a driver issue. The bug sneaked in while adapting the original driver to some specific differences between QEMU and real HW (here: lacking compat bit support).

Cool, then we can leave in the patch I think. I originally did it in hope of detecting possible bugs with (upcoming) migration support, which will use unit attention to make the guest requeue all requests on the destination. It looks like my goal has been attained.

At least for this user.

Quoted 5 lines

Out of curiosity, have you ever looked into (or are you interested into) using multiple LUNs per target with the LSI driver? It crashes miserably for me with a page fault in the Linux ISR, and that's when I started using another device. :)

"Unfortunately", I haven't been confronted with such a requirement so far. :)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux