From: Avi Kivity <avi@qumranet.com>
To: Matteo Frigo <athena@fftw.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] QEMU/KVM SCSI lock up
Date: Thu, 03 Apr 2008 11:38:08 +0300 [thread overview]
Message-ID: <47F49770.1010906@qumranet.com> (raw)
In-Reply-To: <87k5jfixcb.fsf@fftw.org>
Matteo Frigo wrote:
> 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.
What happens (I think) is that bdrv_aio_read() completes immediately,
calls the completion callback, which starts a read for the next batch of
sectors.
> 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().
>
>
Will that not issue the read for the wrong sector?
I think the correct fix is to move r->sector and r->sector_count
adjustment into scsi_read_complete() and scsi_write_complete().
Long term we want to replace the recursion by queuing.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-04-03 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-03 0:41 [Qemu-devel] QEMU/KVM SCSI lock up Matteo Frigo
2008-04-03 8:38 ` Avi Kivity [this message]
2008-04-03 11:18 ` Matteo Frigo
2008-04-03 11:49 ` Avi Kivity
2008-04-03 11:31 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47F49770.1010906@qumranet.com \
--to=avi@qumranet.com \
--cc=athena@fftw.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).