From: Paolo Bonzini <pbonzini@redhat.com>
To: Deepa Srinivasan <deepa.srinivasan@oracle.com>,
stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
mark.kanda@oracle.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [Qemu-devel] [PATCH] block: Fix qemu crash when using scsi-block
Date: Thu, 23 Nov 2017 18:17:04 +0100 [thread overview]
Message-ID: <a6fed6fa-8aee-c18e-4fc2-97cbc946a7e2@redhat.com> (raw)
In-Reply-To: <3DFDA265-8685-4601-B981-1BB0007C44B4@oracle.com>
On 23/11/2017 18:05, Deepa Srinivasan wrote:
> blk_aio_prwv() now takes a void pointer and the coroutine functions
> have been modified to cast it into QEMUIOVector if needed. It does
> not use an union in BlkRwCo since this leads to code - blk_aio_prwv()
> would have to write to the void pointer member, but coroutines would
> sometimes read the QEMUIOVector member. Paolo also suggested not
> using a union.
>
> Note that a similar issue exists in
> blk_ioctl()/blk_ioctl_entry()/blk_prw() where blk_prw() always
> creates the QEMUIOVector even if blk_ioctl()/blk_ioctl_entry() does
> not need a QEMUIOVector. This will need to be fixed separately to
> keep it consistent with the AIO path.
For that it's probably simplest to inline blk_prw into blk_ioctl and
remove all the cruft:
diff --git a/block/block-backend.c b/block/block-backend.c
index 45d9101be3..ceab3166bc 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1404,12 +1404,28 @@ static void blk_ioctl_entry(void *opaque)
{
BlkRwCo *rwco = opaque;
rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset,
- rwco->qiov->iov[0].iov_base);
+ rwco->iobuf);
}
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
{
- return blk_prw(blk, req, buf, 0, blk_ioctl_entry, 0);
+ BlkRwCo rwco = (BlkRwCo) {
+ .blk = blk,
+ .iobuf = buf,
+ .offset = req,
+ .ret = NOT_DONE,
+ };
+
+ if (qemu_in_coroutine()) {
+ /* Fast-path if already in coroutine context */
+ blk_ioctl_entry(&rwco);
+ } else {
+ Coroutine *co = qemu_coroutine_create(blk_ioctl_entry, &rwco);
+ bdrv_coroutine_enter(blk_bs(blk), co);
+ BDRV_POLL_WHILE(blk_bs(blk), rwco.ret == NOT_DONE);
+ }
+
+ return rwco.ret;
}
static void blk_aio_ioctl_entry(void *opaque)
Thanks,
Paolo
next prev parent reply other threads:[~2017-11-23 17:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 15:33 [Qemu-devel] [PATCH] block: Fix qemu crash when using scsi-block Deepa Srinivasan
2017-11-22 16:34 ` Paolo Bonzini
2017-11-22 18:06 ` Kevin Wolf
2017-11-22 19:24 ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
2017-11-23 2:55 ` Deepa Srinivasan
2017-11-23 9:18 ` Paolo Bonzini
2017-11-23 16:55 ` [Qemu-devel] " Deepa Srinivasan
2017-11-23 17:05 ` Deepa Srinivasan
2017-11-23 17:17 ` Paolo Bonzini [this message]
2017-11-23 17:29 ` Kevin Wolf
2017-11-23 17:31 ` Paolo Bonzini
2017-11-23 17:34 ` Kevin Wolf
2017-11-27 18:45 ` Deepa Srinivasan
2017-12-01 17:27 ` Deepa Srinivasan
2017-11-22 17:06 ` Stefan Hajnoczi
2017-11-22 18:04 ` Kevin Wolf
2017-11-23 10:23 ` Stefan Hajnoczi
2017-11-23 10:42 ` 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=a6fed6fa-8aee-c18e-4fc2-97cbc946a7e2@redhat.com \
--to=pbonzini@redhat.com \
--cc=deepa.srinivasan@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=kwolf@redhat.com \
--cc=mark.kanda@oracle.com \
--cc=mreitz@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).