On Mon, Nov 14, 2011 at 03:59:00PM -0700, Alex Williamson wrote: > On Fri, 2011-11-11 at 16:22 -0600, Christian Benvenuti (benve) wrote: [snip] > > - the user either unmaps one specific mapping or 'all of them'. > > The 'all of them' case would also take care of those cases where > > the user does _not_ keep track of mappings and simply uses > > the "unmap from 0 to ~0" each time. > > > > Because of this you could still provide an exact map/unmap logic > > and allow such "unmap from 0 to ~0" by making the latter a special > > case. > > However, if we want to allow any arbitrary/inexact unmap request, then OK. > > I can't think of any good reasons we shouldn't be more strict. I think > it was primarily just convenient to hit all the corner cases since we > merge all the requests together for tracking and need to be able to > split them back apart. It does feel a little awkward to have a 0/~0 > special case though, but I don't think it's worth adding another ioctl > to handle it. Being strict, or at least enforcing strictness, requires that the infrastructure track all the maps, so that the unmaps can be matching. This is not a natural thing with the data structures you want for all IOMMUs. For example on POWER, the IOMMU (aka TCE table) is a simple 1-level pagetable. One pointer with a couple of permission bits per IOMMU page. Handling oddly overlapping operations on that data structure is natural, enforcing strict matching of maps and unmaps is not and would require extra information to be stored by vfio. On POWER, the IOMMU operations often *are* a hot path, so manipulating those structures would have a real cost, too. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson -- 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