[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] QEMU/KVM SCSI lock up
From: |
Matteo Frigo |
Subject: |
[Qemu-devel] QEMU/KVM SCSI lock up |
Date: |
Wed, 02 Apr 2008 20:41:24 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
kvm-64 hangs under heavy disk I/O with scsi disks. To reproduce,
create a fresh qcow2 disk, boot linux, and execute
dd if=/dev/sdX of=/dev/null bs=1M
on the fresh disk. See also
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1895893&group_id=180599
I have attached a patch that appears to fix the problem. The bug
seems to be the following. scsi_read_data() does the following
bdrv_aio_read()
r->sector += n;
r->sector_count -= n;
For reasons that I do not fully understand, bdrv_aio_read() does
not return immediately, but instead it calls scsi_read_data()
recursively. Since ``r->sector += n;'' has not been executed
yet, the re-entrant call triggers a read of the same sector, which
breaks the producer-consumer lockstep. The fix is to swap the operations
as follows:
r->sector += n;
r->sector_count -= n;
bdrv_aio_read()
A similar fix applies to scsi_write_data().
Thanks for developing kvm, it is truly an amazing piece of software.
Regards,
Matteo Frigo
scsi-patch
Description: Binary data
- [Qemu-devel] QEMU/KVM SCSI lock up,
Matteo Frigo <=