xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: dongxiao.xu@intel.com
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH v2 4/8] x86: dynamically attach/detach CQM service for a guest
Date: Mon, 25 Nov 2013 16:06:16 -0500	[thread overview]
Message-ID: <20131125210616.GC4217@phenom.dumpdata.com> (raw)
In-Reply-To: <1385018444-104477-5-git-send-email-dongxiao.xu@intel.com>

On Thu, Nov 21, 2013 at 03:20:40PM +0800, dongxiao.xu@intel.com wrote:
> From: Dongxiao Xu <dongxiao.xu@intel.com>
> 
> Add hypervisor side support for dynamically attach and detach CQM
> services for a certain guest.
> 
> Signed-off-by: Jiongxi Li <jiongxi.li@intel.com>
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  xen/arch/x86/domctl.c       |   40 ++++++++++++++++++++++++++++++++++++++++
>  xen/include/public/domctl.h |   14 ++++++++++++++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
> index f7e4586..5ef21f9 100644
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -35,6 +35,7 @@
>  #include <asm/mem_sharing.h>
>  #include <asm/xstate.h>
>  #include <asm/debugger.h>
> +#include <asm/pqos.h>
>  
>  static int gdbsx_guest_mem_io(
>      domid_t domid, struct xen_domctl_gdbsx_memio *iop)
> @@ -1223,6 +1224,45 @@ long arch_do_domctl(
>      }
>      break;
>  
> +    case XEN_DOMCTL_attach_pqos:
> +    {

Don't you need to use to use xsm to check if the operation is
permitted.

Oh, and you also need to add in the XSM the new hypercall I think?

See 8ec7763c807f252e930c9647a0631253db2844a7 or
919f59b3b99e1d845c6a1f30125e79e828805d87 as examples of what needs
to be done.

Oh, and CC Daniel (dgdegra@tycho.nsa.gov)
> +        if ( domctl->u.qos_res.flags & XEN_DOMCTL_ADF_pqos_cqm )
> +        {
> +            if ( !system_supports_cqm() )
> +                ret = -ENODEV;
> +            else if ( d->arch.pqos_cqm_rmid > 0 )
> +                ret = -EINVAL;
> +            else
> +            {
> +                ret = alloc_cqm_rmid(d);
> +                if ( ret < 0 )
> +                    ret = -EBUSY;
> +            }
> +        }
> +        else
> +            ret = -EINVAL;
> +    }
> +    break;
> +
> +    case XEN_DOMCTL_detach_pqos:
> +    {
> +        if ( domctl->u.qos_res.flags & XEN_DOMCTL_ADF_pqos_cqm )
> +        {
> +            if ( !system_supports_cqm() )
> +                ret = -ENODEV;
> +            else if ( d->arch.pqos_cqm_rmid > 0 )
> +            {
> +                free_cqm_rmid(d);
> +                ret = 0;
> +            }
> +            else
> +                ret = -EINVAL;
> +        }
> +        else
> +            ret = -EINVAL;
> +    }
> +    break;
> +
>      default:
>          ret = iommu_do_domctl(domctl, d, u_domctl);
>          break;
> diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
> index 47a850a..f5d7062 100644
> --- a/xen/include/public/domctl.h
> +++ b/xen/include/public/domctl.h
> @@ -872,6 +872,17 @@ struct xen_domctl_set_max_evtchn {
>  typedef struct xen_domctl_set_max_evtchn xen_domctl_set_max_evtchn_t;
>  DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_max_evtchn_t);
>  
> +/* XEN_DOMCTL_attach_pqos */
> +/* XEN_DOMCTL_detach_pqos */
> +struct xen_domctl_qos_resource {
> + /* Attach or detach flag for cqm */
> +#define _XEN_DOMCTL_ADF_pqos_cqm      0
> +#define XEN_DOMCTL_ADF_pqos_cqm       (1U<<_XEN_DOMCTL_ADF_pqos_cqm)
> +    uint32_t flags;
> +};
> +typedef struct xen_domctl_qos_resource xen_domctl_qos_resource_t;
> +DEFINE_XEN_GUEST_HANDLE(xen_domctl_qos_resource_t);
> +
>  struct xen_domctl {
>      uint32_t cmd;
>  #define XEN_DOMCTL_createdomain                   1
> @@ -941,6 +952,8 @@ struct xen_domctl {
>  #define XEN_DOMCTL_setnodeaffinity               68
>  #define XEN_DOMCTL_getnodeaffinity               69
>  #define XEN_DOMCTL_set_max_evtchn                70
> +#define XEN_DOMCTL_attach_pqos                   71
> +#define XEN_DOMCTL_detach_pqos                   72
>  #define XEN_DOMCTL_gdbsx_guestmemio            1000
>  #define XEN_DOMCTL_gdbsx_pausevcpu             1001
>  #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
> @@ -1001,6 +1014,7 @@ struct xen_domctl {
>          struct xen_domctl_set_broken_page_p2m set_broken_page_p2m;
>          struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
>          struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
> +        struct xen_domctl_qos_resource      qos_res;
>          uint8_t                             pad[128];
>      } u;
>  };
> -- 
> 1.7.9.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  parent reply	other threads:[~2013-11-25 21:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  7:20 [PATCH v2 0/8] enable Cache QoS Monitoring (CQM) feature dongxiao.xu
2013-11-21  7:20 ` [PATCH v2 1/8] x86: detect and initialize Cache QoS Monitoring feature dongxiao.xu
2013-11-21 12:14   ` Andrew Cooper
2013-11-21 12:19     ` Andrew Cooper
2013-11-25  3:06     ` Xu, Dongxiao
2013-11-25 15:40       ` Andrew Cooper
2013-11-25  8:57     ` Xu, Dongxiao
2013-11-25 15:58       ` Andrew Cooper
2013-11-21  7:20 ` [PATCH v2 2/8] x86: handle CQM resource when creating/destroying guests dongxiao.xu
2013-11-21 12:33   ` Andrew Cooper
2013-11-25  3:21     ` Xu, Dongxiao
2013-11-25 16:02       ` Andrew Cooper
2013-11-21  7:20 ` [PATCH v2 3/8] tools: " dongxiao.xu
2013-11-21  7:20 ` [PATCH v2 4/8] x86: dynamically attach/detach CQM service for a guest dongxiao.xu
2013-11-21 12:50   ` Andrew Cooper
2013-11-25  3:26     ` Xu, Dongxiao
2013-11-25 16:05       ` Andrew Cooper
2013-11-25 21:06   ` Konrad Rzeszutek Wilk [this message]
2013-11-21  7:20 ` [PATCH v2 5/8] tools: " dongxiao.xu
2013-11-25 21:00   ` Konrad Rzeszutek Wilk
2013-11-25 21:01     ` Konrad Rzeszutek Wilk
2013-11-21  7:20 ` [PATCH v2 6/8] x86: get per domain CQM information dongxiao.xu
2013-11-21 14:09   ` Andrew Cooper
2013-11-25  6:20     ` Xu, Dongxiao
2013-11-25 16:28       ` Andrew Cooper
2013-11-21  7:20 ` [PATCH v2 7/8] tools: " dongxiao.xu
2013-11-21  7:20 ` [PATCH v2 8/8] x86: enable CQM monitoring for each domain RMID dongxiao.xu
2013-11-21 14:19   ` Andrew Cooper
2013-11-25  7:22     ` Xu, Dongxiao
2013-11-25 16:32       ` Andrew Cooper
2013-11-21 14:36 ` [PATCH v2 0/8] enable Cache QoS Monitoring (CQM) feature Andrew Cooper
2013-11-25  7:24   ` 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=20131125210616.GC4217@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=dongxiao.xu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).