From: Ian Campbell Subject: Re: [V1 PATCH 4/5] PVH xen tools: xenstored changes Date: Thu, 5 Sep 2013 11:04:53 +0100 Message-ID: <1378375493.14745.16.camel@kazak.uk.xensource.com> References: <1378344728-30624-1-git-send-email-mukesh.rathor@oracle.com> <1378344728-30624-5-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VHWQr-0003Kl-Jk for xen-devel@lists.xenproject.org; Thu, 05 Sep 2013 10:04:57 +0000 In-Reply-To: <1378344728-30624-5-git-send-email-mukesh.rathor@oracle.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: Mukesh Rathor Cc: xen-devel@lists.xenproject.org, Ian.Jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Wed, 2013-09-04 at 18:32 -0700, Mukesh Rathor wrote: > Allow map_interface in xenstored to revert to the old > xc_map_foreign_range if xc_gnttab_map_grant_ref is unable > to map the mfn because the guest is auto translate. Please can you describe here when/why this might be the case. Also you change is messing up the indentation. xenstored uses hard tabs. > Signed-off-by: Mukesh Rathor > --- > tools/xenstore/xenstored_domain.c | 12 +++++++----- > 1 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c > index bf83d58..10c23a1 100644 > --- a/tools/xenstore/xenstored_domain.c > +++ b/tools/xenstore/xenstored_domain.c > @@ -168,13 +168,15 @@ static int readchn(struct connection *conn, void *data, unsigned int len) > static void *map_interface(domid_t domid, unsigned long mfn) > { > if (*xcg_handle != NULL) { > - /* this is the preferred method */ > - return xc_gnttab_map_grant_ref(*xcg_handle, domid, > + void *addr; > + /* this is the preferred method */ > + addr = xc_gnttab_map_grant_ref(*xcg_handle, domid, > GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE); > - } else { > - return xc_map_foreign_range(*xc_handle, domid, > - getpagesize(), PROT_READ|PROT_WRITE, mfn); > + if (addr) > + return addr; > } > + return xc_map_foreign_range(*xc_handle, domid, > + getpagesize(), PROT_READ|PROT_WRITE, mfn); > } > > static void unmap_interface(void *interface)