* Qemu (host) <-> host userspace signaling?
@ 2009-05-31 17:38 pav
2009-06-01 7:51 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: pav @ 2009-05-31 17:38 UTC (permalink / raw)
To: kvm
Hello,
I am looking for a simple way to get a bidirectional event notification
interface between qemu/kvm and host userspace processes. Just a "kick",
messages/data not required.
What I basically need is a way to have an interested host process
informed by a custom qemu device that something happened (i.e. after a
MMIO write) and the other way around - to allow similar notifications
from the process to the qemu device. Of course I do not want qemu to
sleep.
Instant reaction to such events is not required.
I understand I could use a unix socket and qemu_chr_open() and friends
for this, but isn't a full-blown socket a bit of an overkill for a simple
"kick" interface?
>From what I understand qemu would then act as a server and sleep just
after starting (or later?), waiting for connections? Or maybe there is a
way to reverse it, have qemu be the client, although that could still
make qemu sleep?.
I guess it could use some kind of poll/select, but I am not sure where in
qemu should such code be put in though...
Or maybe there is something else for this in qemu already? I had thought
iosignalfd or eventfd were made for that, but if I understand correctly,
they communicate with the guest and are for something different?
I would be very greatful for your help.
Best regards,
Pav
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Qemu (host) <-> host userspace signaling?
2009-05-31 17:38 Qemu (host) <-> host userspace signaling? pav
@ 2009-06-01 7:51 ` Avi Kivity
2009-06-01 17:15 ` Gregory Haskins
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2009-06-01 7:51 UTC (permalink / raw)
To: pav; +Cc: kvm
pav wrote:
> Hello,
>
> I am looking for a simple way to get a bidirectional event notification
> interface between qemu/kvm and host userspace processes. Just a "kick",
> messages/data not required.
>
>
> What I basically need is a way to have an interested host process
> informed by a custom qemu device that something happened (i.e. after a
> MMIO write) and the other way around - to allow similar notifications
> from the process to the qemu device. Of course I do not want qemu to
> sleep.
> Instant reaction to such events is not required.
>
>
> I understand I could use a unix socket and qemu_chr_open() and friends
> for this, but isn't a full-blown socket a bit of an overkill for a simple
> "kick" interface?
>
Not at all. Send a byte to have the other side wake up.
> From what I understand qemu would then act as a server and sleep just
> after starting (or later?), waiting for connections? Or maybe there is a
> way to reverse it, have qemu be the client, although that could still
> make qemu sleep?.
> I guess it could use some kind of poll/select, but I am not sure where in
> qemu should such code be put in though...
>
You can have have qemu act as a client or as server, and wait for
connections or not.
> Or maybe there is something else for this in qemu already? I had thought
> iosignalfd or eventfd were made for that, but if I understand correctly,
> they communicate with the guest and are for something different?
>
iosiginalfd and irqfd are slightly more efficient, but you need to make
them available to another process by passing them over a unix domain
socket with SCM_RIGHTS. So they are more cumbersome to set up.
irqfd also requires MSI support in the guest.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Qemu (host) <-> host userspace signaling?
2009-06-01 7:51 ` Avi Kivity
@ 2009-06-01 17:15 ` Gregory Haskins
2009-06-01 17:40 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Gregory Haskins @ 2009-06-01 17:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: pav, kvm
[-- Attachment #1: Type: text/plain, Size: 340 bytes --]
Avi Kivity wrote:
> pav wrote:
>>
>>
>> I understand I could use a unix socket and qemu_chr_open() and
>> friends for this, but isn't a full-blown socket a bit of an overkill
>> for a simple "kick" interface?
>>
>
> Not at all. Send a byte to have the other side wake up.
FWIW: you could also use an eventfd here.
-Greg
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Qemu (host) <-> host userspace signaling?
2009-06-01 17:15 ` Gregory Haskins
@ 2009-06-01 17:40 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-06-01 17:40 UTC (permalink / raw)
To: Gregory Haskins; +Cc: pav, kvm
Gregory Haskins wrote:
> Avi Kivity wrote:
>
>> pav wrote:
>>
>>> I understand I could use a unix socket and qemu_chr_open() and
>>> friends for this, but isn't a full-blown socket a bit of an overkill
>>> for a simple "kick" interface?
>>>
>>>
>> Not at all. Send a byte to have the other side wake up.
>>
> FWIW: you could also use an eventfd here.
>
To share the eventfd with someone else you need a unix domain socket
anyway. Once you do that setup, however, it works out quite nicely
(esp. if it's connected to iosignalfd).
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-01 17:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-31 17:38 Qemu (host) <-> host userspace signaling? pav
2009-06-01 7:51 ` Avi Kivity
2009-06-01 17:15 ` Gregory Haskins
2009-06-01 17:40 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox