[KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-18 Thread Gregory Haskins
iosignalfd is a mechanism to register PIO/MMIO regions to trigger an eventfd signal when written to by a guest. Host userspace can register any arbitrary IO address with a corresponding eventfd and then pass the eventfd to a specific end-point of interest for handling. Normal IO requires a blocki

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Michael S. Tsirkin
Some comments below: On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > iosignalfd is a mechanism to register PIO/MMIO regions to trigger an eventfd > signal when written to by a guest. Host userspace can register any arbitrary > IO address with a corresponding eventfd and then pa

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > Some comments below: > > On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > >> iosignalfd is a mechanism to register PIO/MMIO regions to trigger an eventfd >> signal when written to by a guest. Host userspace can register any arbitrary >> IO address w

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Paolo Bonzini
+ * Design note: We create one PIO/MMIO device (iosignalfd_group) which + * aggregates one or more iosignalfd_items. Each item points to exactly one + * eventfd, and can be registered to trigger on any write to the group + * (wildcard), or to a write of a specific value. If more than one item

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory Haskins wrote: > >> + * notification when the memory has been touched. > >> + * > >> + */ > >> + > >> +/* > >> + * Design note: We create one PIO/MMIO device (iosignalfd_group) whi

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory Haskins wrote: > + * notification when the memory has been touched. + * + */ + +/* + * Design note: We create one PIO/M

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Sorry, Michael. I missed that you had other comments after the grammatical one. Will answer inline Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory Haskins wrote: > + * notification when the memory has been touched. + * --

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 08:56:28AM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory Haskins wrote: > > > + * notification when the memory has been touched. > + * -

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Avi Kivity
On 06/22/2009 04:08 PM, Michael S. Tsirkin wrote: It doesn't bother me as such. But you seem to care about such things :). If you do care, other comments in kvm don't seem to be like this and people won't remember to add spaces in comments, though. Really, we don't need to standardize every

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Michael S. Tsirkin
On Mon, Jun 22, 2009 at 09:04:48AM -0400, Gregory Haskins wrote: > Sorry, Michael. I missed that you had other comments after the > grammatical one. Will answer inline > > Michael S. Tsirkin wrote: > > On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory Haskins wrote: > > > + * notificatio

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 08:56:28AM -0400, Gregory Haskins wrote: > >> >> Heh...well, the first one ("aggregates one") is just a plain typo. >> The others are just me showing my age, perhaps: >> >> http://desktoppub.about.com/cs/typespacing/a/onetwospaces.htm >> >>

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Mon, Jun 22, 2009 at 09:04:48AM -0400, Gregory Haskins wrote: > >> Sorry, Michael. I missed that you had other comments after the >> grammatical one. Will answer inline >> >> Michael S. Tsirkin wrote: >> >>> On Mon, Jun 22, 2009 at 08:13:48AM -0400, Gregory

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Avi Kivity
On 06/22/2009 04:13 PM, Michael S. Tsirkin wrote: Right, understood. What I meant specifically is that if the (void*)val pointer is allowed to be misaligned we are in trouble ;). I haven't studied the implementation in front of the MMIO callback recently, but I generally doubt thats the case.

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Avi Kivity
On 06/22/2009 04:19 PM, Gregory Haskins wrote: The question to ask is whether a guest can influence that condition. If they can, its an attack vector to crash the host. I suspect they can't, however. Therefore, your recommendation is perhaps a good approach so this condition cannot ever go unn

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-22 Thread Gregory Haskins
Avi Kivity wrote: > On 06/22/2009 04:19 PM, Gregory Haskins wrote: >> The question to ask is whether a guest can influence that condition. If >> they can, its an attack vector to crash the host. I suspect they can't, >> however. Therefore, your recommendation is perhaps a good approach so >> thi

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Michael S. Tsirkin
On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > +static int > +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, > + int is_write) > +{ > + struct _iosignalfd_group *p = to_group(this); > + > + return ((addr >= p->addr && (ad

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Avi Kivity
On 06/23/2009 11:56 AM, Michael S. Tsirkin wrote: On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: +static int +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, + int is_write) +{ + struct _iosignalfd_group *p = to_group

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Michael S. Tsirkin
On Tue, Jun 23, 2009 at 12:57:53PM +0300, Avi Kivity wrote: > On 06/23/2009 11:56 AM, Michael S. Tsirkin wrote: >> On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: >> >>> +static int >>> +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, >>> +

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Avi Kivity
On 06/23/2009 01:48 PM, Michael S. Tsirkin wrote: On Tue, Jun 23, 2009 at 12:57:53PM +0300, Avi Kivity wrote: On 06/23/2009 11:56 AM, Michael S. Tsirkin wrote: On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: +static int +iosignalfd_group_in_range(struct kvm_

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > >> +static int >> +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, >> + int is_write) >> +{ >> +struct _iosignalfd_group *p = to_group(this); >> + >>

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Michael S. Tsirkin
On Tue, Jun 23, 2009 at 07:33:07AM -0400, Gregory Haskins wrote: > Michael S. Tsirkin wrote: > > On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > > > >> +static int > >> +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, > >> +int is

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Tue, Jun 23, 2009 at 07:33:07AM -0400, Gregory Haskins wrote: > >> Michael S. Tsirkin wrote: >> >>> On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: >>> >>> +static int +iosignalfd_group_in_range(struct kvm_io_device *this,

Re: [KVM PATCH v8 3/3] KVM: add iosignalfd support

2009-06-23 Thread Gregory Haskins
Michael S. Tsirkin wrote: > On Thu, Jun 18, 2009 at 08:30:46PM -0400, Gregory Haskins wrote: > >> +static int >> +iosignalfd_group_in_range(struct kvm_io_device *this, gpa_t addr, int len, >> + int is_write) >> +{ >> +struct _iosignalfd_group *p = to_group(this); >> + >>