Re: [PATCH 2/2] kvm tools: Modify ioport to use interval rbtree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2011-05-21 at 14:31 +0400, Cyrill Gorcunov wrote:
> On 05/21/2011 12:51 PM, Sasha Levin wrote:
> > Currently the ioport implementation is based on a USHRT_MAX length
> > array of ptrs to ioport_operations.
> > 
> > Instead, use an interval rbtree to map the ioports to
> > ioport_operations.
> > 
> > Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
> > ---
> ...
> > -static struct ioport_operations *ioport_ops[USHRT_MAX];
> > -
> >  void ioport__register(u16 port, struct ioport_operations *ops, int count)
> >  {
> > -	int i;
> > +	struct ioport_entry *entry;
> >  
> > -	for (i = 0; i < count; i++)
> > -		ioport_ops[port + i]	= ops;
> > +	entry = ioport_search(&ioport_tree, port);
> > +	if (entry)
> > +		rb_int_erase(&ioport_tree, &entry->node);
> > +
> 
>   Hi Sasha, if I understand this correct we're simply drop old registartion, right? I think
> it should not be like that, if one port get used for several drivers/purposes we need a
> ref-counting, but at moment I think we simply should not allow to re-register port without
> previously unregister it. Or I miss something?

Currently we register some ports as dummy ports in the ioport
initialization, and re-register them once they get someone who can use
them (for example, serial device).

Not allowing ports to re-register would mean we can't reassign ports to
serial console when the serial console module gets loaded.

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux