qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] virtio-scsi: Forbid devices with different iothreads sharing a blockdev
Date: Mon, 28 Jan 2019 15:57:43 +0100	[thread overview]
Message-ID: <20190128145743.GC5756@localhost.localdomain> (raw)
In-Reply-To: <w51d0ogsv1y.fsf@maestria.local.igalia.com>

Am 28.01.2019 um 15:42 hat Alberto Garcia geschrieben:
> On Thu 24 Jan 2019 10:12:22 AM CET, Kevin Wolf wrote:
> > Am 23.01.2019 um 17:16 hat Alberto Garcia geschrieben:
> >> On Wed 23 Jan 2019 04:47:30 PM CET, Paolo Bonzini wrote:
> >> >> You mean a common function with the code below?
> >> >> 
> >> >>>> +        ctx = blk_get_aio_context(sd->conf.blk);
> >> >>>> +        if (ctx != s->ctx && ctx != qemu_get_aio_context()) {
> >> >>>> +            error_setg(errp, "Cannot attach a blockdev that is using "
> >> >>>> +                       "a different iothread");
> >> >>>> +            return;
> >> >>>> +        }
> >> >> 
> >> >> Who else would be the user?
> >> >
> >> > If it isn't, probably virtio-blk should be using too.
> >> 
> >> I agree, but that's the problem that I mentioned on the cover letter.
> >> 
> >> In the virtio-blk case I don't know how to tell that the block device
> >> is using a different iothread during device_add, because the iothread
> >> is not set during realize() but by virtio_blk_data_plane_start() that
> >> happens only when I reboot the guest.
> >
> > I think the proper solution on the block layer level would be that
> > AioContext is managed per BdrvChild and only BdrvChild objects with
> > the same AioContext can be attached to the same node.
> > bdrv_set_aio_context() would then fail if another parent is already
> > using the node.
> 
> How would that solve the virtio-blk problem, though? :-?

It wouldn't, but it would make clear that bdrv_set_aio_context() can
fail and we'd have to handle the problem exactly there. So probably we
need to do something to move the data plane initialisation into realize?

The only other option I see is downgrading to non-dataplane mode, but
this would have to be silent because during machine reset we have no way
to report errors.

> > Now, Paolo keeps talking about how AioContexts are going to disappear
> > soon (TM), so I wonder whether it's still worth fixing this properly
> > now?
> 
> Either way, should we commit this series already and later update it
> once we have a proper solution for virtio-blk?

Fine with me.

Kevin

  reply	other threads:[~2019-01-28 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:53 [Qemu-devel] [PATCH 0/3] iothread-related fixes for virtio-scsi Alberto Garcia
2019-01-22 15:53 ` [Qemu-devel] [PATCH 1/3] virtio-scsi: Move BlockBackend back to the main AioContext on unplug Alberto Garcia
2019-01-22 15:53 ` [Qemu-devel] [PATCH 2/3] scsi-disk: Acquire the AioContext in scsi_*_realize() Alberto Garcia
2019-01-22 15:53 ` [Qemu-devel] [PATCH 3/3] virtio-scsi: Forbid devices with different iothreads sharing a blockdev Alberto Garcia
2019-01-23  9:46   ` Paolo Bonzini
2019-01-23 15:09     ` Alberto Garcia
2019-01-23 15:47       ` Paolo Bonzini
2019-01-23 16:16         ` Alberto Garcia
2019-01-24  9:12           ` Kevin Wolf
2019-01-28 14:42             ` Alberto Garcia
2019-01-28 14:57               ` Kevin Wolf [this message]
2019-01-28 15:46                 ` Alberto Garcia
2019-01-28 16:01                   ` Kevin Wolf
2019-01-28 16:15                     ` Alberto Garcia
2019-01-28 16:30                       ` Kevin Wolf
2019-01-28 15:31 ` [Qemu-devel] [PATCH 0/3] iothread-related fixes for virtio-scsi Kevin Wolf

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=20190128145743.GC5756@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).