From: Ian Campbell Subject: Re: [PATCH v4 1/9] libxc: add DECLARE_HYPERCALL_BUFFER_SHADOW() Date: Wed, 7 May 2014 13:06:39 +0100 Message-ID: <1399464399.13430.26.camel@kazak.uk.xensource.com> References: <1398883012-28413-1-git-send-email-andrew.cooper3@citrix.com> <1398883012-28413-2-git-send-email-andrew.cooper3@citrix.com> <1399463154.13430.13.camel@kazak.uk.xensource.com> <536A206D.2050805@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <536A206D.2050805@citrix.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: David Vrabel Cc: Andrew Cooper , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-05-07 at 13:00 +0100, David Vrabel wrote: > On 07/05/14 12:45, Ian Campbell wrote: > > On Wed, 2014-04-30 at 19:36 +0100, Andrew Cooper wrote: > >> From: David Vrabel > >> > >> DECLARE_HYPERCALL_BUFFER_SHADOW() is like DECLARE_HYPERCALL_BUFFER() > >> except it is backed by an already allocated hypercall buffer. > > > > I suppose enhancing DECLARE_HYPERCALL_BUFFER_ARGUMENT to have this > > property has issues with unused variables? > > Yes, I think so. Although I didn't actually try it... Perhaps I should. Would be good. > > HYPERCALL_BUFFER_AS_PTR() would have been an alternative implementation > > (similar to AS_ARG), I suppose there is no particular reason to prefer > > one over the other? > > Usage of the buffer wouldn't be consistent with a regular > DECLARE_HYPERCALL_BUFFER(). It would lead to slightly more confusing > code like: > > DECLARE_HYPERCALL_BUFFER(hbuf); > unsigned long *to_send = HYPERCALL_BUFFER_AS_PTR(hbuf); > ... > if ( test_bit(p, to_send) ) > ... > rc = xc_shadow_control(xch, ctx->domid, > XEN_DOMCTL_SHADOW_OP_CLEAN, > hbuf, > ctx->save.p2m_size > NULL, 0, shadow_stats); > > And it's not as obvious that hbuf and to_send are really the same buffer > without going back to the declarations. OK. Acked-by: Ian Campbell . Ian.