qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org, Jeff Cody <jcody@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/2] qemu-iotests: reduce chance of races in 185
Date: Thu, 10 May 2018 08:24:24 -0500	[thread overview]
Message-ID: <fd86c6a9-998d-cb22-bfa6-e33113fa13b0@redhat.com> (raw)
In-Reply-To: <20180510100537.GP1296@stefanha-x1.localdomain>

On 05/10/2018 05:05 AM, Stefan Hajnoczi wrote:

>>> Add sleep 0.5 to reduce the chance of races.  This is not a real fix but
>>> appears to reduce spurious failures in practice.
>>>
>>> Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> ---
>>>    tests/qemu-iotests/185 | 12 ++++++++++++
>>>    1 file changed, 12 insertions(+)
>>
>> I'm not opposed to this patch, but is there any way to write the test to
>> take both events in either order, without logging the events as they arrive,
>> but instead summarizing in a deterministic order which events were received
>> after the fact?  That way, no matter which way the race is won, we merely
>> log that we got two expected events, and could avoid the extra sleep.
> 
> I don't think there is a practical way of doing that without big changes
> to the test.  It could be rewritten in Python to make filtering the QMP
> events easier.
> 
> Hiding the race doesn't solve the deeper problem though: the test case
> doesn't exercise the same code path each time.  The test should really
> cover all cancellation points in the block job lifecycle instead of just
> one at random.  If we solve this problem then we don't need to filter
> the QMP event sequence.
> 
> Maybe it can be done with blkdebug.  If not then maybe a blockjobdbg
> interface is necessary to perform deterministic tests (eliminating the
> need for the ratelimiting trick used by this test!).

So trying to restate your question - can blkdebug be used to pause I/O, 
or does it just cause an error?  If the rate limiting is in effect, then 
we expect that the job will only write to the first half of a 
destination, so a blkdebug injected error for writes to the second half 
would either not trigger (the normal cancel won the race) or does 
trigger (the job advanced before the normal cancel, but blkdebug's 
injected error also serves as a means of cancelling the job, so while 
we'd have to filter things, we at least have a deterministic way of 
ending the job before it runs to completion). Except that I'm writing 
that without even re-reading the test in question to see how it would 
all fit in.  It may or may not be worth pursuing.

> 
> Please share ideas, but I think this is a long-term item that shouldn't
> block this series.

I agree that any further improvements don't need to hold up this patch 
from making things at least more reliable, even if not perfect.  So:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-05-10 13:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 13:54 [Qemu-devel] [PATCH v2 0/2] qemu-iotests: post-QEMU 2.12 fixes for 185 Stefan Hajnoczi
2018-05-08 13:54 ` [Qemu-devel] [PATCH v2 1/2] qemu-iotests: reduce chance of races in 185 Stefan Hajnoczi
2018-05-08 14:26   ` Eric Blake
2018-05-10 10:05     ` Stefan Hajnoczi
2018-05-10 13:24       ` Eric Blake [this message]
2018-05-10 14:01   ` Vladimir Sementsov-Ogievskiy
2018-05-08 13:54 ` [Qemu-devel] [PATCH v2 2/2] blockjob: do not cancel timer in resume Stefan Hajnoczi
2018-05-08 14:28   ` Eric Blake
2018-05-14  8:35   ` QingFeng Hao
2018-05-14 11:40 ` [Qemu-devel] [PATCH v2 0/2] qemu-iotests: post-QEMU 2.12 fixes for 185 Jeff Cody

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=fd86c6a9-998d-cb22-bfa6-e33113fa13b0@redhat.com \
    --to=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /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).