All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>,
	kwolf@redhat.com, mreitz@redhat.com, famz@redhat.com,
	qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v0 0/2] Postponed actions
Date: Tue, 17 Jul 2018 11:31:56 +0100	[thread overview]
Message-ID: <20180717103156.GB9927@stefanha-x1.localdomain> (raw)
In-Reply-To: <20180702151843.GJ2155@stefanha-x1.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2279 bytes --]

On Mon, Jul 02, 2018 at 04:18:43PM +0100, Stefan Hajnoczi wrote:
> On Fri, Jun 29, 2018 at 03:40:50PM +0300, Denis Plotnikov wrote:
> > There are cases when a request to a block driver state shouldn't have
> > appeared producing dangerous race conditions.
> > This misbehaviour is usually happens with storage devices emulated
> > without eventfd for guest to host notifications like IDE.
> > 
> > The issue arises when the context is in the "drained" section
> > and doesn't expect the request to come, but request comes from the
> > device not using iothread and which context is processed by the main loop.
> > 
> > The main loop apart of the iothread event loop isn't blocked by the
> > "drained" section.
> > The request coming and processing while in "drained" section can spoil the
> > block driver state consistency.
> > 
> > This behavior can be observed in the following KVM-based case:
> > 
> > 1. Setup a VM with an IDE disk.
> > 2. Inside a VM start a disk writing load for the IDE device
> >   e.g: dd if=<file> of=<file> bs=X count=Y oflag=direct
> > 3. On the host create a mirroring block job for the IDE device
> >   e.g: drive_mirror <your_IDE> <your_path>
> > 4. On the host finish the block job
> >   e.g: block_job_complete <your_IDE>
> >  
> > Having done the 4th action, you could get an assert:
> > assert(QLIST_EMPTY(&bs->tracked_requests)) from mirror_run.
> > On my setup, the assert is 1/3 reproducible.
> > 
> > The patch series introduces the mechanism to postpone the requests
> > until the BDS leaves "drained" section for the devices not using iothreads.
> > Also, it modifies the asynchronous block backend infrastructure to use
> > that mechanism to release the assert bug for IDE devices.
> 
> I don't understand the scenario.  IDE emulation runs in the vcpu and
> main loop threads.  These threads hold the global mutex when executing
> QEMU code.  If thread A is in a drained region with the global mutex,
> then thread B cannot run QEMU code since it would need to global mutex.
> 
> So I guess the problem is not that thread B will submit new requests,
> but maybe that the IDE DMA code will run a completion in thread A and
> submit another request in the drained region?

Ping! :)

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-07-18  8:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 12:40 [Qemu-devel] [PATCH v0 0/2] Postponed actions Denis Plotnikov
2018-06-29 12:40 ` [Qemu-devel] [PATCH v0 1/2] async: add infrastructure for postponed actions Denis Plotnikov
2018-06-29 12:40 ` [Qemu-devel] [PATCH v0 2/2] block: postpone the coroutine executing if the BDS's is drained Denis Plotnikov
2018-09-10 12:41   ` Kevin Wolf
2018-09-12 12:03     ` Denis Plotnikov
2018-09-12 13:15       ` Kevin Wolf
2018-09-12 14:53         ` Denis Plotnikov
2018-09-12 15:09           ` Kevin Wolf
2018-09-12 17:03         ` Denis V. Lunev
2018-09-13  8:44           ` Kevin Wolf
2018-07-02  1:47 ` [Qemu-devel] [PATCH v0 0/2] Postponed actions no-reply
2018-07-02 15:18 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-07-17 10:31   ` Stefan Hajnoczi [this message]
2018-07-16 15:01 ` [Qemu-devel] " Denis Plotnikov
2018-07-16 18:59   ` [Qemu-devel] [Qemu-block] " John Snow
2018-07-18  7:53     ` Denis Plotnikov
2018-08-13  8:32     ` Denis Plotnikov
2018-08-13 16:30       ` Kevin Wolf
2018-08-14  7:08         ` Denis Plotnikov
2018-08-20  7:40           ` Denis Plotnikov
2018-08-20  7:42           ` Denis Plotnikov
2018-08-27  7:05           ` Denis Plotnikov
2018-08-27 16:05             ` John Snow
2018-08-28 10:23               ` Denis Plotnikov
2018-09-10 10:11                 ` Denis Plotnikov

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=20180717103156.GB9927@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@gmail.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 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.