From: "Jan Beulich" Subject: Re: [PATCH 4/6] mm: New XENMEM space, XENMAPSPACE_gmfn_range Date: Mon, 14 Nov 2011 10:11:32 +0000 Message-ID: <4EC0F7640200007800060BAE@nat28.tlf.novell.com> References: <1321206052-18833-1-git-send-email-jean.guyader@eu.citrix.com> <1321206052-18833-2-git-send-email-jean.guyader@eu.citrix.com> <1321206052-18833-3-git-send-email-jean.guyader@eu.citrix.com> <1321206052-18833-4-git-send-email-jean.guyader@eu.citrix.com> <1321206052-18833-5-git-send-email-jean.guyader@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1321206052-18833-5-git-send-email-jean.guyader@eu.citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jean Guyader Cc: keir@xen.org, xen-devel@lists.xensource.com, allen.m.kay@intel.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 13.11.11 at 18:40, Jean Guyader wrote: >@@ -4715,10 +4747,20 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void)= arg) > return -EPERM; > } >=20 >- rc =3D xenmem_add_to_physmap(d, xatp); >+ rc =3D xenmem_add_to_physmap(d, &xatp); >=20 > rcu_unlock_domain(d); >=20 >+ if ( rc ) I thought that we had agreed to do the copying back only for the new space. >+ { >+ if ( copy_to_guest(arg, &xatp, 1) ) >+ return -EFAULT; >+ } Also, I personally would prefer avoiding unnecessary extra return points (as they always bare the risk of being overlooked for subsequent changes, and when they aren't, the resulting patches usually are bigger and less readable). Here this is rather simple: if ( rc && ... =3D=3D XENMAPSPACE_gmfn_range && copy_to_guest(arg, &xatp, 1) ) rc =3D -EFAULT; Jan >+ >+ if ( rc =3D=3D -EAGAIN ) >+ rc =3D hypercall_create_continuation( >+ __HYPERVISOR_memory_op, "ih", op, arg); >+ > return rc; > } >=20