From: Tim Deegan Subject: Re: [PATCH 3/4] move XENMEM_add_to_physmap_range handling framework to common code Date: Wed, 18 Dec 2013 16:59:55 +0100 Message-ID: <20131218155955.GK24792@deinos.phlegethon.org> References: <52B1BF76020000780010EC02@nat28.tlf.novell.com> <52B1C0C9020000780010EC27@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VtJXR-0005Gp-Br for xen-devel@lists.xenproject.org; Wed, 18 Dec 2013 15:59:57 +0000 Content-Disposition: inline In-Reply-To: <52B1C0C9020000780010EC27@nat28.tlf.novell.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: Jan Beulich Cc: xen-devel , Keir Fraser , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org At 14:35 +0000 on 18 Dec (1387373737), Jan Beulich wrote: > There's really nothing really architecture specific here; the > architecture specific handling is limited to > xenmem_add_to_physmap_one(). > > Note the restriction of XENMAPSPACE_gmfn_range only being supported > through XENMEM_add_to_physmap is being dropped as being pointless. Hmmm. With that restriction removed, this: > + rc = xenmem_add_to_physmap_one(d, xatpr->space, > + xatpr->foreign_domid, > + idx, gpfn); > + > + if ( unlikely(__copy_to_guest_offset(xatpr->errs, 0, &rc, 1)) ) > + { > + rc = -EFAULT; > + goto out; > + } > + > + guest_handle_add_offset(xatpr->idxs, 1); > + guest_handle_add_offset(xatpr->gpfns, 1); > + guest_handle_add_offset(xatpr->errs, 1); > + xatpr->size--; > + > + /* Check for continuation if it's not the last interation. */ > + if ( xatpr->size > 0 && hypercall_preempt_check() ) > + { > + rc = -EAGAIN; > + goto out; > + } will save the partial result of a preempted XENMAPSPACE_gmfn_range sub-op into the errors array, and then the whole operation may or may not return -EAGAIN. I guess the caller now has enough information to figure out what happened and restart, but given that the rest of this interface nicely hides preemption from the caller, it's a bit of an ugly corner case. Tim.