qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Ming Lei <ming.lei@canonical.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 2/2] virtio-scsi: dataplane: notify guest as batch
Date: Tue, 11 Nov 2014 17:28:37 +0000	[thread overview]
Message-ID: <20141111172837.GB22150@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1415668630-30073-3-git-send-email-ming.lei@canonical.com>

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

On Tue, Nov 11, 2014 at 09:17:10AM +0800, Ming Lei wrote:
> +static void notify_guest_bh(void *opaque)
> +{
> +    VirtIOSCSI *s = opaque;
> +    unsigned int qid;
> +    uint64_t pending = s->pending_guest_notify;
> +
> +    s->pending_guest_notify = 0;
> +
> +    while ((qid = ffsl(pending))) {
> +        qid--;
> +        event_notifier_set(&s->cmd_vrings[qid]->guest_notifier);
> +        pending &= ~(1 << qid);
> +    }
> +}

Looks like we're not honoring virtio's usual interrupt mitigation
mechanism (e.g. EVENT_IDX) for virtio-scsi.  Why is
vring_should_notify() not used?

> +
>  static void virtio_scsi_bad_req(void)
>  {
>      error_report("wrong size for virtio-scsi headers");
> @@ -824,7 +839,12 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
>      }
>  
>      if (s->conf.iothread) {
> -        virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread);
> +        VirtIOSCSI *vis = VIRTIO_SCSI(s);
> +
> +        QEMU_BUILD_BUG_ON(VIRTIO_PCI_QUEUE_MAX > 64);
> +        virtio_scsi_set_iothread(vis, s->conf.iothread);
> +        vis->pending_guest_notify = 0;
> +        vis->guest_notify_bh = aio_bh_new(vis->ctx, notify_guest_bh, vis);

Have you checked state transitions like PCI or virtio reset?  They need
to cancel the BH and clear ->pending_guest_notify.

There is also a transition from dataplane to non-dataplane mode for live
migration.

Please make sure no interrupts are dropped or stale data is kept across
these transitions.

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2014-11-11 17:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11  1:17 [Qemu-devel] [PATCH v1 0/2] virtio-scsi: dataplane: one fix and one optimization Ming Lei
2014-11-11  1:17 ` [Qemu-devel] [PATCH v1 1/2] virtio-scsi: dataplane: fix allocation for 'cmd_vrings' Ming Lei
2014-11-11  1:28   ` Fam Zheng
2014-11-11 11:03   ` Paolo Bonzini
2014-11-11  1:17 ` [Qemu-devel] [PATCH v1 2/2] virtio-scsi: dataplane: notify guest as batch Ming Lei
2014-11-11  1:52   ` Fam Zheng
2014-11-11  2:29     ` Ming Lei
2014-11-11  2:52       ` Fam Zheng
2014-11-11  3:08         ` Ming Lei
2014-11-11 17:28   ` Stefan Hajnoczi [this message]
2014-11-12  2:33     ` Ming Lei

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=20141111172837.GB22150@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=ming.lei@canonical.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).