qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, Peter Lieven <pl@dlhnet.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] block: init bs->io_base correctly to avoid locking
Date: Thu, 10 Jan 2013 11:55:23 +0100	[thread overview]
Message-ID: <50EE9E1B.2010805@redhat.com> (raw)
In-Reply-To: <8738y9l3ka.fsf@blackfin.pond.sub.org>

Il 10/01/2013 11:45, Markus Armbruster ha scritto:
> 
>> > If io_limits are specified during runtime that exceed the number of operations in flight
>> > bs->io_base is not initialized in the else statement in bdrv_exceed_io_limits().
> I'm confused.
> 
>     if ((bs->slice_start < now)
>         && (bs->slice_end > now)) {
>         bs->slice_end = now + bs->slice_time;
>     } else {
>         bs->slice_time  =  5 * BLOCK_IO_SLICE_TIME;
>         bs->slice_start = now;
>         bs->slice_end   = now + bs->slice_time;
> 
>         bs->io_base.bytes[is_write]  = bs->nr_bytes[is_write];
>         bs->io_base.bytes[!is_write] = bs->nr_bytes[!is_write];
> 
>         bs->io_base.ios[is_write]    = bs->nr_ops[is_write];
>         bs->io_base.ios[!is_write]   = bs->nr_ops[!is_write];
>     }

bdrv_io_limits_enable correctly starts a new slice (the first three
lines of the else), but does not set io_base correctly for that slice.
Here is how io_base is used:

    bytes_base  = bs->nr_bytes[is_write] - bs->io_base.bytes[is_write];
    bytes_res   = (unsigned) nb_sectors * BDRV_SECTOR_SIZE;

    if (bytes_base + bytes_res <= bytes_limit) {
        /* no wait */
    } else {
        /* operation needs to be throttled */
    }

As a result, any I/O operations that are triggered between now and
bs->slice_end are incorrectly limited.  If 10 MB of data has been
written since the VM was started, QEMU thinks that 10 MB of data has
been written in this slice.

Paolo

  reply	other threads:[~2013-01-10 10:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10  9:21 [Qemu-devel] [PATCH] block: init bs->io_base correctly to avoid locking Peter Lieven
2013-01-10 10:19 ` Paolo Bonzini
2013-01-10 10:52   ` Peter Lieven
2013-01-10 10:55     ` Paolo Bonzini
2013-01-10 11:02       ` Peter Lieven
2013-01-10 10:45 ` Markus Armbruster
2013-01-10 10:55   ` Paolo Bonzini [this message]
2013-01-10 11:52     ` Markus Armbruster
2013-01-10 11:57       ` Peter Lieven
2013-01-10 12:09         ` Paolo Bonzini
2013-01-10 12:12           ` Peter Lieven
2013-01-10 12:15             ` Paolo Bonzini
2013-01-10 12:26               ` Peter Lieven
2013-01-10 12:58               ` Peter Lieven
2013-01-10 13:29                 ` Paolo Bonzini
2013-01-10 10:59   ` Peter Lieven
2013-01-10 11:17     ` Paolo Bonzini

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=50EE9E1B.2010805@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pl@dlhnet.de \
    --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).