All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Dongxiao Xu <dongxiao.xu@intel.com>
Cc: keir@xen.org, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, George.Dunlap@eu.citrix.com,
	andrew.cooper3@citrix.com, Ian.Jackson@eu.citrix.com,
	xen-devel@lists.xen.org, JBeulich@suse.com,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v11 3/9] tools: provide interface for generic MSR access
Date: Fri, 20 Jun 2014 13:34:20 -0400	[thread overview]
Message-ID: <20140620173420.GK19876@laptop.dumpdata.com> (raw)
In-Reply-To: <ec0d6d5d56919a085e37d232cbf44ccebd5e0d0c.1403248468.git.dongxiao.xu@intel.com>

On Fri, Jun 20, 2014 at 10:31:44PM +0800, Dongxiao Xu wrote:
> Xen added a new sysctl hypercall for generic MSR access, and this is the
> tool side change to wrapper the hypercall into xc APIs.
> 

I really like the idea that Jan surfaced. That is use an
cpu bitmap for the operation (see xc_tbuf.c as an example)
and my recent postings http://osdir.com/ml/general/2014-06/msg24386.html.

That way you can define exactly which CPUs you want to do it
at and you can do one nice hypercall that will do it all at
once for you.

> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  tools/libxc/Makefile     |  1 +
>  tools/libxc/xc_msr_x86.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/libxc/xenctrl.h    |  6 ++++++
>  3 files changed, 60 insertions(+)
>  create mode 100644 tools/libxc/xc_msr_x86.c
> 
> diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
> index a74b19e..fec4aca 100644
> --- a/tools/libxc/Makefile
> +++ b/tools/libxc/Makefile
> @@ -35,6 +35,7 @@ CTRL_SRCS-y       += xc_kexec.c
>  CTRL_SRCS-y       += xtl_core.c
>  CTRL_SRCS-y       += xtl_logger_stdio.c
>  CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
> +CTRL_SRCS-$(CONFIG_X86) += xc_msr_x86.c
>  CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c xc_linux_osdep.c
>  CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
>  CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
> diff --git a/tools/libxc/xc_msr_x86.c b/tools/libxc/xc_msr_x86.c
> new file mode 100644
> index 0000000..46e77dd
> --- /dev/null
> +++ b/tools/libxc/xc_msr_x86.c
> @@ -0,0 +1,53 @@
> +/*
> + * xc_msr_x86.c
> + *
> + * Generic MSR access API
> + *
> + * Copyright (C) 2014      Intel Corporation
> + * Author Dongxiao Xu <dongxiao.xu@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * 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 Lesser General Public License for more details.
> + */
> +
> +#include "xc_private.h"
> +
> +int xc_msr_op(xc_interface *xch, uint32_t cpu,
> +              uint32_t nr_ops, xc_msr_data_t *msr_data)
> +{
> +    int rc;
> +    DECLARE_SYSCTL;
> +    DECLARE_HYPERCALL_BOUNCE(msr_data, nr_ops * sizeof(*msr_data),
> +                             XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> +
> +    if ( xc_hypercall_bounce_pre(xch, msr_data) )
> +        return -1;
> +
> +    sysctl.cmd = XEN_SYSCTL_msr_op;
> +    sysctl.u.msr_op.nr_ops = nr_ops;
> +    sysctl.u.msr_op.cpu = cpu;
> +    set_xen_guest_handle(sysctl.u.msr_op.msr_data, msr_data);
> +
> +    rc = do_sysctl(xch, &sysctl);
> +
> +    xc_hypercall_bounce_post(xch, msr_data);
> +
> +    return rc;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
> index 02129f7..50625ca 100644
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -2424,4 +2424,10 @@ int xc_kexec_load(xc_interface *xch, uint8_t type, uint16_t arch,
>   */
>  int xc_kexec_unload(xc_interface *xch, int type);
>  
> +#if defined(__i386__) || defined(__x86_64__)
> +typedef xen_sysctl_msr_data_t xc_msr_data_t;
> +int xc_msr_op(xc_interface *xch, uint32_t cpu,
> +    uint32_t nr_ops, xc_msr_data_t *msr_data);
> +#endif
> +
>  #endif /* XENCTRL_H */
> -- 
> 1.8.1.5
> 

  reply	other threads:[~2014-06-20 17:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 14:31 [PATCH v11 0/9] enable Cache QoS Monitoring (CQM) feature Dongxiao Xu
2014-06-20 14:31 ` [PATCH v11 1/9] x86: add generic MSR access hypercall Dongxiao Xu
2014-06-20 14:57   ` Andrew Cooper
2014-06-23  6:34     ` Xu, Dongxiao
2014-06-20 15:00   ` Jan Beulich
2014-06-23  6:27     ` Xu, Dongxiao
2014-06-23  6:45       ` Jan Beulich
2014-06-23  7:29         ` Xu, Dongxiao
2014-06-23  7:42           ` Jan Beulich
2014-06-23 13:32           ` Konrad Rzeszutek Wilk
2014-06-20 14:31 ` [PATCH v11 2/9] xsm: add MSR operation related xsm policy Dongxiao Xu
2014-06-24 19:20   ` Daniel De Graaf
2014-06-20 14:31 ` [PATCH v11 3/9] tools: provide interface for generic MSR access Dongxiao Xu
2014-06-20 17:34   ` Konrad Rzeszutek Wilk [this message]
2014-06-23  7:13     ` Jan Beulich
2014-06-23 13:29       ` Konrad Rzeszutek Wilk
2014-06-27 13:05   ` Ian Campbell
2014-06-20 14:31 ` [PATCH v11 4/9] x86: detect and initialize Platform QoS Monitoring feature Dongxiao Xu
2014-06-20 15:04   ` Jan Beulich
2014-06-23  6:38     ` Xu, Dongxiao
2014-06-23  6:50       ` Jan Beulich
2014-06-23  7:30         ` Xu, Dongxiao
2014-06-20 17:35   ` Konrad Rzeszutek Wilk
2014-06-20 14:31 ` [PATCH v11 5/9] x86: dynamically attach/detach QoS monitoring service for a guest Dongxiao Xu
2014-06-20 15:08   ` Jan Beulich
2014-06-23  6:43     ` Xu, Dongxiao
2014-06-20 14:31 ` [PATCH v11 6/9] x86: collect global QoS monitoring information Dongxiao Xu
2014-06-20 15:16   ` Jan Beulich
2014-06-23  6:55     ` Xu, Dongxiao
2014-06-23  7:06       ` Jan Beulich
2014-06-20 14:31 ` [PATCH v11 7/9] x86: enable QoS monitoring for each domain RMID Dongxiao Xu
2014-06-20 15:20   ` Jan Beulich
2014-06-23  6:55     ` Xu, Dongxiao
2014-06-20 14:31 ` [PATCH v11 8/9] xsm: add platform QoS related xsm policies Dongxiao Xu
2014-06-24 19:24   ` Daniel De Graaf
2014-06-20 14:31 ` [PATCH v11 9/9] tools: CMDs and APIs for Platform QoS Monitoring Dongxiao Xu
2014-06-23 15:22   ` Ian Jackson
2014-06-27  7:15     ` Xu, Dongxiao

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=20140620173420.GK19876@laptop.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=dongxiao.xu@intel.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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.