From: Andrew Cooper <andrew.cooper3@citrix.com>
To: dongxiao.xu@intel.com
Cc: keir@xen.org, Ian.Campbell@citrix.com,
stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com,
xen-devel@lists.xen.org, JBeulich@suse.com,
dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v3 5/7] x86: enable CQM monitoring for each domain RMID
Date: Fri, 29 Nov 2013 14:56:39 +0000 [thread overview]
Message-ID: <5298AB27.2070805@citrix.com> (raw)
In-Reply-To: <1385704092-89546-6-git-send-email-dongxiao.xu@intel.com>
On 29/11/13 05:48, dongxiao.xu@intel.com wrote:
> From: Dongxiao Xu <dongxiao.xu@intel.com>
>
> If the CQM service is attached to a domain, its related RMID will be set
> to hardware for monitoring when the domain's vcpu is scheduled in. When
> the domain's vcpu is scheduled out, RMID 0 (system reserved) will be set
> for monitoring.
>
> Signed-off-by: Jiongxi Li <jiongxi.li@intel.com>
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
> xen/arch/x86/domain.c | 5 +++++
> xen/arch/x86/pqos.c | 10 ++++++++++
> xen/include/asm-x86/msr-index.h | 1 +
> xen/include/asm-x86/pqos.h | 1 +
> 4 files changed, 17 insertions(+)
>
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index 41e1fc6..628f7eb 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -1371,6 +1371,8 @@ static void __context_switch(void)
> {
> memcpy(&p->arch.user_regs, stack_regs, CTXT_SWITCH_STACK_BYTES);
> vcpu_save_fpu(p);
> + if ( system_supports_cqm() )
> + cqm_assoc_rmid(0);
> p->arch.ctxt_switch_from(p);
> }
>
> @@ -1395,6 +1397,9 @@ static void __context_switch(void)
> }
> vcpu_restore_fpu_eager(n);
> n->arch.ctxt_switch_to(n);
> +
> + if ( system_supports_cqm() && n->domain->arch.pqos_cqm_rmid > 0 )
> + cqm_assoc_rmid(n->domain->arch.pqos_cqm_rmid);
> }
>
> gdt = !is_pv_32on64_vcpu(n) ? per_cpu(gdt_table, cpu) :
> diff --git a/xen/arch/x86/pqos.c b/xen/arch/x86/pqos.c
> index 615c5ea..1faa650 100644
> --- a/xen/arch/x86/pqos.c
> +++ b/xen/arch/x86/pqos.c
> @@ -29,6 +29,7 @@ boolean_param("pqos", pqos_enabled);
>
> static unsigned int cqm_rmid_count = 256;
> integer_param("cqm_rmid_count", cqm_rmid_count);
> +static uint64_t rmid_mask;
>
> unsigned int cqm_upscaling_factor = 0;
> bool_t cqm_enabled = 0;
> @@ -75,6 +76,8 @@ static void __init init_qos_monitor(void)
>
> cpuid_count(0xf, 0, &eax, &ebx, &ecx, &qm_features);
>
> + rmid_mask = ~(~0ull << get_count_order(ebx));
> +
> if ( qm_features & QOS_MONITOR_TYPE_L3 )
> init_cqm();
> }
> @@ -198,6 +201,13 @@ void get_cqm_info(cpumask_t *cpu_cqmdata_map, struct xen_socket_cqmdata *data)
> on_selected_cpus(cpu_cqmdata_map, read_cqm_data, data, 1);
> }
>
> +void cqm_assoc_rmid(unsigned int rmid)
> +{
> + uint64_t val;
Xen style requires a newline here.
Otherwise,
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> + rdmsrl(MSR_IA32_PQR_ASSOC, val);
> + wrmsrl(MSR_IA32_PQR_ASSOC, (val & ~(rmid_mask)) | (rmid & rmid_mask));
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
> index 46ef165..45f4918 100644
> --- a/xen/include/asm-x86/msr-index.h
> +++ b/xen/include/asm-x86/msr-index.h
> @@ -491,5 +491,6 @@
> /* Platform QoS register */
> #define MSR_IA32_QOSEVTSEL 0x00000c8d
> #define MSR_IA32_QMC 0x00000c8e
> +#define MSR_IA32_PQR_ASSOC 0x00000c8f
>
> #endif /* __ASM_MSR_INDEX_H */
> diff --git a/xen/include/asm-x86/pqos.h b/xen/include/asm-x86/pqos.h
> index 2ab9277..c75643a 100644
> --- a/xen/include/asm-x86/pqos.h
> +++ b/xen/include/asm-x86/pqos.h
> @@ -41,5 +41,6 @@ void free_cqm_rmid(struct domain *d);
> unsigned int get_cqm_count(void);
> unsigned int get_cqm_avail(void);
> void get_cqm_info(cpumask_t *cpu_cqmdata_map, struct xen_socket_cqmdata *data);
> +void cqm_assoc_rmid(unsigned int rmid);
>
> #endif
next prev parent reply other threads:[~2013-11-29 14:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 5:48 [PATCH v3 0/7] enable Cache QoS Monitoring (CQM) feature dongxiao.xu
2013-11-29 5:48 ` [PATCH v3 1/7] x86: detect and initialize Cache QoS Monitoring feature dongxiao.xu
2013-11-29 13:54 ` Andrew Cooper
2013-11-29 15:05 ` Jan Beulich
2013-11-30 0:41 ` Xu, Dongxiao
2013-12-02 2:17 ` Xu, Dongxiao
2013-12-02 9:22 ` Xu, Dongxiao
2013-11-29 13:59 ` Andrew Cooper
2013-11-30 0:42 ` Xu, Dongxiao
2013-11-29 5:48 ` [PATCH v3 2/7] x86: handle CQM resource when creating/destroying guests dongxiao.xu
2013-11-29 14:18 ` Andrew Cooper
2013-11-29 15:01 ` Andrew Cooper
2013-11-29 15:07 ` Jan Beulich
2013-11-29 5:48 ` [PATCH v3 3/7] x86: dynamically attach/detach CQM service for a guest dongxiao.xu
2013-11-29 14:22 ` Andrew Cooper
2013-11-29 5:48 ` [PATCH v3 4/7] x86: collect CQM information from all sockets dongxiao.xu
2013-11-29 14:53 ` Andrew Cooper
2013-11-30 1:27 ` Xu, Dongxiao
2013-11-29 5:48 ` [PATCH v3 5/7] x86: enable CQM monitoring for each domain RMID dongxiao.xu
2013-11-29 14:56 ` Andrew Cooper [this message]
2013-11-30 1:27 ` Xu, Dongxiao
2013-11-29 5:48 ` [PATCH v3 6/7] xsm: add platform QoS related xsm policies dongxiao.xu
2013-11-29 15:50 ` Daniel De Graaf
2013-11-29 5:48 ` [PATCH v3 7/7] tools: enable Cache QoS Monitoring feature for libxl/libxc dongxiao.xu
2013-11-29 15:29 ` [PATCH v3 0/7] enable Cache QoS Monitoring (CQM) feature Ian Campbell
2013-11-29 15:36 ` Jan Beulich
2013-11-29 15:41 ` Ian Campbell
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=5298AB27.2070805@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.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.