[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0908261201570.7780@makko.or.mcafeemobile.com>
Date: Wed, 26 Aug 2009 12:13:04 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Avi Kivity <avi@...hat.com>
cc: "Michael S. Tsirkin" <mst@...hat.com>, gleb@...hat.com,
kvm@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/2] eventfd: new EFD_STATE flag
On Wed, 26 Aug 2009, Avi Kivity wrote:
> On 08/26/2009 08:45 PM, Davide Libenzi wrote:
> > OK, if I get it correctly, there is one eventfd signaler (the device), and
> > one eventfd reader (the hypervisor), right?
> > Each hypervisor listens for multiple devices detecting state changes, and
> > associating the eventfd "line" to the IRQ number by some configuration
> > (ala PCI), right?
> >
>
> Yes. The PCI stuff happens in userspace, all the hypervisor sees is "this
> eventfd is IRQ 10". There may be multiple eventfds routed to one IRQ
> (corresponding to a shared IRQ line).
Ok, so why not using the eventfd counter as state?
On the device side:
void write_state(int sfd, int state) {
u64 cnt;
/* Clear the current state, sfd is in non-blocking mode */
read(sfd, &cnt, sizeof(cnt));
/* Writes new state */
cnt = 1 + !!state;
write(sfd, &cnt, sizeof(cnt));
}
On the hypervisor side:
int read_state(int sfd) {
u64 cnt;
read(sfd, &cnt, sizeof(cnt));
return state - 1;
}
- Davide
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists