All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: Marc Olson <marcolso@amazon.com>
Cc: John Snow <jsnow@redhat.com>,
	qemu-devel@nongnu.org, Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] How to emulate block I/O timeout on qemu side?
Date: Tue, 13 Nov 2018 08:31:08 +0800	[thread overview]
Message-ID: <5f23bb4a-1416-a5c7-5fff-4ca6069b3369@oracle.com> (raw)
In-Reply-To: <ae6cd0bc-c0ef-7ff3-8862-d286f930fd8d@amazon.com>



On 11/13/2018 06:52 AM, Marc Olson via Qemu-devel wrote:
> On 11/11/18 11:36 PM, Dongli Zhang wrote:
>> On 11/12/2018 03:13 PM, Marc Olson via Qemu-devel wrote:
>>> On 11/3/18 10:24 AM, Dongli Zhang wrote:
>>>> The 'write' latency of sector=40960 is set to a very large value. When the I/O
>>>> is stalled in guest due to that sector=40960 is accessed, I do see below
>>>> messages in guest log:
>>>>
>>>> [   80.807755] nvme nvme0: I/O 11 QID 2 timeout, aborting
>>>> [   80.808095] nvme nvme0: Abort status: 0x4001
>>>>
>>>>
>>>> However, then nothing happens further. nvme I/O hangs in guest. I am not
>>>> able to
>>>> kill the qemu process with Ctrl+C. Both vnc and qemu user net do not work. I
>>>> need to kill qemu with "kill -9"
>>>>
>>>>
>>>> The same result for virtio-scsi and qemu is stuck as well.
>>> While I didn't try virtio-scsi, I wasn't able to reproduce this behavior using
>>> nvme on Ubuntu 18.04 (4.15). What image and kernel version are you trying
>>> against?
>> Would you like to reproduce the "aborting" message or the qemu hang?
> I could not reproduce IO hanging in the guest, but I can reproduce qemu hanging.
>> guest image: ubuntu 16.04
>> guest kernel: mainline linux kernel (and default kernel in ubuntu 16.04)
>> qemu: qemu-3.0.0 (with the blkdebug delay patch)
>>
>> Would you be able to see the nvme abort (which is indeed not supported by qemu)
>> message in guest kernel?
> Yes.
>> Once I see that message, I would not be able to kill the qemu-system-x86_64
>> command line with Ctrl+C.
> 
> I missed this part. I wasn't expecting to handle very long timeouts, but what
> appears to be happening is that the sleep doesn't get interrupted on shutdown. I
> suspect something like this, on top of the series I sent last night, should help:
> 
> diff --git a/block/blkdebug.c b/block/blkdebug.c
> index 6b1f2d6..0bfb91b 100644
> --- a/block/blkdebug.c
> +++ b/block/blkdebug.c
> @@ -557,8 +557,11 @@ static int rule_check(BlockDriverState *bs, uint64_t
> offset, uint64_t bytes)
>              remove_active_rule(s, delay_rule);
>          }
> 
> -        if (latency != 0) {
> -            qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, latency);
> +        while (latency > 0 && !aio_external_disabled(bdrv_get_aio_context(bs))) {
> +            int64_t cur_latency = MIN(latency, 1000000000ULL);
> +
> +            qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, cur_latency);
> +            latency -= cur_latency;
>          }
>      }
> 
> 
> /marc
> 
> 

I am able to interrupt qemu with above patch to periodically wake up and sleep
again.

Dongli Zhang

  reply	other threads:[~2018-11-13  0:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  8:11 [Qemu-devel] How to emulate block I/O timeout on qemu side? Dongli Zhang
2018-11-02 17:49 ` John Snow
2018-11-02 17:55   ` Marc Olson
2018-11-02 18:17     ` John Snow
2018-11-03 17:24       ` Dongli Zhang
2018-11-05 17:13         ` John Snow
2018-11-12  7:13         ` Marc Olson
2018-11-12  7:36           ` Dongli Zhang
2018-11-12 22:52             ` Marc Olson
2018-11-13  0:31               ` Dongli Zhang [this message]
2018-11-05 17:49 ` Eric Blake
2018-11-06  6:17   ` Dongli Zhang
2018-11-06  9:14     ` [Qemu-devel] [Libguestfs] " Richard W.M. Jones
2018-11-06  9:43       ` Richard W.M. Jones
2018-11-06 15:52         ` Richard W.M. Jones

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=5f23bb4a-1416-a5c7-5fff-4ca6069b3369@oracle.com \
    --to=dongli.zhang@oracle.com \
    --cc=jsnow@redhat.com \
    --cc=marcolso@amazon.com \
    --cc=qemu-block@nongnu.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 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.