On Fri, 9 Aug 2013, Konrad Rzeszutek Wilk wrote: > On Sun, Aug 04, 2013 at 03:39:41PM +0100, Stefano Stabellini wrote: > > GNTTABOP_unmap_grant_ref unmaps a grant and replaces it with a 0 > > mapping instead of reinstating the original mapping. > > Doing so separately would be racy. > > > > To unmap a grant and reinstate the original mapping atomically we use > > GNTTABOP_unmap_and_replace. > > GNTTABOP_unmap_and_replace doesn't work with GNTMAP_contains_pte, so > > don't use it for kmaps. GNTTABOP_unmap_and_replace zeroes the mapping > > passed in new_addr so we have to reinstate it, however that is a > > per-cpu mapping only used for balloon scratch pages, so we can be sure that > > it's not going to be accessed while the mapping is not valid. > > This looks to be depend on a new structure, which is not in Linux kernel? > Are you missing a dependency patch?
Nope, GNTTABOP_unmap_and_replace and struct gnttab_unmap_and_replace are already present in include/xen/interface/grant_table.h. > Shouldn't we use some logic to figure out which hypercall to use if the > hypervisor does not support it? GNTTABOP_unmap_and_replace is not a new hypercall, it has been supported by Xen for a very long time. In a previous iteration of this patch series, I did introduce a new hypercall, but then I dropped it because I figured out that I could achieve the same thing with the existing hypercall. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/