All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [patch uq/master 1/2] virtio-pci: wake up iothread on VIRTIO_PCI_QUEUE_NOTIFY
Date: Mon, 22 Feb 2010 12:16:02 -0300	[thread overview]
Message-ID: <20100222151602.GD18992@amt.cnet> (raw)
In-Reply-To: <4B829A02.3040605@redhat.com>

On Mon, Feb 22, 2010 at 04:51:46PM +0200, Avi Kivity wrote:
> On 02/22/2010 04:29 PM, Marcelo Tosatti wrote:
> >On Mon, Feb 22, 2010 at 04:20:52PM +0200, Avi Kivity wrote:
> >>On 02/22/2010 03:59 PM, Marcelo Tosatti wrote:
> >>>VIRTIO_PCI_QUEUE_NOTIFY is used to inform availability of new buffers,
> >>>so wakeup the iothread to process that information immediately.
> >>>
> >>>Reported-by: Amit Shah<amit.shah@redhat.com>
> >>>Signed-off-by: Marcelo Tosatti<mtosatti@redhat.com>
> >>>
> >>>Index: qemu/hw/virtio-pci.c
> >>>===================================================================
> >>>--- qemu.orig/hw/virtio-pci.c
> >>>+++ qemu/hw/virtio-pci.c
> >>>@@ -204,6 +204,7 @@ static void virtio_ioport_write(void *op
> >>>          break;
> >>>      case VIRTIO_PCI_QUEUE_NOTIFY:
> >>>          virtio_queue_notify(vdev, val);
> >>>+        qemu_notify_event();
> >>>          break;
> >>virtio_queue_notify() will call ->handle_output(), which should
> >>either do what's needed to be done, or wake up some iothread itself.
> >kick is used to inform either output processing, in which case
> >->handle_output() does what its supposed to.
> >
> >But its also used to inform availability of new buffers, which is common
> >to all virtio devices. So what is the point pushing this to
> >->handle_output?
> 
> I don't understand what this means.  ->handle_output() _is_
> informing the device model of new buffers.  What more is needed?
> 
> >Are you concerned about spurious wakeups?
> 
> Yes.  Also, qemu_notify_event() is an undirected notification (wakes
> up all iothreads, and all devices), whereas ->handle_output() is
> directed (wakes up exactly what is needed).
>
> What's the underlying problem?  A new input buffer has become
> available, and we need to re-poll the incoming file descriptor?  If
> so, that's best done from ->handle_output() (either by waking the
> iothread or calling read() itself and perhaps receiving -EAGAIN).

Yes. Sure, perhaps calling read() itself is appropriate, and i see 
your point that >handle_output contains more context for a smarter
decision.

But one can argue thats an improvement on top of a dumb wakeup.


WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [patch uq/master 1/2] virtio-pci: wake up iothread on VIRTIO_PCI_QUEUE_NOTIFY
Date: Mon, 22 Feb 2010 12:16:02 -0300	[thread overview]
Message-ID: <20100222151602.GD18992@amt.cnet> (raw)
In-Reply-To: <4B829A02.3040605@redhat.com>

On Mon, Feb 22, 2010 at 04:51:46PM +0200, Avi Kivity wrote:
> On 02/22/2010 04:29 PM, Marcelo Tosatti wrote:
> >On Mon, Feb 22, 2010 at 04:20:52PM +0200, Avi Kivity wrote:
> >>On 02/22/2010 03:59 PM, Marcelo Tosatti wrote:
> >>>VIRTIO_PCI_QUEUE_NOTIFY is used to inform availability of new buffers,
> >>>so wakeup the iothread to process that information immediately.
> >>>
> >>>Reported-by: Amit Shah<amit.shah@redhat.com>
> >>>Signed-off-by: Marcelo Tosatti<mtosatti@redhat.com>
> >>>
> >>>Index: qemu/hw/virtio-pci.c
> >>>===================================================================
> >>>--- qemu.orig/hw/virtio-pci.c
> >>>+++ qemu/hw/virtio-pci.c
> >>>@@ -204,6 +204,7 @@ static void virtio_ioport_write(void *op
> >>>          break;
> >>>      case VIRTIO_PCI_QUEUE_NOTIFY:
> >>>          virtio_queue_notify(vdev, val);
> >>>+        qemu_notify_event();
> >>>          break;
> >>virtio_queue_notify() will call ->handle_output(), which should
> >>either do what's needed to be done, or wake up some iothread itself.
> >kick is used to inform either output processing, in which case
> >->handle_output() does what its supposed to.
> >
> >But its also used to inform availability of new buffers, which is common
> >to all virtio devices. So what is the point pushing this to
> >->handle_output?
> 
> I don't understand what this means.  ->handle_output() _is_
> informing the device model of new buffers.  What more is needed?
> 
> >Are you concerned about spurious wakeups?
> 
> Yes.  Also, qemu_notify_event() is an undirected notification (wakes
> up all iothreads, and all devices), whereas ->handle_output() is
> directed (wakes up exactly what is needed).
>
> What's the underlying problem?  A new input buffer has become
> available, and we need to re-poll the incoming file descriptor?  If
> so, that's best done from ->handle_output() (either by waking the
> iothread or calling read() itself and perhaps receiving -EAGAIN).

Yes. Sure, perhaps calling read() itself is appropriate, and i see 
your point that >handle_output contains more context for a smarter
decision.

But one can argue thats an improvement on top of a dumb wakeup.

  reply	other threads:[~2010-02-22 15:18 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 13:59 [patch uq/master 0/2] wake iothread on virtio kick / flush_coalesced_mmio smp_wmb Marcelo Tosatti
2010-02-22 13:59 ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 13:59 ` [patch uq/master 1/2] virtio-pci: wake up iothread on VIRTIO_PCI_QUEUE_NOTIFY Marcelo Tosatti
2010-02-22 13:59   ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 14:20   ` Avi Kivity
2010-02-22 14:20     ` [Qemu-devel] " Avi Kivity
2010-02-22 14:29     ` Marcelo Tosatti
2010-02-22 14:29       ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 14:51       ` Avi Kivity
2010-02-22 14:51         ` [Qemu-devel] " Avi Kivity
2010-02-22 15:16         ` Marcelo Tosatti [this message]
2010-02-22 15:16           ` Marcelo Tosatti
2010-02-22 15:29           ` Anthony Liguori
2010-02-22 15:29             ` [Qemu-devel] " Anthony Liguori
2010-02-22 15:32             ` Avi Kivity
2010-02-22 15:32               ` [Qemu-devel] " Avi Kivity
2010-02-22 15:42               ` Anthony Liguori
2010-02-22 15:42                 ` [Qemu-devel] " Anthony Liguori
2010-02-22 15:55                 ` Avi Kivity
2010-03-12  2:45                 ` [patch 0/2] introduce QEMUIOWorker and wake up iothread on virtio-serial-bus notification Marcelo Tosatti
2010-03-12  2:45                   ` [Qemu-devel] " Marcelo Tosatti
2010-03-12  2:45                   ` [patch 1/2] Pass QEMUIOWorker to qemu_notify_event Marcelo Tosatti
2010-03-12  2:45                     ` [Qemu-devel] " Marcelo Tosatti
2010-03-22 21:16                     ` Anthony Liguori
2010-03-22 21:16                       ` Anthony Liguori
2010-03-25 13:47                       ` [Qemu-devel] [patch 0/2] introduce QEMUIOWorker and wake up iothread on virtio-serial-bus notification (v2) Marcelo Tosatti
2010-03-25 13:47                         ` [Qemu-devel] [patch 1/2] Pass QEMUIOWorker to qemu_notify_event Marcelo Tosatti
2010-03-25 21:06                           ` Paul Brook
2010-03-26  3:55                             ` Marcelo Tosatti
2010-03-26 15:23                               ` Paul Brook
2010-03-26 15:40                                 ` Anthony Liguori
2010-03-25 13:47                         ` [Qemu-devel] [patch 2/2] virtio-serial-bus: wake up iothread upon guest read notification Marcelo Tosatti
2010-03-12  2:45                   ` Marcelo Tosatti
2010-03-12  2:45                     ` [Qemu-devel] " Marcelo Tosatti
2010-03-12  5:53                     ` Amit Shah
2010-03-12  5:53                       ` [Qemu-devel] " Amit Shah
2010-02-22 13:59 ` [patch uq/master 2/2] kvm-all.c: define smp_wmb and use it for coalesced mmio Marcelo Tosatti
2010-02-22 13:59   ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 14:23   ` Avi Kivity
2010-02-22 14:23     ` [Qemu-devel] " Avi Kivity
2010-02-22 14:45     ` Marcelo Tosatti
2010-02-22 14:45       ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 14:57       ` Avi Kivity
2010-02-22 14:57         ` [Qemu-devel] " Avi Kivity
2010-02-22 14:57         ` Michael S. Tsirkin
2010-02-22 14:57           ` [Qemu-devel] " Michael S. Tsirkin
2010-02-22 15:08           ` Avi Kivity
2010-02-22 15:08             ` [Qemu-devel] " Avi Kivity
2010-02-22 15:08             ` Michael S. Tsirkin
2010-02-22 15:08               ` [Qemu-devel] " Michael S. Tsirkin
2010-02-22 15:28               ` Avi Kivity
2010-02-22 15:28                 ` [Qemu-devel] " Avi Kivity
2010-02-22 14:44   ` Michael S. Tsirkin
2010-02-22 14:44     ` [Qemu-devel] " Michael S. Tsirkin
2010-02-22 16:57   ` Marcelo Tosatti
2010-02-22 16:57     ` [Qemu-devel] " Marcelo Tosatti
2010-02-22 17:04     ` Avi Kivity
2010-02-22 17:04       ` [Qemu-devel] " Avi Kivity

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=20100222151602.GD18992@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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 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.