All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	AndrewCooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	philippe.gabriel@citrix.com,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 5/9] gcov: add new interface and 3.4 and 4.7 format support
Date: Mon, 10 Oct 2016 14:11:58 +0100	[thread overview]
Message-ID: <20161010131158.GP3687@citrix.com> (raw)
In-Reply-To: <57FB9E1302000078001161D5@prv-mh.provo.novell.com>

On Mon, Oct 10, 2016 at 05:56:35AM -0600, Jan Beulich wrote:
[...]
> Who is 9 (more similar ones below)?
> 
> > +static int counter_active(const struct gcov_info *info, unsigned int type)
> > +{
> > +    return info->merge[type] ? 1 : 0;
> 
> Return type bool and preferably with !! instead of conditional
> expression.
> 

Andrew beat me to it: the code and data structures above are mostly
imported from Linux.

> > +size_t gcov_store_u32(void *buffer, size_t off, u32 v)
> > +{
> > +    u32 *data;
> 
> Please be consistent wrt u32 vs ...
> 
> > +static int gcov_info_dump_payload(const struct gcov_info *info,
> > +                                  XEN_GUEST_HANDLE_PARAM(char) buffer,
> > +                                  uint32_t *off)
> > +{
> > +    char *buf;
> > +    uint32_t buf_size;
> 
> ... uint32_t (and alike; I'd suggest using only the latter, and I think
> we should get rid of u32 / __u32 and their siblings eventually).
> 

Right. I will switch to using uint32_t.

> > +static uint32_t gcov_get_size(void)
> > +{
> > +    uint32_t total_size;
> > +    struct gcov_info *info = NULL;
> > +
> > +    /* Magic number XCOV */
> > +    total_size = sizeof(uint32_t);
> 
> Again - can't this be the initializer?
> 

Sure. I will move it up.

> > +int sysctl_gcov_op(xen_sysctl_gcov_op_t *op)
> > +{
> > +    int ret;
> > +
> > +    switch ( op->cmd )
> > +    {
> > +    case XEN_SYSCTL_GCOV_get_size:
> > +        op->size = gcov_get_size();
> > +        ret = 0;
> > +        break;
> > +    case XEN_SYSCTL_GCOV_read:
> 
> Blank lines between non-fall-through case statements please.
> 

OK.

> > --- /dev/null
> > +++ b/xen/common/gcov/gcov.h
> > @@ -0,0 +1,36 @@
> > +#ifndef _GCOV_H_
> > +#define _GCOV_H_
> > +
> > +#include <xen/guest_access.h>
> > +#include <xen/types.h>
> > +
> > +/*
> > + * Profiling data types used for gcc 3.4 and above - these are defined by
> > + * gcc and need to be kept as close to the original definition as possible 
> > to
> > + * remain compatible.
> > + */
> > +#define GCOV_DATA_MAGIC         ((unsigned int) 0x67636461)
> > +#define GCOV_TAG_FUNCTION       ((unsigned int) 0x01000000)
> > +#define GCOV_TAG_COUNTER_BASE   ((unsigned int) 0x01a10000)
> > +#define GCOV_TAG_FOR_COUNTER(count)				\
> > +	_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))
> 
> Stray blanks after casts.
> 

Will fix.

> > --- /dev/null
> > +++ b/xen/common/gcov/gcov_base.c
> > @@ -0,0 +1,64 @@
> > +/*
> > + * Common code across gcov implementations
> > + *
> > + * Copyright Citrix Systems R&D UK
> > + * Author(s): Wei Liu <wei.liu2@citrix.com>
> > + *
> > + *    Uses gcc-internal data definitions.
> > + *    Based on the gcov-kernel patch by:
> > + *       Hubertus Franke <frankeh@us.ibm.com>
> > + *       Nigel Hinds <nhinds@us.ibm.com>
> > + *       Rajan Ravindran <rajancr@us.ibm.com>
> > + *       Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
> > + *       Paul Larson
> > + */
> > +
> > +#include "gcov.h"
> > +
> > +/*
> > + * __gcov_init is called by gcc-generated constructor code for each object
> > + * file compiled with -fprofile-arcs.
> > + *
> > + * Although this function is called only during initialization is called from
> > + * a .text section which is still present after initialization so not declare
> > + * as __init.
> 
> I don't follow - we do such references elsewhere, so I can't see a
> reason not to follow that model here too as long the call here
> happens before .init.* get discarded.
> 

This is residual from previous implementation. I haven't checked if the
statement is true or not. If this statement is not true I'm happy to
make corresponding adjustments.

> Having reached the end here - what if the user gets the Kconfig setting
> wrong? Wouldn't it be helpful if the gcov_<major>_<minor>.c files
> #error-ed upon an out of range gcc version?
> 

That's a good idea.

Wei.

> Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-10-10 13:12 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10  9:40 [PATCH v2 0/9] Rework gcov support in Xen Wei Liu
2016-10-10  9:40 ` [PATCH v2 1/9] Kconfig: use tab instead of space Wei Liu
2016-10-10 11:21   ` Jan Beulich
2016-10-10  9:40 ` [PATCH v2 2/9] Kconfig: add BROKEN config Wei Liu
2016-10-10 11:22   ` Jan Beulich
2016-10-10  9:40 ` [PATCH v2 3/9] xen: delete gcno files in clean target Wei Liu
2016-10-10 11:23   ` Jan Beulich
2016-10-10  9:40 ` [PATCH v2 4/9] xen, tools: rip out old gcov implementation Wei Liu
2016-10-10 11:24   ` Jan Beulich
2016-10-10  9:40 ` [PATCH v2 5/9] gcov: add new interface and 3.4 and 4.7 format support Wei Liu
2016-10-10 11:56   ` Jan Beulich
2016-10-10 12:23     ` Andrew Cooper
2016-10-10 12:56       ` Jan Beulich
2016-10-10 13:12         ` Wei Liu
2016-10-10 13:11     ` Wei Liu [this message]
2016-10-10 14:43       ` Wei Liu
2016-10-11 10:31   ` [PATCH v3] " Wei Liu
2016-10-12 12:42     ` Jan Beulich
2016-10-12 13:06       ` Wei Liu
2016-10-12 13:11         ` Jan Beulich
2016-10-12 13:24         ` George Dunlap
2016-10-12 13:26           ` George Dunlap
2016-10-12 13:31             ` Wei Liu
2016-10-12 13:33             ` Jan Beulich
2016-10-12 13:34             ` Andrew Cooper
2016-10-12 13:41               ` George Dunlap
2016-10-12 13:43                 ` Andrew Cooper
2016-10-12 13:29           ` Konrad Rzeszutek Wilk
2016-10-12 13:40             ` Wei Liu
2016-10-12 13:46               ` Konrad Rzeszutek Wilk
2016-10-12 13:50                 ` Wei Liu
2016-10-12 13:23       ` Konrad Rzeszutek Wilk
2016-10-12 13:31         ` Jan Beulich
2016-10-12 13:44           ` Konrad Rzeszutek Wilk
2016-10-12 14:08             ` Jan Beulich
2016-10-12 14:17             ` Martin Pohlack
2016-10-12 16:21               ` Konrad Rzeszutek Wilk
2016-10-13  8:05                 ` Martin Pohlack
2016-10-12 15:33       ` Wei Liu
2016-10-12 15:42         ` Jan Beulich
2016-10-12 17:07           ` Wei Liu
2016-10-13  8:29             ` Jan Beulich
2016-10-13  8:49               ` Wei Liu
2016-10-13  9:15                 ` Jan Beulich
2016-10-13  9:20                   ` Wei Liu
2016-10-10  9:40 ` [PATCH v2 6/9] gcov: userspace tools to extract and split gcov data Wei Liu
2016-10-10 15:44   ` Ian Jackson
2016-10-10  9:40 ` [PATCH v2 7/9] Config.mk: expand cc-ver a bit Wei Liu
2016-10-10 11:57   ` Jan Beulich
2016-10-10  9:40 ` [PATCH v2 8/9] Config.mk: introduce cc-ifversion Wei Liu
2016-10-10 12:00   ` Jan Beulich
2016-10-10 13:18     ` Wei Liu
2016-10-10 13:22       ` Jan Beulich
2016-10-10 13:24         ` Wei Liu
2016-10-10  9:40 ` [PATCH v2 9/9] gcov: provide the capability to select gcov format automatically Wei Liu
2016-10-10 12:00   ` Jan Beulich
2016-10-10 15:47 ` [PATCH v2 0/9] Rework gcov support in Xen Ian Jackson
2016-10-10 15:58   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161010131158.GP3687@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=philippe.gabriel@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.