From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH 3/3] libxc: add xc_tbuf_trace() to insert trace records Date: Thu, 15 Aug 2013 15:48:51 +0100 Message-ID: <520CEA53.6010305@eu.citrix.com> References: <1374758582-29038-1-git-send-email-david.vrabel@citrix.com> <1374758582-29038-4-git-send-email-david.vrabel@citrix.com> <520CE796.1090603@eu.citrix.com> <520CE80D.5030500@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <520CE80D.5030500@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: Ian Campbell , Ian Jackson , George Dunlap , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 15/08/13 15:39, David Vrabel wrote: > On 15/08/13 15:37, George Dunlap wrote: >> On 25/07/13 14:23, David Vrabel wrote: >>> From: David Vrabel >>> >>> Add xc_tbuf_trace() to allow trace records to be added to the trace >>> buffer. The subclass and event number and up to 7 uin32_t arguments >>> may be specified. >>> >>> The hypercall sub-op used is HVMOP_xentrace which (despite the name) >>> may be used by PV guests. >> Would it make sense to make this interface more like the hypervisor's >> trace_var() -- that is, taking a sizeof() and single pointer, so that >> callers can easily pass in packed structs? > I did it like this so it would only take a single line to get a useful > trace point. Yes, I figured that: you're basically using the function call generating code to make an array of unsigned from the arguments. But if at some point in the future you decide that you need to pack a record tighter (to make records smaller or to fit more in a single record), then won't you want a different interface? On the other hand -- could you just abuse the va_args interface to DTRT anyway? e.g. consider the following: uint16_t a, b; uint32_t c; xc_tbuf_trace(xc, evt, 2, a, b, c); ----- struct foo st; xc_tbuf_trace(xc, evt, ROUND_UP(sizeof(st), sizeof(unsigned)), st); ---- 1. Would these work? 2. Is this an acceptable thing to do? If so, it certainly makes the code a lot cleaner... -George