All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 for-next 5/9] coverage: introduce generic file
Date: Thu, 16 Nov 2017 17:23:36 -0500	[thread overview]
Message-ID: <20171116222336.GE15014@char.us.oracle.com> (raw)
In-Reply-To: <20171109111349.95800-6-roger.pau@citrix.com>

On Thu, Nov 09, 2017 at 11:13:45AM +0000, Roger Pau Monne wrote:
> It will contain the generic implementation of sysctl_cov_op, which
> will be shared between all the coverage implementations.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Changes since v1:
>  - Use private coverage.h header.
>  - Sort alphabetically the obj-y list.
> ---
>  xen/common/coverage/Makefile   |  2 +-
>  xen/common/coverage/coverage.c | 73 ++++++++++++++++++++++++++++++++++++++++++
>  xen/common/coverage/coverage.h |  1 +
>  xen/common/coverage/gcov.c     | 39 +---------------------
>  4 files changed, 76 insertions(+), 39 deletions(-)
>  create mode 100644 xen/common/coverage/coverage.c
> 
> diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
> index a7a48494ca..5387bc6429 100644
> --- a/xen/common/coverage/Makefile
> +++ b/xen/common/coverage/Makefile
> @@ -1,4 +1,4 @@
> -obj-y += gcov_base.o gcov.o
> +obj-y += coverage.o gcov_base.o gcov.o
>  obj-y += $(call cc-ifversion,lt,0x040700, \
>  		gcc_3_4.o, $(call cc-ifversion,lt,0x040900, \
>  		gcc_4_7.o, $(call cc-ifversion,lt,0x050000, \
> diff --git a/xen/common/coverage/coverage.c b/xen/common/coverage/coverage.c
> new file mode 100644
> index 0000000000..bd90f28663
> --- /dev/null
> +++ b/xen/common/coverage/coverage.c
> @@ -0,0 +1,73 @@
> +/*
> + * Generic functionality for coverage analysis.
> + *
> + * Copyright (C) 2017 Citrix Systems R&D
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms and conditions of the GNU General Public
> + * License, version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public
> + * License along with this program; If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <xen/errno.h>
> +#include <xen/guest_access.h>
> +#include <xen/types.h>
> +#include <xen/coverage.h>
> +
> +#include <public/sysctl.h>
> +
> +#include "coverage.h"
> +
> +int sysctl_cov_op(struct xen_sysctl_coverage_op *op)
> +{
> +    int ret;
> +
> +    switch ( op->cmd )
> +    {
> +    case XEN_SYSCTL_COVERAGE_get_size:
> +        op->size = cov_ops.get_size();
> +        ret = 0;
> +        break;
> +
> +    case XEN_SYSCTL_COVERAGE_read:
> +    {
> +        XEN_GUEST_HANDLE_PARAM(char) buf;
> +        uint32_t size = op->size;
> +
> +        buf = guest_handle_cast(op->buffer, char);
> +
> +        ret = cov_ops.dump(buf, &size);
> +        op->size = size;
> +
> +        break;
> +    }
> +
> +    case XEN_SYSCTL_COVERAGE_reset:
> +        cov_ops.reset_counters();
> +        ret = 0;
> +        break;
> +
> +    default:
> +        ret = -EOPNOTSUPP;
> +        break;
> +    }
> +
> +    return ret;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/common/coverage/coverage.h b/xen/common/coverage/coverage.h
> index 4613d5e6c1..003bb76950 100644
> --- a/xen/common/coverage/coverage.h
> +++ b/xen/common/coverage/coverage.h
> @@ -8,5 +8,6 @@ struct cov_sysctl_ops {
>      void     (*reset_counters)(void);
>      int      (*dump)(XEN_GUEST_HANDLE_PARAM(char), uint32_t *);
>  };
> +extern const struct cov_sysctl_ops cov_ops;
>  
>  #endif
> diff --git a/xen/common/coverage/gcov.c b/xen/common/coverage/gcov.c
> index 8627ef3355..3cc98728bf 100644
> --- a/xen/common/coverage/gcov.c
> +++ b/xen/common/coverage/gcov.c
> @@ -210,49 +210,12 @@ static int gcov_dump_all(XEN_GUEST_HANDLE_PARAM(char) buffer,
>      return ret;
>  }
>  
> -static const struct cov_sysctl_ops cov_ops = {
> +const struct cov_sysctl_ops cov_ops = {
>      .get_size = gcov_get_size,
>      .reset_counters = gcov_reset_all_counters,
>      .dump = gcov_dump_all,
>  };
>  
> -int sysctl_cov_op(struct xen_sysctl_coverage_op *op)
> -{
> -    int ret;
> -
> -    switch ( op->cmd )
> -    {
> -    case XEN_SYSCTL_COVERAGE_get_size:
> -        op->size = cov_ops.get_size();
> -        ret = 0;
> -        break;
> -
> -    case XEN_SYSCTL_COVERAGE_read:
> -    {
> -        XEN_GUEST_HANDLE_PARAM(char) buf;
> -        uint32_t size = op->size;
> -
> -        buf = guest_handle_cast(op->buffer, char);
> -
> -        ret = cov_ops.dump(buf, &size);
> -        op->size = size;
> -
> -        break;
> -    }
> -
> -    case XEN_SYSCTL_COVERAGE_reset:
> -        cov_ops.reset_counters();
> -        ret = 0;
> -        break;
> -
> -    default:
> -        ret = -EOPNOTSUPP;
> -        break;
> -    }
> -
> -    return ret;
> -}
> -
>  /*
>   * Local variables:
>   * mode: C
> -- 
> 2.13.6 (Apple Git-96)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

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

  reply	other threads:[~2017-11-16 22:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 11:13 [PATCH v2 for-next 0/9] LLVM coverage support for Xen Roger Pau Monne
2017-11-09 11:13 ` [PATCH v2 for-next 1/9] kconfig/gcov: remove gcc version choice from kconfig Roger Pau Monne
2017-11-27 14:51   ` Jan Beulich
2017-12-01 12:14   ` Wei Liu
2017-11-09 11:13 ` [PATCH v2 for-next 2/9] gcov: rename folder and header to coverage Roger Pau Monne
2017-11-16 22:24   ` Konrad Rzeszutek Wilk
2017-11-09 11:13 ` [PATCH v2 for-next 3/9] gcov: rename sysctl and functions Roger Pau Monne
2017-11-16 22:24   ` Konrad Rzeszutek Wilk
2018-01-23  9:37   ` Jan Beulich
2018-01-23 11:07     ` Ian Jackson
2017-11-09 11:13 ` [PATCH v2 for-next 4/9] gcov: introduce hooks for the sysctl Roger Pau Monne
2017-11-16 22:19   ` Konrad Rzeszutek Wilk
2017-11-27 14:53   ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 5/9] coverage: introduce generic file Roger Pau Monne
2017-11-16 22:23   ` Konrad Rzeszutek Wilk [this message]
2017-11-09 11:13 ` [PATCH v2 for-next 6/9] kconfig/gcov: rename to coverage Roger Pau Monne
2017-11-16 22:22   ` Konrad Rzeszutek Wilk
2017-11-27 11:27     ` Roger Pau Monné
2017-11-27 11:42       ` Jan Beulich
2017-11-27 15:00   ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 7/9] coverage: introduce support for llvm profiling Roger Pau Monne
2017-11-27 15:01   ` Jan Beulich
2017-11-09 11:13 ` [PATCH v2 for-next 8/9] xsm: add bodge when compiling with llvm coverage support Roger Pau Monne
2017-11-09 11:13 ` [PATCH v2 for-next 9/9] coverage: add documentation for LLVM coverage Roger Pau Monne

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=20171116222336.GE15014@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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.