All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@dlhnet.de>
Cc: kwolf@redhat.com, "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:19:22 +0100	[thread overview]
Message-ID: <50EE95AA.4010904@redhat.com> (raw)
In-Reply-To: <50EE8810.7080507@dlhnet.de>

Il 10/01/2013 10:21, Peter Lieven 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().
> The wait time calculated in bdrv_exceed_{bps,iops}_limits is thus
> totally wrong
> and the machine locks.
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block.c b/block.c
> index 4e28c55..309aa85 100644
> --- a/block.c
> +++ b/block.c
> @@ -159,6 +159,10 @@ void bdrv_io_limits_enable(BlockDriverState *bs)
>      bs->slice_start = qemu_get_clock_ns(vm_clock);
>      bs->slice_end   = bs->slice_start + bs->slice_time;
>      memset(&bs->io_base, 0, sizeof(bs->io_base));

Please remove this memset.

> +    bs->io_base.bytes[0] = bs->nr_bytes[0];
> +    bs->io_base.bytes[1] = bs->nr_bytes[1];
> +    bs->io_base.ios[0] = bs->nr_ops[0];
> +    bs->io_base.ios[1] = bs->nr_ops[1];
>      bs->io_limits_enabled = true;
>  }
> 

Also, perhaps you can just call

    bdrv_exceed_io_limits(bs, 0, 0, NULL);

(which also subsumes the setting of slice_time, slice_start, slice_end).

Paolo

  reply	other threads:[~2013-01-10 10:19 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 [this message]
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
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=50EE95AA.4010904@redhat.com \
    --to=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.