----- Original Message ----- > From: "Aaron Sierra" <[email protected]> > Sent: Thursday, May 11, 2017 8:36:35 AM
> I found it was impossible to allocate all of the address space > defined by an IOVA domain. For example, a trivial domain with 2 pages > would cover PFNs 0 (start) and 1 (limit), but attempting to allocate > more than one total PFN would fail because the start PFN could never be > allocated. > > This adds a function to prevent PFN limit calculations from dipping > "below" the start PFN in __alloc_and_insert_iova_range() and > __get_cached_rbnode(). It also alters the PFN validity checks in > __alloc_and_insert_iova_range() to anticipate possible PFN rollover. > These combine to allow every PFN within the IOVA domain to be available > for allocation. I should point out that I've understated the impact a bit. In the trivial example, 1 page isn't just 1 page, it represents half of the available address space. In less trivial examples, not being able to allocate the start PFN can prevent a range of any size that would include it. Therefore, attempting to allocate: * all of the address space in one shot will fail * the 2nd half of the address space in one shot will fail * the 4th quarter of the address space in one shot will fail * et cetera -Aaron S. > Signed-off-by: Aaron Sierra <[email protected]> > --- > drivers/iommu/iova.c | 43 +++++++++++++++++++++++++++++++------------ > 1 file changed, 31 insertions(+), 12 deletions(-) _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
