From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: GNTTABOP_unmap_grant_ref doc Date: Wed, 24 Jul 2013 19:30:28 +0100 Message-ID: <51F01D44.8060107@cantab.net> References: <51EFCD66.9000402@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51EFCD66.9000402@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Scott Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On 24/07/13 13:49, David Scott wrote: > Hi, > > I've been working on the Mirage (mini-OS + OCaml runtime) blkback > implementation. It seems to be working much more happily now but I was a > bit surprised by the GNTTABOP_unmap_grant_ref doc -- maybe I misread it. > > In ./xen/include/public/grant_table.h it says > > /* > * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings > * tracked by . If or is zero, that > * field is ignored. If non-zero, they must refer to a device/host mapping > * that is tracked by > * NOTES: > * 1. The call may fail in an undefined manner if either mapping is not > * tracked by . > * 3. After executing a batch of unmaps, it is guaranteed that no stale > * mappings will remain in the device or host TLBs. > */ > > When I read > "If or is zero, that field is ignored" > "The call may fail in an undefined manner if either mapping is not > tracked by " > > I thought, "great, I'll not bother tracking anything except the handle > and set both fields to zero". However if I set host_addr to zero then my > frontend complains bitterly > > gnttab_stubs.c: WARNING: g.e. 53 still in use! (19) > > If I store the host_addr and fill it in during the unmap, everything > seems to work. > > So did I misread the doc? Or did it mean exclusive-or i.e. you must fill > in either one of these two fields? Or have I done something stupid > elsewhere (always possible)? If host_addr is non-zero, a host (cpu) mapping is cleared. If dev_bus_addr is non-zero a device (iommu) mapping is cleared. If both are zero, GNTTAB_unmap_grant_ref is a no-op. David