From: Ian Campbell Subject: Re: [PATCH v3 2/3] xen: implement guest_physmap_(un)pin_range Date: Thu, 15 Aug 2013 15:32:35 +0100 Message-ID: <1376577155.9273.184.camel@hastur.hellion.org.uk> References: <1375720856-8593-2-git-send-email-stefano.stabellini@eu.citrix.com> <1375959133.970.58.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: xen-devel@lists.xensource.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2013-08-14 at 17:08 +0100, Stefano Stabellini wrote: > On Thu, 8 Aug 2013, Ian Campbell wrote: > > > + if ( !third || > > > + !third[third_table_offset(addr)].p2m.valid || > > > + third[third_table_offset(addr)].p2m.avail & P2M_DMA_PIN ) > > > > At this point rc == -EFAULT, which doesn't seem right when failing the > > P2M_DMA_PIN check. > > I'll go with -EINVAL. Do you have any better suggestions otherwise? -EBUSY sort of fits here I guess? > > > + if ( third[third_table_offset(addr)].p2m.avail & P2M_DMA_PIN ) > > > + { > > > + rc = -EINVAL; > > > + printk("%s: cannot change p2m mapping for paddr=%"PRIpaddr > > > + " domid=%d, the page is pinned\n", __func__, addr, d->domain_id); > > > > Not sure if a guest can trigger this, if yes then gdprintk. > > > > Do we always clear this bit when we clear the present bit? If not then > > we could end up with entries which are pinned and not-present. We should > > probably avoid that one way or another! > > I went through the code: yes we do, because we always reset the entire > pte entry rather than only the valid bit. Good! Ian.