Re: [KVM PATCH v9 2/2] KVM: add iosignalfd support

Michael S. Tsirkin
2009-07-07T13:22:25Z

On Tue, Jul 07, 2009 at 08:56:43AM -0400, Gregory Haskins wrote:
> Michael S. Tsirkin wrote:
> > On Tue, Jul 07, 2009 at 03:27:49PM +0300, Avi Kivity wrote:
> >
> >> On 07/07/2009 03:22 PM, Michael S. Tsirkin wrote:
> >>
> >>> On Tue, Jul 07, 2009 at 02:53:18PM +0300, Avi Kivity wrote:
> >>>
> >>>
> >>>>>> + /* address-range must be precise for a hit */
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> So there's apparently no way to specify that
> >>>>> you want 1,2, or 4 byte writes at address X?
> >>>>>
> >>>>>
> >>>>>
> >>>> Why would you want that?
> >>>>
> >>>>
> >>> Donnu. Why would anyone want to catch 8 byte writes at all?
> >>>
> >>>
> >> One of the natural write sizes.
> >>
> >>
> >>> Seriously, why add artificial limitations?
> >>> IMO, addr=0,len=1 and addr=0,len=2 should not conflict.
> >>>
> >>>
> >>>
> >> They should not conflict, but a two byte write need not hit a one byte
> >> registration.
> >>
> >
> > Yes. That's exactly what I'm saying. I think it should be possible to
> > create 2 fds:
> >
> > addr = 0
> > len = 1
> > addr = 0
> > len = 2
> > and at most one will ever trigger.
> >
> > But current code will not let you create the second one.
> >
> >
> Note that this was by design to keep the code simple since we don't have
> a (known) use case for overlap. At the very least, you have to address
> how data subsets are handled. But do we really need that functionality?
>
> -Greg
>

Hey, forget about overlap. Overlap does not exist as a concept. You now
spend a lot of effort to detect it. Kill all that code, and just do
this on assignment:

list_for_each(...)
if (rhs->add == lhs->addr && rhs->len == lhs->len &&
(rhs->wildcard || lhs->wildcard || rhs->data == lhs->data))
return -EEXIST;

--
MST