From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Sasha Levin <levinsasha928@gmail.com>,
kvm@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Marcelo Tosatti <mtosatti@redhat.com>,
Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_PIPE
Date: Mon, 04 Jul 2011 14:19:39 +0300 [thread overview]
Message-ID: <4E11A1CB.2080709@redhat.com> (raw)
In-Reply-To: <20110704110723.GD11386@redhat.com>
On 07/04/2011 02:07 PM, Michael S. Tsirkin wrote:
> On Mon, Jul 04, 2011 at 01:45:07PM +0300, Avi Kivity wrote:
> > On 07/04/2011 01:32 PM, Michael S. Tsirkin wrote:
> > >On Sun, Jul 03, 2011 at 08:04:49PM +0300, Sasha Levin wrote:
> > >> The new flag allows passing a write side of a pipe instead of an
> > >> eventfd to be notified of writes to the specified memory region.
> > >>
> > >> Instead of signaling an event, the value written to the memory region
> > >> is written to the pipe.
> > >>
> > >> Using a pipe instead of an eventfd is usefull when any value can be
> > >> written to the memory region but we're interested in recieving the
> > >> actual value instead of just a notification.
> > >>
> > >> A simple example for practical use is the serial port. we are not
> > >> interested in an exit every time a char is written to the port, but
> > >> we do need to know what was written so we could handle it on the guest.
> > >
> > >Looking at this example, how would you handle a pipe full condition?
> > >We can't buffer unlimited amount of data in the host.
> >
> > Stall.
>
> Right, but the guest gets no indication that the pipe is full.
> Something like virtio would let the guest do something useful
> instead of stalling the vcpu.
That's not a problem. The vcpu blocks, which lets the other process get
the cpu and run with it. If there are not enough cpu resources, we'll
indeed stall the vcpu, but that happens whenever you're overcommitted
anyway.
> Also noting that the fd can be set not to block, or that
> a signal can interrupt the write. Both cases are not errors.
One thing we can do is return via the normal KVM_EXIT_MMIO method and
hope userspace knows how to handle this. Otherwise I don't see what we
can do.
> > >
> > >If pipe is non-blocking, or if we get a signal,
> > >this might fail or return a value< len.
> > >Data will be lost then, won't it?
> >
> > Yes. Need a loop-until-buffer-exhausted-or-error.
>
> Signal handling becomes a problem. You don't want a
> full pipe to prevent qemu from getting killed or
> getting a timer alert.
Maybe we should require AF_UNIX SOCK_SEQPACKET connection. That gives
us atomicity, and drops the need for a mutex.
> >
> > We should allow unix domain sockets as well. In fact, for
> > read/write support, we need this to be a unix domain socket.
>
> Sockets are actually better at this than pipes
> as you can at least make the writes
> non-blocking by passing in a message flag.
I'm not sure we want that. How do we handle it?
If the socket buffers get filled up, it's time for the vcpu to wait for
the mmio server process. Let the scheduler sort things out.
btw, like vhost-net and other thread offloads, this sort of trick is
dangerous. When you have excess cpu resources throughput improves, but
once the system is loaded, the workload is needlessly spread across more
cores than strictly necessary and communication is done by context
switches instead of user/system transitions.
> If we support sockets, do we really need to support
> pipes at all
I think not.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-07-04 11:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-03 17:04 [PATCH] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_PIPE Sasha Levin
2011-07-03 17:16 ` Avi Kivity
2011-07-03 17:44 ` Sasha Levin
2011-07-03 17:57 ` Pekka Enberg
2011-07-04 10:27 ` Avi Kivity
2011-07-04 10:49 ` Michael S. Tsirkin
2011-07-04 10:57 ` Avi Kivity
2011-07-04 14:38 ` Sasha Levin
2011-07-04 14:45 ` Avi Kivity
2011-07-04 14:52 ` Sasha Levin
2011-07-04 14:59 ` Avi Kivity
2011-07-06 4:37 ` Sasha Levin
2011-07-06 11:30 ` Avi Kivity
2011-07-04 10:32 ` Michael S. Tsirkin
2011-07-04 10:45 ` Avi Kivity
2011-07-04 11:07 ` Michael S. Tsirkin
2011-07-04 11:19 ` Avi Kivity [this message]
2011-07-04 11:45 ` Michael S. Tsirkin
2011-07-04 11:49 ` Avi Kivity
2011-07-04 12:12 ` Michael S. Tsirkin
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=4E11A1CB.2080709@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=penberg@kernel.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