[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2.1 13/12] xen/trace: Introduce new API


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 24 Sep 2021 15:21:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fHgElt4qryXv37AnjsR2C/8raSqMWtIc6kDlGJKdS64=; b=XfS1BC66p8onJc3u5+0JWaBSPzMwXK0RVukSuXoMT8KY4yDUTGQ57BIFvQU4TffSgBGKhLIRF6ri43x0vED/rjHX/V/oLRRf8jES0i2VZ4uRoPMEQPbZjsI8MYxAIg5XZFu+FAZSJxRBImE0r2bX4SSnAfC62GI9AlMsu/dNJjFFdtqQIhw1Ynt2n0E8ujpUNdscDN+yrW1QO3yTNZY5Kb+1gtYykQ8MFe0uL32C75D2Np2ZKn/DzKE8XpDaAg8WRw+3kgjqfsxkenSRMzOHQ4xO2J36Indtvu9J9rr+nGW1W6s+UMKjKmhLm54l1/P1q9qtP8axd4rbftGne3tm1A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DKULslxvj4CBOp419bNWYTikUaUkY3MH5w8QOaKbikqEGHyM6SnwOeqHVOhw0+TqB4Ehcg35ZGo8WCNaNF9piPScW/cltxWaXX6QqlCxTTWdK7SIqBWsI3bpYZXsZ41+kAPeXcefpBVudZTFnu6KD1/j2J7QD+mEfvyMp2/vAYMUm5OTatVZk2bZoaCFM3M+aVKSyk44WtB0aVFjpEFZ54Z/NUr0g2T5uml0binvcnaK3spflwqe0s2/olYlTZxu8V74UIh/7IIQllHrQG9Z/wMR77ZDZlgwp2qEmZwzTMQtpsdM/07K8nbuRkyKK7xrm0Vw4HPseK93+w3h/306Bw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 24 Sep 2021 13:21:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.09.2021 21:29, Andrew Cooper wrote:
> --- a/xen/include/xen/trace.h
> +++ b/xen/include/xen/trace.h
> @@ -74,6 +74,30 @@ static inline void __trace_hypercall(uint32_t event, 
> unsigned long op,
>                                       const xen_ulong_t *args) {}
>  #endif /* CONFIG_TRACEBUFFER */
>  
> +/*
> + * Create a trace record, packaging up to 7 additional parameters into a
> + * uint32_t array.
> + */
> +#define TRACE_INTERNAL(_e, _c, ...)                                     \
> +    do {                                                                \
> +        if ( unlikely(tb_init_done) )                                   \
> +        {                                                               \
> +            uint32_t _d[] = { __VA_ARGS__ };                            \
> +            BUILD_BUG_ON(ARRAY_SIZE(_d) > TRACE_EXTRA_MAX);             \
> +            __trace_var(_e, _c, sizeof(_d), sizeof(_d) ? _d : NULL);    \
> +        }                                                               \
> +    } while ( 0 )

I know we sort of disagree on this aspect, but I would really like
to understand what you (and others) think the leading underscores
are good for in macro parameter names. And if those went away, I'd
like to ask that the local variable also become e.g. d_, like we
have started doing elsewhere.

> +/* Split a uint64_t into two adjacent uint32_t's for a trace record. */
> +#define TRACE_PARAM64(p)    (uint32_t)(p), ((p) >> 32)

You don't have a leading underscore here, for example.

> +/* Create a trace record with time included. */
> +#define TRACE_TIME(_e, ...) TRACE_INTERNAL(_e, true,  ##__VA_ARGS__)
> +
> +/* Create a trace record with no time included. */
> +#define TRACE(_e, ...)      TRACE_INTERNAL(_e, false, ##__VA_ARGS__)

Is , ## __VA_ARGS__ really doing what you expect? So far it has been
my understanding that the special behavior concatenating with a
comma only applies to the GNU form of variable macro arguments, e.g.

#define TRACE(_e, args...)      TRACE_INTERNAL(_e, false, ## args)

As a minor aspect (nit) - iirc it was you who had been asking me in a
few cases to treat ## like a normal binary operator when considering
style, requesting me to have a blank on each side of it.

> +
> +

Nit: Please can you avoid introducing double blank lines?

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.