From: Dongxiao Xu <dongxiao.xu@intel.com>
To: xen-devel@lists.xen.org
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,
JBeulich@suse.com, dgdegra@tycho.nsa.gov
Subject: [PATCH v13 06/10] x86: collect global QoS monitoring information
Date: Mon, 4 Aug 2014 10:17:02 +0800 [thread overview]
Message-ID: <1407118626-76843-7-git-send-email-dongxiao.xu@intel.com> (raw)
In-Reply-To: <1407118626-76843-1-git-send-email-dongxiao.xu@intel.com>
This implementation tries to put all policies into user space, thus some
global QoS monitoring information needs to be exposed, such as the total
RMID count, L3 upscaling factor, etc.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
xen/arch/x86/cpu/intel_cacheinfo.c | 50 +++-----------------------------------
xen/arch/x86/sysctl.c | 43 ++++++++++++++++++++++++++++++++
xen/include/public/sysctl.h | 14 +++++++++++
3 files changed, 60 insertions(+), 47 deletions(-)
diff --git a/xen/arch/x86/cpu/intel_cacheinfo.c b/xen/arch/x86/cpu/intel_cacheinfo.c
index 430f939..a2a11b0 100644
--- a/xen/arch/x86/cpu/intel_cacheinfo.c
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -12,6 +12,7 @@
#include <xen/lib.h>
#include <xen/errno.h>
#include <asm/processor.h>
+#include <asm/intel_cacheinfo.h>
#define LVL_1_INST 1
#define LVL_1_DATA 2
@@ -81,54 +82,9 @@ static struct _cache_table cache_table[] __cpuinitdata =
{ 0x00, 0, 0}
};
-
-enum _cache_type
-{
- CACHE_TYPE_NULL = 0,
- CACHE_TYPE_DATA = 1,
- CACHE_TYPE_INST = 2,
- CACHE_TYPE_UNIFIED = 3
-};
-
-union _cpuid4_leaf_eax {
- struct {
- enum _cache_type type:5;
- unsigned int level:3;
- unsigned int is_self_initializing:1;
- unsigned int is_fully_associative:1;
- unsigned int reserved:4;
- unsigned int num_threads_sharing:12;
- unsigned int num_cores_on_die:6;
- } split;
- u32 full;
-};
-
-union _cpuid4_leaf_ebx {
- struct {
- unsigned int coherency_line_size:12;
- unsigned int physical_line_partition:10;
- unsigned int ways_of_associativity:10;
- } split;
- u32 full;
-};
-
-union _cpuid4_leaf_ecx {
- struct {
- unsigned int number_of_sets:32;
- } split;
- u32 full;
-};
-
-struct _cpuid4_info {
- union _cpuid4_leaf_eax eax;
- union _cpuid4_leaf_ebx ebx;
- union _cpuid4_leaf_ecx ecx;
- unsigned long size;
-};
-
unsigned short num_cache_leaves;
-static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
+int cpuid4_cache_lookup(int index, struct cpuid4_info *this_leaf)
{
union _cpuid4_leaf_eax eax;
union _cpuid4_leaf_ebx ebx;
@@ -185,7 +141,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
* parameters cpuid leaf to find the cache details
*/
for (i = 0; i < num_cache_leaves; i++) {
- struct _cpuid4_info this_leaf;
+ struct cpuid4_info this_leaf;
int retval;
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 15d4b91..3e922d0 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -25,9 +25,11 @@
#include <asm/hvm/support.h>
#include <asm/processor.h>
#include <asm/numa.h>
+#include <asm/intel_cacheinfo.h>
#include <xen/nodemask.h>
#include <xen/cpu.h>
#include <xsm/xsm.h>
+#include <asm/pqos.h>
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
@@ -101,6 +103,47 @@ long arch_do_sysctl(
}
break;
+ case XEN_SYSCTL_pqos_monitor_op:
+ if ( !pqos_monitor_enabled() )
+ return -ENODEV;
+
+ sysctl->u.pqos_monitor_op.flags = 0;
+ switch ( sysctl->u.pqos_monitor_op.cmd )
+ {
+ case XEN_SYSCTL_PQOS_MONITOR_cqm_enabled:
+ sysctl->u.pqos_monitor_op.data =
+ (pqosm->qm_features & QOS_MONITOR_TYPE_L3) &&
+ (pqosm->l3m.l3_features & L3_FEATURE_OCCUPANCY);
+ break;
+ case XEN_SYSCTL_PQOS_MONITOR_get_total_rmid:
+ sysctl->u.pqos_monitor_op.data =
+ pqosm->rmid_max - pqosm->rmid_min + 1;
+ break;
+ case XEN_SYSCTL_PQOS_MONITOR_get_l3_upscaling_factor:
+ sysctl->u.pqos_monitor_op.data = pqosm->l3m.upscaling_factor;
+ break;
+ case XEN_SYSCTL_PQOS_MONITOR_get_l3_cache_size:
+ {
+ struct cpuid4_info info;
+
+ ret = cpuid4_cache_lookup(3, &info);
+ if ( ret < 0 )
+ break;
+
+ sysctl->u.pqos_monitor_op.data = info.size / 1024; /* in KB unit */
+ }
+ break;
+ default:
+ sysctl->u.pqos_monitor_op.data = 0;
+ ret = -ENOSYS;
+ break;
+ }
+
+ if ( __copy_to_guest(u_sysctl, sysctl, 1) )
+ ret = -EFAULT;
+
+ break;
+
default:
ret = -ENOSYS;
break;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 3588698..fc178f6 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -636,6 +636,18 @@ struct xen_sysctl_coverage_op {
typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
+#define XEN_SYSCTL_PQOS_MONITOR_get_total_rmid 0
+#define XEN_SYSCTL_PQOS_MONITOR_get_l3_upscaling_factor 1
+#define XEN_SYSCTL_PQOS_MONITOR_get_l3_cache_size 2
+#define XEN_SYSCTL_PQOS_MONITOR_cqm_enabled 3
+struct xen_sysctl_pqos_monitor_op {
+ uint32_t cmd;
+ uint32_t flags; /* padding variable, may be extended for future use */
+ uint64_t data;
+};
+typedef struct xen_sysctl_pqos_monitor_op xen_sysctl_pqos_monitor_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pqos_monitor_op_t);
+
struct xen_sysctl {
uint32_t cmd;
@@ -658,6 +670,7 @@ struct xen_sysctl {
#define XEN_SYSCTL_cpupool_op 18
#define XEN_SYSCTL_scheduler_op 19
#define XEN_SYSCTL_coverage_op 20
+#define XEN_SYSCTL_pqos_monitor_op 21
uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
union {
struct xen_sysctl_readconsole readconsole;
@@ -679,6 +692,7 @@ struct xen_sysctl {
struct xen_sysctl_cpupool_op cpupool_op;
struct xen_sysctl_scheduler_op scheduler_op;
struct xen_sysctl_coverage_op coverage_op;
+ struct xen_sysctl_pqos_monitor_op pqos_monitor_op;
uint8_t pad[128];
} u;
};
--
1.8.1.5
next prev parent reply other threads:[~2014-08-04 2:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 2:16 [PATCH v13 00/10] enable Cache QoS Monitoring (CQM) feature Dongxiao Xu
2014-08-04 2:16 ` [PATCH v13 01/10] x86: add generic resource (e.g. MSR) access hypercall Dongxiao Xu
2014-08-04 11:07 ` Jan Beulich
2014-08-04 2:16 ` [PATCH v13 02/10] xsm: add resource operation related xsm policy Dongxiao Xu
2014-08-04 2:16 ` [PATCH v13 03/10] tools: provide interface for generic resource access Dongxiao Xu
2014-08-04 2:17 ` [PATCH v13 04/10] x86: detect and initialize Platform QoS Monitoring feature Dongxiao Xu
2014-08-04 11:19 ` Jan Beulich
2014-08-04 2:17 ` [PATCH v13 05/10] x86: dynamically attach/detach QoS monitoring service for a guest Dongxiao Xu
2014-08-04 9:38 ` Andrew Cooper
2014-08-04 11:23 ` Jan Beulich
2014-08-04 2:17 ` Dongxiao Xu [this message]
2014-08-04 11:31 ` [PATCH v13 06/10] x86: collect global QoS monitoring information Jan Beulich
2014-08-04 11:34 ` Jan Beulich
2014-08-04 2:17 ` [PATCH v13 07/10] x86: enable QoS monitoring for each domain RMID Dongxiao Xu
2014-08-04 9:44 ` Andrew Cooper
2014-08-04 11:33 ` Jan Beulich
2014-08-04 2:17 ` [PATCH v13 08/10] x86: add QoS monitoring related MSRs in allowed list Dongxiao Xu
2014-08-04 2:17 ` [PATCH v13 09/10] xsm: add platform QoS related xsm policies Dongxiao Xu
2014-08-04 2:17 ` [PATCH v13 10/10] tools: CMDs and APIs for Platform QoS Monitoring Dongxiao Xu
2014-08-04 10:29 ` [PATCH v13 00/10] enable Cache QoS Monitoring (CQM) feature 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=1407118626-76843-7-git-send-email-dongxiao.xu@intel.com \
--to=dongxiao.xu@intel.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=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 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).