From: "Jan Beulich" Subject: Re: [PATCH 3/4] move XENMEM_add_to_physmap_range handling framework to common code Date: Wed, 18 Dec 2013 16:08:44 +0000 Message-ID: <52B1D69C020000780010EE13@nat28.tlf.novell.com> References: <52B1BF76020000780010EC02@nat28.tlf.novell.com> <52B1C0C9020000780010EC27@nat28.tlf.novell.com> <20131218155955.GK24792@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VtJfx-000753-RA for xen-devel@lists.xenproject.org; Wed, 18 Dec 2013 16:08:46 +0000 In-Reply-To: <20131218155955.GK24792@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: xen-devel , Keir Fraser , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org >>> On 18.12.13 at 16:59, Tim Deegan wrote: > 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. I'm afraid I don't follow: XENMAPSPACE_gmfn_range and XENMAPSPACE_gmfn will be treated equally now - there simply is no range being specified for the individual add_to_physmap_range elements. After all, xenmem_add_to_physmap_one() - as its name says - really only processes a single page. Jan