Re: [RFC v2 2/5] vfio/type1: Check reserve region conflict and update iova list

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

 



On Fri, 19 Jan 2018 09:48:22 +0000
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@xxxxxxxxxx> wrote:
> > > +static void vfio_iommu_iova_resv_refresh(struct vfio_iommu *iommu)
> > > +{
> > > +	struct vfio_domain *d;
> > > +	struct vfio_group *g;
> > > +	struct vfio_iova *node, *tmp;
> > > +	struct iommu_resv_region *resv, *resv_next;
> > > +	struct list_head resv_regions;
> > > +	phys_addr_t start, end;
> > > +
> > > +	INIT_LIST_HEAD(&resv_regions);
> > > +
> > > +	list_for_each_entry(d, &iommu->domain_list, next) {
> > > +		list_for_each_entry(g, &d->group_list, next)
> > > +			iommu_get_group_resv_regions(g->iommu_group,
> > > +							 &resv_regions);
> > > +	}
> > > +
> > > +	if (list_empty(&resv_regions))
> > > +		return;
> > > +
> > > +	list_sort(NULL, &resv_regions, vfio_resv_cmp);
> > > +
> > > +	node = list_first_entry(&iommu->iova_list, struct vfio_iova, list);
> > > +	start = node->start;
> > > +	node = list_last_entry(&iommu->iova_list, struct vfio_iova, list);
> > > +	end = node->end;  
> > 
> > list_sort() only sorts based on ->start, we added reserved regions for
> > all our groups to one list, we potentially have multiple entries with
> > the same ->start.  How can we be sure that the last one in the list
> > actually has the largest ->end value?  
> 
> Hmm.. the sorting is done on the reserved list. The start and end entries 
> are of the iova list which is kept updated on _attach(). So I don't think
> there is a problem here.

Oops, yes you're right.  List confusion.  Thanks,

Alex



[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