From: Paolo Bonzini <pbonzini@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-blk: use aio handler for data plane
Date: Tue, 29 Mar 2016 16:44:33 +0200 [thread overview]
Message-ID: <56FA94D1.3070801@redhat.com> (raw)
In-Reply-To: <20160329170848-mutt-send-email-mst@redhat.com>
On 29/03/2016 16:09, Michael S. Tsirkin wrote:
>> > Another small comment, this can be written simply as
>> >
>> > if (s->dataplane) {
>> > virtio_blk_data_plane_start(s->dataplane);
>
> True, it's best not to poke at dataplane_started.
>
> > } else {
> > virtio_blk_handle_vq(s, vq);
> > }
> >
>
> I prefer the return style I think, to stress the
> fact that this is an unusual, unexpected case.
We're getting dangerously close to personal preference, but I've noticed
virtio-scsi that you get a very common pattern of:
void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq)
{
... virtqueue_pop ...
}
static void virtio_scsi_data_plane_handle_ctrl(VirtIODevice *vdev,
VirtQueue *vq)
{
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
assert(dataplane active and started);
virtio_scsi_handle_ctrl_vq(s, vq);
}
static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
if (dataplane active) {
virtio_scsi_dataplane_start(s);
} else {
virtio_scsi_handle_ctrl_vq(s, vq);
}
}
so it's not really an unusual, unexpected case but a complete
separation between the dataplane case (handle_output starts
dataplane) and the non-dataplane case (handle_output just does
a cast and calls the actual workhorse).
Paolo
next prev parent reply other threads:[~2016-03-29 14:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 13:42 [Qemu-devel] [PATCH 0/2] dataplane: fix start/stop races Michael S. Tsirkin
2016-03-29 13:42 ` [Qemu-devel] [PATCH 1/2] virtio: add aio handler Michael S. Tsirkin
2016-03-29 14:19 ` Paolo Bonzini
2016-03-29 13:42 ` [Qemu-devel] [PATCH 2/2] virtio-blk: use aio handler for data plane Michael S. Tsirkin
2016-03-29 13:56 ` Paolo Bonzini
2016-03-29 13:58 ` Michael S. Tsirkin
2016-03-29 13:59 ` Paolo Bonzini
2016-03-29 14:05 ` Paolo Bonzini
2016-03-29 14:09 ` Michael S. Tsirkin
2016-03-29 14:44 ` Paolo Bonzini [this message]
2016-03-29 13:43 ` [Qemu-devel] [PATCH 0/2] dataplane: fix start/stop races Michael S. Tsirkin
2016-03-29 15:06 ` Cornelia Huck
2016-03-29 16:31 ` Christian Borntraeger
2016-03-30 3:04 ` tu bo
2016-03-30 7:32 ` 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=56FA94D1.3070801@redhat.com \
--to=pbonzini@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kwolf@redhat.com \
--cc=mst@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).