enable Cache QoS Monitoring (CQM) feature
v9 cover enable Cache QoS Monitoring (CQM) feature
Changes from v8:
- Address comments from Ian Campbell, including:
* Modify the return handling for xc_sysctl();
* Add man page items for platform QoS related commands.
* Fix typo in commit message.
Changes from v7:
- Address comments from Andrew Cooper, including:
* Check CQM capability before allocating cpumask memory.
* Move one function declaration into the correct patch.
Changes from v6:
- Address comments from Jan Beulich, including:
* Remove the unnecessary CPUID feature check.
* Remove the unnecessary socket_cpu_map.
* Spin_lock related changes, avoid spin_lock_irqsave().
* Use readonly mapping to pass cqm data between Xen/Userspace, to avoid data copying.
* Optimize RDMSR/WRMSR logic to avoid unnecessary calls.
* Misc fixes including __read_mostly prefix, return value, etc.
Changes from v5:
- Address comments from Dario Faggioli, including:
* Define a new libxl_cqminfo structure to avoid reference of xc structure in libxl functions.
* Use LOGE() instead of the LIBXL__LOG() functions.
Changes from v4:
- When comparing xl cqm parameter, use strcmp instead of strncmp, otherwise, "xl pqos-attach cqmabcd domid" will be considered as a valid command line.
- Address comments from Andrew Cooper, including:
* Adjust the pqos parameter parsing function.
* Modify the pqos related documentation.
* Add a check for opt_cqm_max_rmid in initialization code.
* Do not IPI CPU that is in same socket with current CPU.
- Address comments from Dario Faggioli, including:
* Fix an typo in export symbols.
* Return correct libxl error code for qos related functions.
* Abstract the error printing logic into a function.
- Address comment from Daniel De Graaf, including:
* Add return value in for pqos related check.
- Address comments from Konrad Rzeszutek Wilk, including:
* Modify the GPLv2 related file header, remove the address.
Changes from v3:
- Use structure to better organize CQM related global variables.
- Address comments from Andrew Cooper, including:
* Remove the domain creation flag for CQM RMID allocation.
* Adjust the boot parameter format, use custom_param().
* Add documentation for the new added boot parameter.
* Change QoS type flag to be uint64_t.
* Initialize the per socket cpu bitmap in system boot time.
* Remove get_cqm_avail() function.
* Misc of format changes.
- Address comment from Daniel De Graaf, including:
* Use avc_current_has_perm() for XEN2__PQOS_OP that belongs to SECCLASS_XEN2.
Changes from v2:
- Address comments from Andrew Cooper, including:
* Merging tools stack changes into one patch.
* Reduce the IPI number to one per socket.
* Change structures for CQM data exchange between tools and Xen.
* Misc of format/variable/function name changes.
- Address comments from Konrad Rzeszutek Wilk, including:
* Simplify the error printing logic.
* Add xsm check for the new added hypercalls.
Changes from v1:
- Address comments from Andrew Cooper, including:
* Change function names, e.g., alloc_cqm_rmid(), system_supports_cqm(), etc.
* Change some structure element order to save packing cost.
* Correct some function's return value.
* Some programming styles change.
* ...
Future generations of Intel Xeon processor may offer monitoring capability in each logical processor to measure specific quality-of-service metric, for example, the Cache QoS Monitoring to get L3 cache occupancy. Detailed information please refer to Intel SDM chapter 17.14.
Cache QoS Monitoring provides a layer of abstraction between applications and logical processors through the use of Resource Monitoring IDs (RMIDs). In Xen design, each guest in the system can be assigned an RMID independently, while RMID=0 is reserved for monitoring domains that doesn't enable CQM service. When any of the domain's vcpu is scheduled on a logical processor, the domain's RMID will be activated by programming the value into one specific MSR, and when the vcpu is scheduled out, a RMID=0 will be programmed into that MSR. The Cache QoS Hardware tracks cache utilization of memory accesses according to the RMIDs and reports monitored data via a counter register. With this solution, we can get the knowledge how much L3 cache is used by a certain guest.
To attach CQM service to a certain guest, two approaches are provided:
1) Create the guest with "pqos_cqm=1" set in configuration file.
2) Use "xl pqos-attach cqm domid" for a running guest.
To detached CQM service from a guest, users can:
1) Use "xl pqos-detach cqm domid" for a running guest.
2) Also destroying a guest will detach the CQM service.
To get the L3 cache usage, users can use the command of:
$ xl pqos-list cqm
The below data is just an example showing how the CQM related data is exposed to end user.
[root@localhost]# xl pqos-list cqm Name ID SocketID L3C_Usage SocketID L3C_Usage Domain-0 0 0 20127744 1 25231360 ExampleHVMDomain 1 0 3211264 1 10551296
RMID count 56 RMID available 53
Dongxiao Xu (6):
x86: detect and initialize Cache QoS Monitoring feature
x86: dynamically attach/detach CQM service for a guest
x86: collect CQM information from all sockets
x86: enable CQM monitoring for each domain RMID
xsm: add platform QoS related xsm policies
tools: enable Cache QoS Monitoring feature for libxl/libxc
docs/man/xl.pod.1 | 23 +++ docs/misc/xen-command-line.markdown | 7 + tools/flask/policy/policy/modules/xen/xen.if | 2 +- tools/flask/policy/policy/modules/xen/xen.te | 5 +- tools/libxc/xc_domain.c | 36 ++++ tools/libxc/xenctrl.h | 12 ++ tools/libxl/Makefile | 3 +- tools/libxl/libxl.h | 4 + tools/libxl/libxl_pqos.c | 132 +++++++++++++ tools/libxl/libxl_types.idl | 7 + tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 111 +++++++++++ tools/libxl/xl_cmdtable.c | 15 ++ xen/arch/x86/Makefile | 1 + xen/arch/x86/domain.c | 8 + xen/arch/x86/domctl.c | 28 +++ xen/arch/x86/pqos.c | 273 ++++++++++++++++++++++++++ xen/arch/x86/setup.c | 3 + xen/arch/x86/sysctl.c | 58 ++++++ xen/include/asm-x86/cpufeature.h | 1 + xen/include/asm-x86/domain.h | 2 + xen/include/asm-x86/msr-index.h | 5 + xen/include/asm-x86/pqos.h | 59 ++++++ xen/include/public/domctl.h | 11 ++ xen/include/public/sysctl.h | 11 ++ xen/xsm/flask/hooks.c | 8 + xen/xsm/flask/policy/access_vectors | 17 +- 27 files changed, 839 insertions(+), 6 deletions(-) create mode 100644 tools/libxl/libxl_pqos.c create mode 100644 xen/arch/x86/pqos.c create mode 100644 xen/include/asm-x86/pqos.h
Signature · 1 line
1.7.9.5
PATCH v9 1/6 x86: detect and initialize Cache QoS Monitoring feature
Detect platform QoS feature status and enumerate the resource types, one of which is to monitor the L3 cache occupancy.
Also introduce a Xen grub command line parameter to control the QoS feature status.
--- docs/misc/xen-command-line.markdown | 7 ++ xen/arch/x86/Makefile | 1 + xen/arch/x86/pqos.c | 156 +++++++++++++++++++++++++++++++++++ xen/arch/x86/setup.c | 3 + xen/include/asm-x86/cpufeature.h | 1 + xen/include/asm-x86/pqos.h | 43 ++++++++++ 6 files changed, 211 insertions(+) create mode 100644 xen/arch/x86/pqos.c create mode 100644 xen/include/asm-x86/pqos.h
docs/misc/xen-command-line.markdown +7 -0
@@ -770,6 +770,13 @@ This option can be specified more than once (up to 8 times at present). ### ple\_window > `= <integer>` +### pqos (Intel) +> `= List of ( <boolean> | cqm:<boolean> | cqm_max_rmid:<integer> )` + +> Default: `pqos=1,cqm:1,cqm_max_rmid:255` + +Configure platform QoS services. + ### reboot > `= t[riple] | k[bd] | n[o] [, [w]arm | [c]old]`
xen/arch/x86/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-y += crash.o obj-y += tboot.o obj-y += hpet.o obj-y += xstate.o +obj-y += pqos.o obj-$(crash_debug) += gdbstub.o
xen/arch/x86/pqos.c new file +156 -0
156 lines not on this page · raw message
xen/arch/x86/setup.c +3 -0
@@ -48,6 +48,7 @@#include <asm/setup.h> #include <xen/cpu.h> #include <asm/nmi.h> +#include <asm/pqos.h> /* opt_nosmp: If true, secondary processors are ignored. */ static bool_t __initdata opt_nosmp;
@@ -1419,6 +1420,8 @@ void __init __start_xen(unsigned long mbi_p)domain_unpause_by_systemcontroller (dom0); +init_platform_qos (); +reset_stack_and_jump (init_done); }
xen/include/asm-x86/cpufeature.h +1 -0
@@ -147,6 +147,7 @@#define X86_FEATURE_ERMS (7*32+ 9)/* Enhanced REP MOVSB/STOSB */ #define X86_FEATURE_INVPCID (7*32+10)/* Invalidate Process Context ID */ #define X86_FEATURE_RTM (7*32+11)/* Restricted Transactional Memory */ +#define X86_FEATURE_QOSM (7*32+12)/* Platform QoS monitoring capability */ #define X86_FEATURE_NO_FPU_SEL (7*32+13)/* FPU CS/DS stored as zero */ #define X86_FEATURE_SMAP (7*32+20)/* Supervisor Mode Access Prevention */
xen/include/asm-x86/pqos.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
+struct
pqos_cqm__read_mostly*cqm = NULL;
Misplaced __read_mostly (belongs after the *).
Quoted 23 lines
xen/arch/x86/pqos.c new file +23
-0+static void __init init_cqm (void ) +{ +unsigned int rmid; +unsigned int eax, edx; +unsigned int cqm_pages; +unsigned int i; + +if ( !opt_cqm_max_rmid ) +return ; + + cqm = xzalloc(struct pqos_cqm); +if ( !cqm ) +return ; + +cpuid_count (0xf ,1 , &eax, &cqm->upscaling_factor, &cqm->max_rmid, &edx); +if ( !(edx &QOS_MONITOR_EVTID_L3 ) ) + goto out; + + cqm->min_rmid =1 ; + cqm->max_rmid =min (opt_cqm_max_rmid, cqm->max_rmid); + + cqm->rmid_to_dom =xmalloc_array (domid_t, cqm->max_rmid +1 ); +if ( !cqm->rmid_to_dom )
xen/arch/x86/pqos.c line 96
Quoted 10 lines
xen/arch/x86/pqos.c new file +10
-0+ goto out; + +/* Reserve RMID 0 for all domains not being monitored */ + cqm->rmid_to_dom[0 ] =DOMID_XEN ; +for ( rmid = cqm->min_rmid; rmid <= cqm->max_rmid; rmid++ ) + cqm->rmid_to_dom[rmid] =DOMID_INVALID ; + +/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) * NR_CPUS)/
Does this really need to be NR_CPUS (rather than nr_cpu_ids)?
xen/arch/x86/pqos.c line 100
Quoted 4 lines
xen/arch/x86/pqos.c new file +4
-0+PAGE_SIZE +1 ; + cqm->buffer_size = cqm_pages *PAGE_SIZE ; + + cqm->buffer =alloc_xenheap_pages (get_order_from_pages (cqm_pages),0 );
And does the allocation really need to be physically contiguous? If so - did you calculate how much more memory you allocate (due to the rounding up to the next power of 2), to decide whether it's worthwhile freeing the unused portion?
xen/arch/x86/pqos.c line 110
Quoted 10 lines
xen/arch/x86/pqos.c new file +10
-0+if ( !cqm->buffer ) + { +xfree (cqm->rmid_to_dom); + goto out; + } +memset (cqm->buffer,0 , cqm->buffer_size); + +for ( i =0 ; i < cqm_pages; i++ ) + share_xen_page_with_privileged_guests( + virt_to_page((void *)((unsigned long)cqm->buffer + i * PAGE_SIZE)),
virt_to_page((void *)cqm->buffer + i * PAGE_SIZE)
xen/arch/x86/pqos.c line 131
Quoted 6 lines
xen/arch/x86/pqos.c new file +6
-0+static void __init init_qos_monitor (void ) +{ +unsigned int qm_features; +unsigned int eax, ebx, ecx; + +if ( !(boot_cpu_has (X86_FEATURE_QOSM )) )
Pointless pair of parentheses.
Quoted 110 lines
xen/arch/x86/pqos.c new file +25
-0+return ; + +cpuid_count (0xf ,0 , &eax, &ebx, &ecx, &qm_features); + +if ( opt_cqm && (qm_features &QOS_MONITOR_TYPE_L3 ) ) +init_cqm (); +} + +void __init init_platform_qos (void ) +{ +if ( !opt_pqos ) +return ; + +init_qos_monitor (); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/x86/setup.c +3
-0@@ -48,6 +48,7 @@#include <asm/setup.h> #include <xen/cpu.h> #include <asm/nmi.h> +#include <asm/pqos.h> /* opt_nosmp: If true, secondary processors are ignored. */ static bool_t __initdata opt_nosmp;@@ -1419,6 +1420,8 @@ void __init __start_xen(unsigned long mbi_p)domain_unpause_by_systemcontroller (dom0); +init_platform_qos (); +reset_stack_and_jump (init_done); }xen/include/asm-x86/cpufeature.h +1
-0@@ -147,6 +147,7 @@#define X86_FEATURE_ERMS (7*32+ 9)/* Enhanced REP MOVSB/STOSB */ #define X86_FEATURE_INVPCID (7*32+10)/* Invalidate Process Context ID */ #define X86_FEATURE_RTM (7*32+11)/* Restricted Transactional Memory */ +#define X86_FEATURE_QOSM (7*32+12)/* Platform QoS monitoring capability */ #define X86_FEATURE_NO_FPU_SEL (7*32+13)/* FPU CS/DS stored as zero */ #define X86_FEATURE_SMAP (7*32+20)/* Supervisor Mode Access Prevention */ xen/include/asm-x86/pqos.h new file +14
-0@@ -0,0 +1,43 @@ +/* +* pqos.h: Platform QoS related service for guest. +* +* Copyright (c) 2014, Intel Corporation +* Author: Jiongxi Li <[email protected]> +* Author: Dongxiao Xu <[email protected]> +* +* 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 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.
+ */xen/include/asm-x86/pqos.h new file +27
-0+#ifndef ASM_PQOS_H +#define ASM_PQOS_H + +#include <public/xen.h> +#include <xen/spinlock.h> + +/* QoS Resource Type Enumeration */ +#define QOS_MONITOR_TYPE_L3 0x2 + +/* QoS Monitoring Event ID */ +#define QOS_MONITOR_EVTID_L3 0x1 + +struct pqos_cqm { +spinlock_t cqm_lock; +uint64_t *buffer; +unsigned int min_rmid; +unsigned int max_rmid; +unsigned int used_rmid; +unsigned int upscaling_factor; +unsigned int buffer_size; +domid_t *rmid_to_dom; +}; +extern struct pqos_cqm *cqm; + +void init_platform_qos (void ); + +#endif Signature · 1 line
1.7.9.5
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 11 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Monday, February 24, 2014 10:13 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
+struct
pqos_cqm__read_mostly*cqm = NULL;Misplaced
__read_mostly(belongs after the *).
Okay.
Quoted 29 lines
Quoted 6 lines
xen/arch/x86/pqos.c new file +5
-0+static void __init init_cqm (void ) +{ +unsigned int rmid; +unsigned int eax, edx; +unsigned int cqm_pages;xen/arch/x86/pqos.c
Quoted 10 lines
xen/arch/x86/pqos.c new file +10
-0+unsigned int i; + +if ( !opt_cqm_max_rmid ) +return ; + + cqm = xzalloc(struct pqos_cqm); +if ( !cqm ) +return ; + + cpuid_count(0xf, 1, &eax, &cqm->upscaling_factor, &cqm->max_rmid,&edx);
Quoted 12 lines
xen/arch/x86/pqos.c new file +12
-0+if ( !(edx &QOS_MONITOR_EVTID_L3 ) ) + goto out; + + cqm->min_rmid =1 ; + cqm->max_rmid =min (opt_cqm_max_rmid, cqm->max_rmid); + + cqm->rmid_to_dom =xmalloc_array (domid_t, cqm->max_rmid +1 ); +if ( !cqm->rmid_to_dom ) + goto out; + +/* Reserve RMID 0 for all domains not being monitored */ + cqm->rmid_to_dom[0 ] =DOMID_XEN ;
Quoted 8 lines
xen/arch/x86/pqos.c line 96
Quoted 6 lines
xen/arch/x86/pqos.c new file +6
-0+for ( rmid = cqm->min_rmid; rmid <= cqm->max_rmid; rmid++ ) + cqm->rmid_to_dom[rmid] =DOMID_INVALID ; + +/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) * NR_CPUS)/Does this really need to be
NR_CPUS(rather thannr_cpu_ids)?
Okay.
As you mentioned in later comment, the CQM data is indexed per-socket.
Here we use NR_CPUS or nr_cpu_ids because it is big enough to cover the possible socket number in the system (even consider hotplug case). Is there a better way that we can get the system socket number (including the case even there is no CPU in that socket)?
Quoted 11 lines
xen/arch/x86/pqos.c
Quoted 5 lines
xen/arch/x86/pqos.c new file +4
-0+PAGE_SIZE +1 ; + cqm->buffer_size = cqm_pages *PAGE_SIZE ; + + cqm->buffer =
alloc_xenheap_pages(get_order_from_pages(cqm_pages), 0);And does the allocation really need to be physically contiguous? If so - did you calculate how much more memory you allocate (due to the rounding up to the next power of 2), to decide whether it's worthwhile freeing the unused portion?
The buffer needs to be contiguous since userspace will map it as read-only to avoid data copy.
According to my rough calculation, the cqm_pages value is about 29 pages on my test machine.
Quoted 11 lines
xen/arch/x86/pqos.c
Quoted 11 lines
xen/arch/x86/pqos.c new file +10
-0+if ( !cqm->buffer ) + { +xfree (cqm->rmid_to_dom); + goto out; + } +memset (cqm->buffer,0 , cqm->buffer_size); + +for ( i =0 ; i < cqm_pages; i++ ) + share_xen_page_with_privileged_guests( + virt_to_page((void *)((unsigned long)cqm->buffer + i *
Quoted 3 lines
PAGE_SIZE)),
virt_to_page((void *)cqm->buffer + i * PAGE_SIZE)
Okay.
Quoted 9 lines
xen/arch/x86/pqos.c line 131
Quoted 7 lines
xen/arch/x86/pqos.c new file +6
-0+static void __init init_qos_monitor (void ) +{ +unsigned int qm_features; +unsigned int eax, ebx, ecx; + +if ( !(boot_cpu_has (X86_FEATURE_QOSM )) )Pointless pair of parentheses.
Okay.
Quoted 120 lines
Review
Quoted 48 lines
xen/arch/x86/pqos.c new file +25
-0+return ; + +cpuid_count (0xf ,0 , &eax, &ebx, &ecx, &qm_features); + +if ( opt_cqm && (qm_features &QOS_MONITOR_TYPE_L3 ) ) +init_cqm (); +} + +void __init init_platform_qos (void ) +{ +if ( !opt_pqos ) +return ; + +init_qos_monitor (); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/x86/setup.c +3
-0@@ -48,6 +48,7 @@#include <asm/setup.h> #include <xen/cpu.h> #include <asm/nmi.h> +#include <asm/pqos.h> /* opt_nosmp: If true, secondary processors are ignored. */ static bool_t __initdata opt_nosmp;@@ -1419,6 +1420,8 @@ void __init __start_xen(unsigned long mbi_p)domain_unpause_by_systemcontroller (dom0); +init_platform_qos (); +reset_stack_and_jump (init_done); }(quoted diff) +0
-0
b/xen/include/asm-x86/cpufeature.hxen/include/asm-x86/cpufeature.h line 148
Quoted 6 lines
index 1cfaf94..ca59668 100644
xen/include/asm-x86/cpufeature.h +0
-0@@ -147,6 +147,7 @@#define X86_FEATURE_ERMS (7*32+ 9)/* Enhanced REP MOVSB/STOSB */ #define X86_FEATURE_INVPCID (7*32+10)/* Invalidate Process Context ID */
xen/include/asm-x86/cpufeature.h line 149
Quoted 1 line
xen/include/asm-x86/cpufeature.h +0
-0#define X86_FEATURE_RTM (7*32+11)/* Restricted Transactional Memory */
xen/include/asm-x86/cpufeature.h line 150
Quoted 1 line
xen/include/asm-x86/cpufeature.h +1
-0+#define X86_FEATURE_QOSM (7*32+12)/* Platform QoS monitoring capability */
xen/include/asm-x86/cpufeature.h line 151
Quoted 1 line
xen/include/asm-x86/cpufeature.h +0
-0#define X86_FEATURE_NO_FPU_SEL (7*32+13)/* FPU CS/DS stored as zero */
xen/include/asm-x86/cpufeature.h line 152
Quoted 1 line
xen/include/asm-x86/cpufeature.h +0
-0#define X86_FEATURE_SMAP (7*32+20)/* Supervisor Mode Access Prevention */
Quoted 10 lines
xen/include/asm-x86/pqos.h new file +3
-0@@ -0,0 +1,43 @@ +/* +* pqos.h: Platform QoS related service for guest. +* xen/include/asm-x86/pqos.h line 13
Quoted 10 lines
xen/include/asm-x86/pqos.h new file +10
-0+* Copyright (c) 2014, Intel Corporation +* Author: Jiongxi Li <[email protected]> +* Author: Dongxiao Xu <[email protected]> +* +* 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 it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
xen/include/asm-x86/pqos.h line 14
Quoted 1 line
xen/include/asm-x86/pqos.h new file +1
-0+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
Quoted 32 lines
for
+ * more details.
+ */xen/include/asm-x86/pqos.h new file +27
-1+#ifndef ASM_PQOS_H +#define ASM_PQOS_H + +#include <public/xen.h> +#include <xen/spinlock.h> + +/* QoS Resource Type Enumeration */ +#define QOS_MONITOR_TYPE_L3 0x2 + +/* QoS Monitoring Event ID */ +#define QOS_MONITOR_EVTID_L3 0x1 + +struct pqos_cqm { +spinlock_t cqm_lock; +uint64_t *buffer; +unsigned int min_rmid; +unsigned int max_rmid; +unsigned int used_rmid; +unsigned int upscaling_factor; +unsigned int buffer_size; +domid_t *rmid_to_dom; +}; +extern struct pqos_cqm *cqm; + +void init_platform_qos (void ); + +#endif --1.7.9.5
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 7 lines
Quoted 7 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c new file +3
-0+/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) * NR_CPUS)/
Quoted 8 lines
Quoted 1 line
Does this really need to be
NR_CPUS(rather thannr_cpu_ids)?Okay.
As you mentioned in later comment, the CQM data is indexed per-socket. Here we useNR_CPUSornr_cpu_idsbecause it is big enough to cover the possible socket number in the system (even consider hotplug case). Is there a better way that we can get the system socket number (including the case even there is no CPU in that socket)?
I think we should at least get the estimation as close as possible:
Count the sockets that we know of (i.e. that have at least one core/thread) and add the number of "disabled" (hot-pluggable) CPUs if ACPI doesn't surface enough information to associate them with a socket (but I think MADT provides all the needed data).
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/pqos.c
Quoted 4 lines
xen/arch/x86/pqos.c new file +4
-0+PAGE_SIZE +1 ; + cqm->buffer_size = cqm_pages *PAGE_SIZE ; + + cqm->buffer =
alloc_xenheap_pages(get_order_from_pages(cqm_pages), 0);
Quoted 7 lines
Quoted 4 lines
And does the allocation really need to be physically contiguous? If so - did you calculate how much more memory you allocate (due to the rounding up to the next power of 2), to decide whether it's worthwhile freeing the unused portion?
The buffer needs to be contiguous since userspace will map it as read-only to avoid data copy.
That's not an argument for other that coding simplicity - user space could equally well map an array of dis-contiguous MFNs.
Quoted 2 lines
According to my rough calculation, the
cqm_pagesvalue is about 29 pages on my test machine.
Your test machine doesn't count; what counts is the maximum possible with the currently enforced limits.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 27 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 04, 2014 4:11 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 7 lines
Quoted 7 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c new file +3
-0+/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) * NR_CPUS)/Quoted 8 lines
Quoted 1 line
Does this really need to be
NR_CPUS(rather thannr_cpu_ids)?Okay.
As you mentioned in later comment, the CQM data is indexed per-socket. Here we useNR_CPUSornr_cpu_idsbecause it is big enough to cover the possible socket number in the system (even consider hotplug case). Is there a better way that we can get the system socket number (including the case even there is no CPU in that socket)?
Quoted 5 lines
I think we should at least get the estimation as close as possible:
Count the sockets that we know of (i.e. that have at least one core/thread) and add the number of "disabled" (hot-pluggable) CPUs if ACPI doesn't surface enough information to associate them with a socket (but I think MADT provides all the needed data).
It seems that MADT table doesn't contain the socket number information...
Considering that it is difficult to get the accurate socket number at system initialization time, what about we allocate/free the CQM related memory at runtime when user admin really issues the QoS query command? With this approach, the data sharing between Xen and Dom0 tools should be much less since we know:
- How many processor sockets are active in the system.
- How many active RMIDs are in use in the system.
With above, we didn't need to always using the max_rmid * max_socket memory to share a lot of unnecessary "zero" data, and the new sharing data should be less than one page. What's your opinion about that?
Thanks,
Dongxiao
Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/pqos.c
Quoted 5 lines
xen/arch/x86/pqos.c new file +4
-0+PAGE_SIZE +1 ; + cqm->buffer_size = cqm_pages *PAGE_SIZE ; + + cqm->buffer =
alloc_xenheap_pages(get_order_from_pages(cqm_pages), 0);Quoted 7 lines
Quoted 4 lines
And does the allocation really need to be physically contiguous? If so - did you calculate how much more memory you allocate (due to the rounding up to the next power of 2), to decide whether it's worthwhile freeing the unused portion?
The buffer needs to be contiguous since userspace will map it as read-only to avoid data copy.
That's not an argument for other that coding simplicity - user space could equally well map an array of dis-contiguous MFNs.
Quoted 2 lines
According to my rough calculation, the
cqm_pagesvalue is about 29 pages on my test machine.Your test machine doesn't count; what counts is the maximum possible with the currently enforced limits.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 34 lines
Quoted 18 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 7 lines
Quoted 7 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c new file +3
-0+/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) * NR_CPUS)/Quoted 8 lines
Quoted 1 line
Does this really need to be
NR_CPUS(rather thannr_cpu_ids)?Okay.
As you mentioned in later comment, the CQM data is indexed per-socket. Here we useNR_CPUSornr_cpu_idsbecause it is big enough to cover the possible socket number in the system (even consider hotplug case). Is there a better way that we can get the system socket number (including the case even there is no CPU in that socket)?Quoted 5 lines
I think we should at least get the estimation as close as possible:
Count the sockets that we know of (i.e. that have at least one core/thread) and add the number of "disabled" (hot-pluggable) CPUs if ACPI doesn't surface enough information to associate them with a socket (but I think MADT provides all the needed data).It seems that MADT table doesn't contain the socket number information...
Considering that it is difficult to get the accurate socket number at system initialization time, what about we allocate/free the CQM related memory at runtime when user admin really issues the QoS query command? With this approach, the data sharing between Xen and Dom0 tools should be much less since we know:
- How many processor sockets are active in the system.
- How many active RMIDs are in use in the system.
Quoted 4 lines
With above, we didn't need to always using the
max_rmid*max_socketmemory to share a lot of unnecessary "zero" data, and the new sharing data should be less than one page.
What's your opinion about that?
If you can get this to work, that would seem like a pretty optimal solution.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 48 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 5:57 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 8 lines
Quoted 8 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 6 lines
Quoted 6 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c new file +3
-0+/* Allocate CQM buffer size in initialization stage */ + cqm_pages = ((cqm->max_rmid +1 ) *sizeof (domid_t) + + (cqm->max_rmid + 1) * sizeof(uint64_t) *NR_CPUS)/
Quoted 26 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
Does this really need to be
NR_CPUS(rather thannr_cpu_ids)?Okay.
As you mentioned in later comment, the CQM data is indexed per-socket. Here we useNR_CPUSornr_cpu_idsbecause it is big enough to cover the possible socket number in the system (even consider hotplug case). Is there a better way that we can get the system socket number (including the case even there is no CPU in that socket)?Quoted 5 lines
I think we should at least get the estimation as close as possible:
Count the sockets that we know of (i.e. that have at least one core/thread) and add the number of "disabled" (hot-pluggable) CPUs if ACPI doesn't surface enough information to associate them with a socket (but I think MADT provides all the needed data).It seems that MADT table doesn't contain the socket number information...
Considering that it is difficult to get the accurate socket number at system initialization time, what about we allocate/free the CQM related memory at runtime when user admin really issues the QoS query command? With this approach, the data sharing between Xen and Dom0 tools should be much less since we know:
- How many processor sockets are active in the system.
- How many active RMIDs are in use in the system.
Quoted 8 lines
Quoted 1 line
With above, we didn't need to always using the
max_rmid*max_socketmemory
Quoted 3 lines
to share a lot of unnecessary "zero" data, and the new sharing data should be less than one page.
What's your opinion about that?If you can get this to work, that would seem like a pretty optimal solution.
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy.
However since the data amount is reduced a lot with above approach, do you think whether we still need to use this share way? Or like most of the other sysctl/domctl (e.g., xl list) command, which uses copy_to_guest() to pass the data?
Thanks,
Dongxiao
Quoted 2 lines
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do you think whether we still need to use this share way? Or like most of the other sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to pass the data?
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 19 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:09 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 7 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do you think whether we still need to use this share way? Or like most of the other sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to pass the data?
Quoted 6 lines
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Okay.
By using dynamic memory allocation and data sharing mechanism, we may need two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQM data and Xen can free the memory.
Does it sound reasonable to you?
Thanks,
Dongxiao
Quoted 2 lines
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 29 lines
Quoted 17 lines
Quoted 1 line · Dongxiao
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:09 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 5 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do you think whether we still need to use this share way? Or like most of the
other
Quoted 1 line
Quoted 1 line
sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to passthe
Quoted 8 lines
Quoted 1 line
data?
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Quoted 7 lines
Okay.
By using dynamic memory allocation and data sharing mechanism, we may need two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQM data
and Xen can free the memory.
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 50 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:28 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 12 lines
Quoted 12 lines
Quoted 1 line · Dongxiao
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:09 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do
you
Quoted 13 lines
Quoted 1 line
Quoted 1 line
think whether we still need to use this share way? Or like most of the
other
Quoted 1 line
Quoted 1 line
sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to passthe
Quoted 8 lines
Quoted 1 line
data?
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Quoted 3 lines
Okay.
By using dynamic memory allocation and data sharing mechanism, we may
need
Quoted 4 lines
two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQM data
and Xen can free the memory.
Quoted 4 lines
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Originally we statically allocate memory in initialization time, and the size is "rmid_max * socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse * socket_inuse" for CQM related pages when user is really issuing query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.
Back to the above question why memory need de-allocating:
Since the rmid_inuse and socket_inuse may be changing from time to time, the allocating memory size will be different. Therefore we need to allocate them when user issues the hypercall, and then free them after the data digest is finished.
Not sure whether I stated the problem clearly for you.
Thanks,
Dongxiao
Quoted 2 lines
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 53 lines · Dongxiao
Quoted 43 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:28 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 12 lines
Quoted 12 lines
Quoted 1 line · Dongxiao
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:09 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do
you
Quoted 11 lines
Quoted 1 line
Quoted 1 line
think whether we still need to use this share way? Or like most of the
other
Quoted 1 line
Quoted 1 line
sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to passthe
Quoted 7 lines
Quoted 1 line
data?
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Quoted 3 lines
Okay.
By using dynamic memory allocation and data sharing mechanism, we may
need
Quoted 8 lines
Quoted 4 lines
two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQM data
and Xen can free the memory.Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Originally we statically allocate memory in initialization time, and the size is "
rmid_max*socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse*socket_inuse" for CQM related pages when user is really issuing query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.
Quoted 7 lines
Back to the above question why memory need de-allocating:
Since thermid_inuseandsocket_inusemay be changing from time to time, the allocating memory size will be different. Therefore we need to allocate them when user issues the hypercall, and then free them after the data digest is finished.Not sure whether I stated the problem clearly for you.
Thanks,
Dongxiao
There is a sensible upper bound for rmid_max, in the init function. There should be a set of pointers (one per socket), allocated on use, which can contain rmid_max data.
Once allocated, they are large enough for any eventuality, and don't need de/reallocating. This way, the amount of memory used is sockets_inuse * rmid_max.
~Andrew
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 83 lines
-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:51 PM
To: Xu, Dongxiao
Cc: Jan Beulich; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 11 lines · Dongxiao
Quoted 11 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:28 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line · Dongxiao
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:09 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected];Quoted 20 lines
Quoted 20 lines
Quoted 8 lines
Quoted 8 lines
[email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao
Previously due to the large amount of data, we use the method to let Xen share the CQM pages to Dom0 in read only way to avoid data copy. However since the data amount is reduced a lot with above approach, do
you
Quoted 11 lines
Quoted 1 line
Quoted 1 line
think whether we still need to use this share way? Or like most of the
other
Quoted 1 line
Quoted 1 line
sysctl/domctl (e.g., xl list) command, which uses
copy_to_guest()to passthe
Quoted 7 lines
Quoted 1 line
data?
Iirc we're talking about a square table with each dimension being the socket count. Considering an 8-node 4-socket system, that would still be 1024 entries, i.e. exceeding a page in size. Hence I would think that the read-only sharing approach might still be better. Of course, if the data amount was smaller (and by so much that even on huge systems it's no more than a page), that would be different.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Okay.
By using dynamic memory allocation and data sharing mechanism, we may
need
Quoted 3 lines
two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQMdata
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
and Xen can free the memory.
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Originally we statically allocate memory in initialization time, and the size is
"
rmid_max*socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse*socket_inuse" for CQM related pages when user is really issuing query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.Quoted 3 lines
Back to the above question why memory need de-allocating:
Since thermid_inuseandsocket_inusemay be changing from time to time, theallocating memory size will be different. Therefore we need to allocate them when user issues the hypercall, and then free them after the data digest is finished.
Quoted 5 lines
Not sure whether I stated the problem clearly for you.
Thanks,
Dongxiao
Quoted 7 lines
There is a sensible upper bound for
rmid_max, in the init function. There should be a set of pointers (one per socket), allocated on use, which can containrmid_maxdata.Once allocated, they are large enough for any eventuality, and don't need de/reallocating. This way, the amount of memory used is
sockets_inuse*rmid_max.
Hmm, this might be a good proposal, since according to the SDM (figure 17-20), the possible maximum rmid value may be 2^10=1024. Therefore for each socket, 2 pages are enough. (1024 * 8 = 8192)
But we may need to track such per-socket structure in CPU online/offline logic.
Jan, what's your opinion?
Thanks,
Dongxiao
Quoted 2 lines
~Andrew
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 10 lines
Quoted 9 lines
Quoted 1 line · Dongxiao
From: Andrew Cooper [mailto:[email protected]] There is a sensible upper bound for
rmid_max, in the init function. There should be a set of pointers (one per socket), allocated on use, which can containrmid_maxdata.Once allocated, they are large enough for any eventuality, and don't need de/reallocating. This way, the amount of memory used is
sockets_inuse*rmid_max.
Quoted 7 lines
Hmm, this might be a good proposal, since according to the SDM (figure 17-20), the possible maximum rmid value may be 2^10=1024. Therefore for each socket, 2 pages are enough. (1024 * 8 = 8192) But we may need to track such per-socket structure in CPU online/offline logic.
Jan, what's your opinion?
Sounds reasonable if you can make it work cleanly.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
In reply to Xu, DongxiaoQuoted 14 lines
Quoted 9 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao
By using dynamic memory allocation and data sharing mechanism, we may need two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQM data
and Xen can free the memory.Quoted 4 lines
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Quoted 7 lines
Originally we statically allocate memory in initialization time, and the size is "
rmid_max*socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse*socket_inuse" for CQM related pages when user is really issuing query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.
That wasn't my question. The question (tailored to the above description of yours) is - what are reasonable values of rmid_inuse and socket_inuse on a huge system?
Quoted 5 lines
Back to the above question why memory need de-allocating:
Since thermid_inuseandsocket_inusemay be changing from time to time, the allocating memory size will be different. Therefore we need to allocate them when user issues the hypercall, and then free them after the data digest is finished.
But once we have topology information in hand, deriving the maximum possible socket number from MADT data ought to be possible. Hence the allocation could be done with the maximum size. An alternative (allowing the allocated size to be limited to in-use resources) might be to do the de-allocation during CPU hotplug rather than upon explicit Dom0 request.
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 35 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:58 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 4 lines
Quoted 4 lines
Quoted 1 line · Dongxiao
From: Jan Beulich [mailto:[email protected]]
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Dongxiao
By using dynamic memory allocation and data sharing mechanism, we may
need
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQMdata
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
and Xen can free the memory.
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Quoted 7 lines
Originally we statically allocate memory in initialization time, and the size is "
rmid_max*socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse*socket_inuse" for CQM related pages when user is really issuing query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.
Quoted 3 lines
That wasn't my question. The question (tailored to the above description of yours) is - what are reasonable values of
rmid_inuseandsocket_inuseon a huge system?
According to SDM figure 17-20, the possible maximum of rmid should be about 2^10=1024. And for the rmid_inuse, it is somehow depending on the launched VM number, if administrator is interested in the LLC usage. For socket number, I think 2/4 sockets are common in the market.
Quoted 7 lines
Quoted 6 lines
Back to the above question why memory need de-allocating:
Since thermid_inuseandsocket_inusemay be changing from time to time, the allocating memory size will be different. Therefore we need to allocate them when user issues the hypercall, and then free them after the data digest is finished.
Quoted 6 lines
But once we have topology information in hand, deriving the maximum possible socket number from MADT data ought to be possible. Hence the allocation could be done with the maximum size. An alternative (allowing the allocated size to be limited to in-use resources) might be to do the de-allocation during CPU hotplug rather than upon explicit Dom0 request.
System may be boot with no CPU plugged in the socket, so can we get the full map in this case? I think it may be difficult...
Thanks,
Dongxiao
Quoted 2 lines
Jan
Re: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring feature
Quoted 37 lines
Quoted 13 lines
Quoted 1 line · Dongxiao
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 6:58 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v9 1/6] x86: detect and initialize Cache QoS Monitoring featureQuoted 1 line
Quoted 1 line
Quoted 1 line · Dongxiao
Quoted 19 lines
Quoted 3 lines
Quoted 3 lines
From: Jan Beulich [mailto:[email protected]]
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Dongxiao
By using dynamic memory allocation and data sharing mechanism, we may
need
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
two hypercalls when Dom0 tool stack is querying CQM related info.
- 1st hypercall is to let Xen allocate the memory and put CQM data there.
- 2nd hypercall is to indicate Dom0 tool stack already digested the CQMdata
Quoted 11 lines
Quoted 6 lines
Quoted 1 line
and Xen can free the memory.
Why would that memory ever need de-allocating?
Anyway, could you clarify again what amount of data we're talking about, without me having to dig out the old patch series?
Originally we statically allocate memory in initialization time, and the size is "
rmid_max*socket_max", which may be a very big value. As the propose in today's first mail, we can use the dynamic memory allocation as "rmid_inuse*socket_inuse" for CQM related pages when user is reallyissuing
Quoted 4 lines
Quoted 3 lines
query operations, this can save the allocated memory size, because at that point, we know the exact socket number in the system and exact the in use RMID, and no need to predict them as maximum values.
Quoted 8 lines
Quoted 3 lines
That wasn't my question. The question (tailored to the above description of yours) is - what are reasonable values of
rmid_inuseandsocket_inuseon a huge system?According to SDM figure 17-20, the possible maximum of rmid should be about 2^10=1024. And for the
rmid_inuse, it is somehow depending on the launched VM number, if administrator is interested in the LLC usage.
For socket number, I think 2/4 sockets are common in the market.
That's (a) not considering huge systems and (b) not even considering multi-node ones.
Quoted 15 lines
Quoted 2 lines
Quoted 2 lines
Back to the above question why memory need de-allocating:
Since thermid_inuseandsocket_inusemay be changing from time to time,the
Quoted 1 line
Quoted 1 line
allocating memory size will be different. Therefore we need to allocate
them
Quoted 9 lines
Quoted 2 lines
when user issues the hypercall, and then free them after the data digest is finished.
But once we have topology information in hand, deriving the maximum possible socket number from MADT data ought to be possible. Hence the allocation could be done with the maximum size. An alternative (allowing the allocated size to be limited to in-use resources) might be to do the de-allocation during CPU hotplug rather than upon explicit Dom0 request.
Quoted 2 lines
System may be boot with no CPU plugged in the socket, so can we get the full map in this case? I think it may be difficult...
Afaik the full topology has to be available, with hot-pluggable but not present CPUs marked accordingly. We use this information to e.g. set nr_cpu_ids.
Jan
PATCH v9 2/6 x86: dynamically attach/detach CQM service for a guest
In reply to Dongxiao XuAdd hypervisor side support for dynamically attach and detach CQM services for a certain guest.
When attach CQM service for a guest, system will allocate an RMID for it. When detach or guest is shutdown, the RMID will be retrieved back for future use.
--- xen/arch/x86/domain.c | 3 +++ xen/arch/x86/domctl.c | 28 ++++++++++++++++++++ xen/arch/x86/pqos.c | 60 ++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/domain.h | 2 ++ xen/include/asm-x86/pqos.h | 12 +++++++++ xen/include/public/domctl.h | 11 ++++++++ 6 files changed, 116 insertions(+)
xen/arch/x86/domain.c +3 -0
@@ -60,6 +60,7 @@#include <xen/numa.h> #include <xen/iommu.h> #include <compat/vcpu.h> +#include <asm/pqos.h> DEFINE_PER_CPU(struct vcpu *, curr_vcpu); DEFINE_PER_CPU(unsigned long, cr4);
@@ -612,6 +613,8 @@ void arch_domain_destroy(struct domain *d)free_xenheap_page (d->shared_info);cleanup_domain_irq_mapping (d); + +free_cqm_rmid (d); }unsigned long pv_guest_cr4_fixup (const struct vcpu *v,unsigned long guest_cr4)
xen/arch/x86/domctl.c +28 -0
@@ -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)
@@ -1245,6 +1246,33 @@ long arch_do_domctl( }break ; +case XEN_DOMCTL_attach_pqos: + { +if ( !(domctl->u.qos_type.flags & XEN_DOMCTL_pqos_cqm) ) + ret = -EINVAL ; +else if ( !system_supports_cqm () ) + ret = -ENODEV ; +else + ret =alloc_cqm_rmid (d); + } +break ; + +case XEN_DOMCTL_detach_pqos: + { +if ( !(domctl->u.qos_type.flags & XEN_DOMCTL_pqos_cqm) ) + ret = -EINVAL ; +else if ( !system_supports_cqm () ) + ret = -ENODEV ; +else if ( d->arch.pqos_cqm_rmid >0 ) + { +free_cqm_rmid (d); + ret =0 ; + } +else + ret = -ENOENT ; + } +break ; +default : ret =iommu_do_domctl (domctl, d, u_domctl);break ;
xen/arch/x86/pqos.c +60 -0
72 lines not on this page · raw message
xen/include/asm-x86/domain.h +2 -0
@@ -313,6 +313,8 @@ struct arch_domainspinlock_t e820_lock;struct e820entry *e820;unsigned int nr_e820; + +unsigned int pqos_cqm_rmid;/* CQM RMID assigned to the domain */ } __cacheline_aligned;#define has_arch_pdevs (d) (!list_empty(&(d)->arch.pdev_list))
xen/include/asm-x86/pqos.h +12 -0
@@ -16,6 +16,7 @@*/ #ifndef ASM_PQOS_H #define ASM_PQOS_H +#include <xen/sched.h> #include <public/xen.h> #include <xen/spinlock.h>
@@ -38,6 +39,17 @@ struct pqos_cqm { };extern struct pqos_cqm *cqm; +static inline bool_t system_supports_cqm (void ) +{ +return !!cqm; +} + +/* IA32_QM_CTR */ +#define IA32_QM_CTR_ERROR_MASK (0x3ul << 62) +void init_platform_qos (void ); +int alloc_cqm_rmid (struct domain *d); +void free_cqm_rmid (struct domain *d); +#endif
xen/include/public/domctl.h +11 -0
@@ -885,6 +885,14 @@ 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); +struct xen_domctl_qos_type { +#define _XEN_DOMCTL_pqos_cqm 0 +#define XEN_DOMCTL_pqos_cqm (1U<<_XEN_DOMCTL_pqos_cqm) +uint64_t flags; +}; +typedef struct xen_domctl_qos_type xen_domctl_qos_type_t ; +DEFINE_XEN_GUEST_HANDLE (xen_domctl_qos_type_t); +struct xen_domctl {uint32_t cmd;#define XEN_DOMCTL_createdomain 1
@@ -954,6 +962,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
@@ -1014,6 +1024,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_type qos_type;uint8_t pad[128 ]; } u; };
Signature · 1 line
1.7.9.5
Re: [PATCH v9 2/6] x86: dynamically attach/detach CQM service for a guest
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/domctl.c +0
-0@@ -1245,6 +1246,33 @@ long arch_do_domctl( }break ;
xen/arch/x86/domctl.c long arch_do_domctl( · line 1257
Quoted 10 lines
xen/arch/x86/domctl.c +9
-0+case XEN_DOMCTL_attach_pqos: + { +if ( !(domctl->u.qos_type.flags & XEN_DOMCTL_pqos_cqm) ) + ret = -EINVAL ; +else if ( !system_supports_cqm () ) + ret = -ENODEV ; +else + ret =alloc_cqm_rmid (d); + }
Pointless curly braces.
Quoted 4 lines
xen/arch/x86/domctl.c +4
-0+case XEN_DOMCTL_detach_pqos: + { +if ( !(domctl->u.qos_type.flags & XEN_DOMCTL_pqos_cqm) ) + ret = -EINVAL ;
xen/arch/x86/domctl.c long arch_do_domctl( · line 1273
Quoted 10 lines
xen/arch/x86/domctl.c +10
-0+else if ( !system_supports_cqm () ) + ret = -ENODEV ; +else if ( d->arch.pqos_cqm_rmid >0 ) + { +free_cqm_rmid (d); + ret =0 ; + } +else + ret = -ENOENT ; + }
Again.
Jan
PATCH v9 3/6 x86: collect CQM information from all sockets
In reply to Dongxiao XuCollect CQM information (L3 cache occupancy) from all sockets. Upper layer application can parse the data structure to get the information of guest's L3 cache occupancy on certain sockets.
--- xen/arch/x86/pqos.c | 43 +++++++++++++++++++++++++++++ xen/arch/x86/sysctl.c | 58 +++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/msr-index.h | 4 +++ xen/include/asm-x86/pqos.h | 3 ++ xen/include/public/sysctl.h | 11 ++++++++ 5 files changed, 119 insertions(+)
xen/arch/x86/pqos.c +43 -0
@@ -15,6 +15,7 @@* more details. */ #include <asm/processor.h> +#include <asm/msr.h> #include <xen/init.h> #include <xen/mm.h> #include <xen/spinlock.h>
@@ -205,6 +206,48 @@ out:spin_unlock (&cqm->cqm_lock); } +static void read_cqm_data (void *arg) +{ +uint64_t cqm_data; +unsigned int rmid; +int socket =cpu_to_socket (smp_processor_id ()); +unsigned long i; + +ASSERT (system_supports_cqm ()); + +if ( socket <0 ) +return ; + +for ( rmid = cqm->min_rmid; rmid <= cqm->max_rmid; rmid++ ) + { +if ( cqm->rmid_to_dom[rmid] ==DOMID_INVALID ) +continue ; + +wrmsr (MSR_IA32_QOSEVTSEL ,QOS_MONITOR_EVTID_L3 , rmid); +rdmsrl (MSR_IA32_QMC , cqm_data); + + i = (unsigned long )(cqm->max_rmid +1 ) * socket + rmid; +if ( !(cqm_data &IA32_QM_CTR_ERROR_MASK ) ) + cqm->buffer[i] = cqm_data * cqm->upscaling_factor; + } +} + +void get_cqm_info (const cpumask_t *cpu_cqmdata_map) +{ +unsigned int nr_sockets =cpumask_weight (cpu_cqmdata_map) +1 ; +unsigned int nr_rmids = cqm->max_rmid +1 ; + +/* Read CQM data in current CPU */ +read_cqm_data (NULL ); +/* Issue IPI to other CPUs to read CQM data */ +on_selected_cpus (cpu_cqmdata_map, read_cqm_data,NULL ,1 ); + +/* Copy the rmid_to_dom info to the buffer */ +memcpy (cqm->buffer + nr_sockets * nr_rmids, cqm->rmid_to_dom, +sizeof (domid_t) * (cqm->max_rmid +1 )); + +} +/* * Local variables: * mode: C
xen/arch/x86/sysctl.c +58 -0
76 lines not on this page · raw message
xen/include/asm-x86/msr-index.h +4 -0
@@ -489,4 +489,8 @@/* Geode defined MSRs */ #define MSR_GEODE_BUSCONT_CONF0 0x00001900 +/* Platform QoS register */ +#define MSR_IA32_QOSEVTSEL 0x00000c8d +#define MSR_IA32_QMC 0x00000c8e +#endif /* __ASM_MSR_INDEX_H */
xen/include/asm-x86/pqos.h +3 -0
@@ -17,6 +17,8 @@#ifndef ASM_PQOS_H #define ASM_PQOS_H #include <xen/sched.h> +#include <xen/cpumask.h> +#include <public/domctl.h> #include <public/xen.h> #include <xen/spinlock.h>
@@ -51,5 +53,6 @@ void init_platform_qos(void);int alloc_cqm_rmid (struct domain *d);void free_cqm_rmid (struct domain *d); +void get_cqm_info (const cpumask_t *cpu_cqmdata_map);#endif
xen/include/public/sysctl.h +11 -0
@@ -632,6 +632,15 @@ 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); +struct xen_sysctl_getcqminfo { +uint64_aligned_t buffer_mfn; +uint32_t size; +uint32_t nr_rmids; +uint32_t nr_sockets; +}; +typedef struct xen_sysctl_getcqminfo xen_sysctl_getcqminfo_t ; +DEFINE_XEN_GUEST_HANDLE (xen_sysctl_getcqminfo_t); +struct xen_sysctl {uint32_t cmd;
@@ -654,6 +663,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_getcqminfo 21uint32_t interface_version;/* XEN_SYSCTL_INTERFACE_VERSION */ union {struct xen_sysctl_readconsole readconsole;
@@ -675,6 +685,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_getcqminfo getcqminfo;uint8_t pad[128 ]; } u; };
Signature · 1 line
1.7.9.5
Re: [PATCH v9 3/6] x86: collect CQM information from all sockets
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c +13
-0+static void read_cqm_data (void *arg) +{ +uint64_t cqm_data; +unsigned int rmid; +int socket =cpu_to_socket (smp_processor_id ()); +unsigned long i; + +ASSERT (system_supports_cqm ()); + +if ( socket <0 ) +return ; + +for ( rmid = cqm->min_rmid; rmid <= cqm->max_rmid; rmid++ )
xen/arch/x86/pqos.c out: · line 231
Quoted 10 lines
xen/arch/x86/pqos.c +10
-0+ { +if ( cqm->rmid_to_dom[rmid] ==DOMID_INVALID ) +continue ; + +wrmsr (MSR_IA32_QOSEVTSEL ,QOS_MONITOR_EVTID_L3 , rmid); +rdmsrl (MSR_IA32_QMC , cqm_data); + + i = (unsigned long )(cqm->max_rmid +1 ) * socket + rmid; +if ( !(cqm_data &IA32_QM_CTR_ERROR_MASK ) ) + cqm->buffer[i] = cqm_data * cqm->upscaling_factor;
So my earlier comment regarding the NR_CPUS use in the allocation of this buffer becomes even more relevant with the fact that you're indexing by socket here, not by CPU - in that case, even nr_cpu_ids is likely to be a gross overestimation.
xen/arch/x86/sysctl.c void arch_do_physinfo(xen_sysctl_physinfo_t *pi) · line 76
Quoted 6 lines
xen/arch/x86/sysctl.c +6
-0+static void select_socket_cpu (cpumask_t *cpu_bitmap) +{ +int i; +unsigned int cpu; +int socket, socket_curr =cpu_to_socket (smp_processor_id ()); +DECLARE_BITMAP (sockets,NR_CPUS );
Please avoid putting a 4095-bit bitmap on the stack.
xen/arch/x86/sysctl.c void arch_do_physinfo(xen_sysctl_physinfo_t *pi) · line 79
Quoted 3 lines
xen/arch/x86/sysctl.c +3
-0+ +bitmap_zero (sockets,NR_CPUS ); +if (socket_curr >=0 )
Coding style.
Jan
PATCH v9 4/6 x86: enable CQM monitoring for each domain RMID
In reply to Dongxiao XuIf 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.
--- xen/arch/x86/domain.c | 5 +++++ xen/arch/x86/pqos.c | 14 ++++++++++++++ xen/include/asm-x86/msr-index.h | 1 + xen/include/asm-x86/pqos.h | 1 + 4 files changed, 21 insertions(+)
xen/arch/x86/domain.c +5 -0
@@ -1372,6 +1372,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->used_rmid ) +cqm_assoc_rmid (0 ); p->arch.ctxt_switch_from (p); }
@@ -1396,6 +1398,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) :
xen/arch/x86/pqos.c +14 -0
@@ -62,6 +62,7 @@ static void __init parse_pqos_param(char *s)custom_param ("pqos" , parse_pqos_param);struct pqos_cqm __read_mostly *cqm =NULL ; +static uint64_t __read_mostly rmid_mask;static void __init init_cqm (void ) {
@@ -135,6 +136,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 ( opt_cqm && (qm_features &QOS_MONITOR_TYPE_L3 ) )init_cqm (); }
@@ -248,6 +251,17 @@ void get_cqm_info(const cpumask_t *cpu_cqmdata_map) } +void cqm_assoc_rmid (unsigned int rmid) +{ +uint64_t val; +uint64_t new_val; + +rdmsrl (MSR_IA32_PQR_ASSOC , val); + new_val = (val & ~rmid_mask) | (rmid & rmid_mask); +if ( val != new_val ) +wrmsrl (MSR_IA32_PQR_ASSOC , new_val); +} +/* * Local variables: * mode: C
xen/include/asm-x86/msr-index.h +1 -0
@@ -492,5 +492,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 */
xen/include/asm-x86/pqos.h +1 -0
@@ -54,5 +54,6 @@ void init_platform_qos(void);int alloc_cqm_rmid (struct domain *d);void free_cqm_rmid (struct domain *d);void get_cqm_info (const cpumask_t *cpu_cqmdata_map); +void cqm_assoc_rmid (unsigned int rmid);#endif
Signature · 1 line
1.7.9.5
Re: [PATCH v9 4/6] x86: enable CQM monitoring for each domain RMID
xen/arch/x86/pqos.c void get_cqm_info(const cpumask_t *cpu_cqmdata_map) · line 263
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Dongxiao Xu
xen/arch/x86/pqos.c +10
-0+void cqm_assoc_rmid (unsigned int rmid) +{ +uint64_t val; +uint64_t new_val; + +rdmsrl (MSR_IA32_PQR_ASSOC , val); + new_val = (val & ~rmid_mask) | (rmid & rmid_mask); +if ( val != new_val ) +wrmsrl (MSR_IA32_PQR_ASSOC , new_val); +}
Considering that even the addition of two RDMSRs in the context switch path is relatively expensive, I think you will want to track the most recently written value in a per-CPU variable.
Jan
PATCH v9 5/6 xsm: add platform QoS related xsm policies
In reply to Dongxiao XuAdd xsm policies for attach/detach pqos services and get CQM info hypercalls.
--- tools/flask/policy/policy/modules/xen/xen.if | 2 +- tools/flask/policy/policy/modules/xen/xen.te | 5 ++++- xen/xsm/flask/hooks.c | 8 ++++++++ xen/xsm/flask/policy/access_vectors | 17 ++++++++++++++--- 4 files changed, 27 insertions(+), 5 deletions(-)
tools/flask/policy/policy/modules/xen/xen.if +1 -1
@@ -49,7 +49,7 @@ define(`create_domain_common', ` getdomaininfo hypercall setvcpucontext setextvcpucontext getscheduler getvcpuinfo getvcpuextstate getaddrsize getaffinity setaffinity }; - allow $1 $2:domain2 { set_cpuid settsc setscheduler setclaim set_max_evtchn }; + allow $1 $2:domain2 { set_cpuid settsc setscheduler setclaim set_max_evtchn pqos_op }; allow $1 $2:security check_context; allow $1 $2:shadow enable; allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op };
tools/flask/policy/policy/modules/xen/xen.te +4 -1
@@ -64,6 +64,9 @@ allow dom0_t xen_t:xen { getidle debug getcpuinfo heap pm_op mca_op lockprof cpupool_op tmem_op tmem_control getscheduler setscheduler }; +allow dom0_t xen_t:xen2 { + pqos_op +}; allow dom0_t xen_t:mmu memorymap; # Allow dom0 to use these domctls on itself. For domctls acting on other
@@ -76,7 +79,7 @@ allow dom0_t dom0_t:domain { getpodtarget setpodtarget set_misc_info set_virq_handler }; allow dom0_t dom0_t:domain2 { - set_cpuid gettsc settsc setscheduler set_max_evtchn + set_cpuid gettsc settsc setscheduler set_max_evtchn pqos_op }; allow dom0_t dom0_t:resource { add remove };
xen/xsm/flask/hooks.c +8 -0
@@ -730,6 +730,10 @@ static int flask_domctl(struct domain *d, int cmd)case XEN_DOMCTL_set_max_evtchn:return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__SET_MAX_EVTCHN ); +case XEN_DOMCTL_attach_pqos: +case XEN_DOMCTL_detach_pqos: +return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__PQOS_OP ); +default :printk ("flask_domctl: Unknown op %d\n" , cmd);return -EPERM ;
@@ -785,6 +789,10 @@ static int flask_sysctl(int cmd)case XEN_SYSCTL_numainfo:return domain_has_xen (current->domain,XEN__PHYSINFO ); +case XEN_SYSCTL_getcqminfo: +return avc_current_has_perm (SECINITSID_XEN ,SECCLASS_XEN2 , +XEN2__PQOS_OP ,NULL ); +default :printk ("flask_sysctl: Unknown op %d\n" , cmd);return -EPERM ;
xen/xsm/flask/policy/access_vectors +14 -3
@@ -3,9 +3,9 @@ # # class class_name { permission_name ... } -# Class xen consists of dom0-only operations dealing with the hypervisor itself. -# Unless otherwise specified, the source is the domain executing the hypercall, -# and the target is the xen initial sid (type xen_t). +# Class xen and xen2 consists of dom0-only operations dealing with the +# hypervisor itself. Unless otherwise specified, the source is the domain +# executing the hypercall, and the target is the xen initial sid (type xen_t). class xen { # XENPF_settime
@@ -75,6 +75,14 @@ class xen setscheduler } +# This is a continuation of class xen, since only 32 permissions can be +# defined per class +class xen2 +{ +# XEN_SYSCTL_getcqminfo + pqos_op +} + # Classes domain and domain2 consist of operations that a domain performs on # another domain or on itself. Unless otherwise specified, the source is the # domain executing the hypercall, and the target is the domain being operated on
@@ -196,6 +204,9 @@ class domain2 setclaim # XEN_DOMCTL_set_max_evtchn set_max_evtchn +# XEN_DOMCTL_attach_pqos +# XEN_DOMCTL_detach_pqos + pqos_op } # Similar to class domain, but primarily contains domctls related to HVM domains
Signature · 1 line
1.7.9.5
PATCH v9 6/6 tools: enable Cache QoS Monitoring feature for libxl/libxc
In reply to Dongxiao XuIntroduced two new xl commands to attach/detach CQM service for a guest
$ xl pqos-attach cqm domid $ xl pqos-detach cqm domid
Introduce one new xl command to retrieve guest CQM information
$ xl pqos-list cqm
--- docs/man/xl.pod.1 | 23 ++++++++ tools/libxc/xc_domain.c | 36 ++++++++++++ tools/libxc/xenctrl.h | 12 ++++ tools/libxl/Makefile | 3 +- tools/libxl/libxl.h | 4 ++ tools/libxl/libxl_pqos.c | 132 +++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 7 +++ tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 111 ++++++++++++++++++++++++++++++++++++ tools/libxl/xl_cmdtable.c | 15 +++++ 10 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 tools/libxl/libxl_pqos.c
docs/man/xl.pod.1 +23 -0
@@ -1334,6 +1334,29 @@ Load FLASK policy from the given policy file. The initial policy is provided to the hypervisor as a multiboot module; this command allows runtime updates to the policy. Loading new security policy will reset runtime changes to device labels. +=head1 PLATFORM QOS + +New Intel processor may offer monitoring capability in each logical processor to +measure specific quality-of-service metric, for example, Cache QoS Monitoring to +get L3 cache occupancy. + +=over 4 + +=item B<pqos-attach> [I<qos-type>] [I<domain-id>] + +Attach certain platform QoS service for a domain. +Current supported I<qos-type> is: "cqm". + +=item B<pqos-detach> [I<qos-type>] [I<domain-id>] + +Detach certain platform QoS service from a domain. +Current supported I<qos-type> is: "cqm". + +=item B<pqos-list> [I<qos-type>] + +List platform QoS information for QoS attached domains. +Current supported I<qos-type> is: "cqm". + =back =head1 TO BE DOCUMENTED
tools/libxc/xc_domain.c +36 -0
@@ -1776,6 +1776,42 @@ int xc_domain_set_max_evtchn(xc_interface *xch, uint32_t domid,return do_domctl (xch, &domctl); } +int xc_domain_pqos_attach (xc_interface *xch,uint32_t domid,uint64_t flags) +{ +DECLARE_DOMCTL ; + domctl.cmd = XEN_DOMCTL_attach_pqos; + domctl.domain = (domid_t )domid; + domctl.u.qos_type.flags = flags; +return do_domctl (xch, &domctl); +} + +int xc_domain_pqos_detach (xc_interface *xch,uint32_t domid,uint64_t flags) +{ +DECLARE_DOMCTL ; + domctl.cmd = XEN_DOMCTL_detach_pqos; + domctl.domain = (domid_t )domid; + domctl.u.qos_type.flags = flags; +return do_domctl (xch, &domctl); +} + +int xc_domain_getcqminfo (xc_interface *xch,xc_cqminfo_t *info) +{ +int ret; +DECLARE_SYSCTL ; + + sysctl.cmd = XEN_SYSCTL_getcqminfo; + ret =xc_sysctl (xch, &sysctl); +if ( ret >=0 ) + { + info->buffer_mfn = sysctl.u.getcqminfo.buffer_mfn; + info->size = sysctl.u.getcqminfo.size; + info->nr_rmids = sysctl.u.getcqminfo.nr_rmids; + info->nr_sockets = sysctl.u.getcqminfo.nr_sockets; + } + +return ret; +} +/* * Local variables: * mode: C
tools/libxc/xenctrl.h +12 -0
@@ -2427,4 +2427,16 @@ int xc_kexec_load(xc_interface *xch, uint8_t type, uint16_t arch,*/ int xc_kexec_unload (xc_interface *xch,int type); +struct xc_cqminfo +{ +uint64_aligned_t buffer_mfn; +uint32_t size; +uint32_t nr_rmids; +uint32_t nr_sockets; +}; +typedef struct xc_cqminfo xc_cqminfo_t ; + +int xc_domain_pqos_attach (xc_interface *xch,uint32_t domid,uint64_t flags); +int xc_domain_pqos_detach (xc_interface *xch,uint32_t domid,uint64_t flags); +int xc_domain_getcqminfo (xc_interface *xch,xc_cqminfo_t *info);#endif /* XENCTRL_H */
tools/libxl/Makefile +2 -1
@@ -76,7 +76,8 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ libxl_internal.o libxl_utils.o libxl_uuid.o \ libxl_json.o libxl_aoutils.o libxl_numa.o \ libxl_save_callout.o _libxl_save_msgs_callout.o \ - libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y) + libxl_qmp.o libxl_event.o libxl_fork.o libxl_pqos.o \ + $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o $(LIBXL_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
tools/libxl/libxl.h +4 -0
@@ -1105,6 +1105,10 @@ int libxl_flask_getenforce(libxl_ctx *ctx);int libxl_flask_setenforce (libxl_ctx *ctx,int mode);int libxl_flask_loadpolicy (libxl_ctx *ctx,void *policy,uint32_t size); +int libxl_pqos_attach (libxl_ctx *ctx,uint32_t domid,const char * qos_type); +int libxl_pqos_detach (libxl_ctx *ctx,uint32_t domid,const char * qos_type); +void libxl_map_cqm_buffer (libxl_ctx *ctx,libxl_cqminfo *xlinfo); +/* misc */ /* Each of these sets or clears the flag according to whether the
tools/libxl/libxl_pqos.c new file +132 -0
132 lines not on this page · raw message
tools/libxl/libxl_types.idl +7 -0
@@ -596,3 +596,10 @@ libxl_event = Struct("event",[ ])), ("domain_create_console_available", Struct(None, [])), ]))]) + +libxl_cqminfo = Struct("cqminfo", [ + ("buffer_virt", uint64), + ("size", uint32), + ("nr_rmids", uint32), + ("nr_sockets", uint32), + ])
tools/libxl/xl.h +3 -0
@@ -106,6 +106,9 @@ int main_setenforce(int argc, char **argv);int main_loadpolicy (int argc,char **argv);int main_remus (int argc,char **argv);int main_devd (int argc,char **argv); +int main_pqosattach (int argc,char **argv); +int main_pqosdetach (int argc,char **argv); +int main_pqoslist (int argc,char **argv);void help (const char *command);
tools/libxl/xl_cmdimpl.c +111 -0
117 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +15 -0
@@ -494,6 +494,21 @@ struct cmd_spec cmd_table[] = { "[options]", "-F Run in the foreground", }, + {"pqos-attach" , + &main_pqosattach,0 ,1 , +"Allocate and map qos resource" , +"<Resource> <Domain>" , + }, + { "pqos-detach", + &main_pqosdetach,0 ,1 , +"Reliquish qos resource" , +"<Resource> <Domain>" , + }, + { "pqos-list", + &main_pqoslist,0 ,0 , +"List qos information for all domains" , + "<Resource>", + }, };int cmdtable_len =sizeof (cmd_table)/sizeof (struct cmd_spec );
Signature · 1 line
1.7.9.5
Re: [PATCH v9 6/6] tools: enable Cache QoS Monitoring feature for libxl/libxc
Quoted 10 lines · Dongxiao Xu
+=item B<pqos-attach> [I<qos-type>] [I<domain-id>]
docs/man/xl.pod.1 +3
-0+ +Attach certain platform QoS service for a domain. +Current supported I<qos-type> is: "cqm".tools/libxl/libxl.h +0
-0
tools/libxl/libxl.h int libxl_flask_getenforce(libxl_ctx *ctx); · line 1109
Quoted 5 lines
tools/libxl/libxl.h +2
-0@@ -1105,6 +1105,10 @@ int libxl_flask_getenforce(libxl_ctx *ctx);int libxl_flask_setenforce (libxl_ctx *ctx,int mode);int libxl_flask_loadpolicy (libxl_ctx *ctx,void *policy,uint32_t size); +int libxl_pqos_attach (libxl_ctx *ctx,uint32_t domid,const char * qos_type); +int libxl_pqos_detach (libxl_ctx *ctx,uint32_t domid,const char * qos_type);
I have a feeling that qos_type should actually be an enum in the IDL. The xl functions can probably use the autogenerate libxl_BLAH_from_string() functions to help with parsing.
What other qos types are you envisaging? Is it valid to enable or disable multiple such things independently?
tools/libxl/libxl.h int libxl_flask_getenforce(libxl_ctx *ctx); · line 1110
Quoted 1 line
tools/libxl/libxl.h +1
-0+void libxl_map_cqm_buffer (libxl_ctx *ctx,libxl_cqminfo *xlinfo);
So each qos type is going to come with its own map function?
I don't see the LIBXL_HAVE #define which we discussed last time anywhere here.
tools/libxl/libxl_types.idl libxl_event = Struct("event",[ · line 601
Quoted 11 lines
tools/libxl/libxl_types.idl +3
-0@@ -596,3 +596,10 @@ libxl_event = Struct("event",[ ])), ("domain_create_console_available", Struct(None, [])), ]))]) + +libxl_cqminfo = Struct("cqminfo", [ + ("buffer_virt", uint64),
An opaque void * masquerading as an integer is not a suitable interface.
This should be a (pointer to a) struct of the appropriate type, or an Array of such types etc (or possibly several such arrays depending on what you are returning).
I haven't looked in detail into what is actually in this buffer, but please try and have libxl bake it into a more consumable form -- e.g. an array of per-domain properties or something rather than a raw list.
Quoted 36 lines
tools/libxl/libxl_types.idl +4
-0+ ("size", uint32), + ("nr_rmids", uint32), + ("nr_sockets", uint32), + ])[...][
tools/libxl/libxl_types.idl +31
-0+static void print_cqm_info(const libxl_cqminfo *info) +{ + unsigned int i, j, k; + char *domname; + int print_header; + int cqm_domains = 0; + uint16_t *rmid_to_dom; + uint64_t *l3c_data; + uint32_t first_domain = 0; + unsigned int num_domains = 1024; + + if (info->nr_rmids == 0) { + printf("System doesn't support CQM.\n"); + return; + } + + print_header = 1; + l3c_data = (uint64_t *)(info->buffer_virt); + rmid_to_dom = (uint16_t *)(info->buffer_virt + + info->nr_sockets * info->nr_rmids * sizeof(uint64_t)); + for (i = first_domain; i < (first_domain + num_domains); i++) { + for (j = 0; j < info->nr_rmids; j++) { + if (rmid_to_dom[j] != i) + continue; + + if (print_header) { + printf("Name ID"); + for (k = 0; k < info->nr_sockets; k++) + printf("\tSocketID\tL3C_Usage"); + print_header = 0; + }
tools/libxl/libxl_types.idl
Quoted 10 lines
tools/libxl/libxl_types.idl +10
-0+ + domname = libxl_domid_to_name(ctx, i); + printf("\n%-40s %5d", domname, i); + free(domname); + cqm_domains++; + + for (k = 0; k < info->nr_sockets; k++) + printf("%10u %16lu ", + k, l3c_data[info->nr_rmids * k + j]); + }
This should be transformed into a sensible interface within libxl so that it can be consumed in a straightforward manner by the users of libxl, rather than asking them all to reimplement this.
Is the buffer format considered a frozen ABI?
Quoted 6 lines
tools/libxl/xl_cmdtable.c +0
-0@@ -494,6 +494,21 @@ struct cmd_spec cmd_table[] = { "[options]",
tools/libxl/xl_cmdtable.c struct cmd_spec cmd_table[] = { · line 504
Quoted 10 lines
tools/libxl/xl_cmdtable.c +8
-0"-F Run in the foreground" , }, + { "pqos-attach", + &main_pqosattach,0 ,1 , +"Allocate and map qos resource" , +"<Resource> <Domain>" , + }, + { "pqos-detach", + &main_pqosdetach,0 ,1 , + "Reliquish qos resource",
"Relinquish"
and perhaps "resources" (in both cases)
Quoted 10 lines
tools/libxl/xl_cmdtable.c +7
-0+ "<Resource> <Domain>", + }, + {"pqos-list" , + &main_pqoslist,0 ,0 , +"List qos information for all domains" , + "<Resource>", + }, };int cmdtable_len =sizeof (cmd_table)/sizeof (struct cmd_spec );
Re: [PATCH v9 6/6] tools: enable Cache QoS Monitoring feature for libxl/libxc
Quoted 24 lines
-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, February 19, 2014 5:39 PM
To: Xu, Dongxiao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v9 6/6] tools: enable Cache QoS Monitoring feature for libxl/libxcQuoted 13 lines · Dongxiao Xu
+=item B<pqos-attach> [I<qos-type>] [I<domain-id>]
docs/man/xl.pod.1 +3
-0+ +Attach certain platform QoS service for a domain. +Current supported I<qos-type> is: "cqm".tools/libxl/libxl.h +0
-0@@ -1105,6 +1105,10 @@ int libxl_flask_getenforce(libxl_ctx *ctx);int libxl_flask_setenforce (libxl_ctx *ctx,int mode);int libxl_flask_loadpolicy (libxl_ctx *ctx,void *policy,uint32_t size);
Quoted 6 lines
tools/libxl/libxl.h int libxl_flask_getenforce(libxl_ctx *ctx); · line 1109
Quoted 2 lines
tools/libxl/libxl.h +2
-0+int libxl_pqos_attach (libxl_ctx *ctx,uint32_t domid,const char * qos_type); +int libxl_pqos_detach (libxl_ctx *ctx,uint32_t domid,const char * qos_type);I have a feeling that
qos_typeshould actually be an enum in the IDL. The xl functions can probably use the autogeneratelibxl_BLAH_from_string()functions to help with parsing.
Okay.
Quoted 3 lines
What other qos types are you envisaging? Is it valid to enable or disable multiple such things independently?
Yes, there are different types of QoS resources, and yes, they need to handle separately.
Quoted 4 lines
tools/libxl/libxl.h int libxl_flask_getenforce(libxl_ctx *ctx); · line 1110
Quoted 2 lines
tools/libxl/libxl.h +1
-0+void libxl_map_cqm_buffer (libxl_ctx *ctx,libxl_cqminfo *xlinfo);So each qos type is going to come with its own map function?
Yes.
Quoted 3 lines
I don't see the
LIBXL_HAVE#define which we discussed last time anywhere here.
Oh, I mis-understood your previous comments.
Will add it in next patch version.
Quoted 15 lines
tools/libxl/libxl_types.idl libxl_event = Struct("event",[ · line 601
Quoted 12 lines
tools/libxl/libxl_types.idl +3
-0@@ -596,3 +596,10 @@ libxl_event = Struct("event",[ ])), ("domain_create_console_available", Struct(None, [])), ]))]) + +libxl_cqminfo = Struct("cqminfo", [ + ("buffer_virt", uint64),An opaque void * masquerading as an integer is not a suitable interface.
Quoted 7 lines
This should be a (pointer to a) struct of the appropriate type, or an Array of such types etc (or possibly several such arrays depending on what you are returning).
I haven't looked in detail into what is actually in this buffer, but please try and have libxl bake it into a more consumable form -- e.g. an array of per-domain properties or something rather than a raw list.
The buffer contains the data of L3 cache usage for a certain domain on certain socket, so there is no structure inside.
For defining it as an array, we don't know its size until the libxl_map_cqm_buffer() function got returned. :(
Quoted 44 lines
Quoted 23 lines
tools/libxl/libxl_types.idl +4
-0+ ("size", uint32), + ("nr_rmids", uint32), + ("nr_sockets", uint32), + ])[...][
tools/libxl/libxl_types.idl +17
-0+static void print_cqm_info(const libxl_cqminfo *info) +{ + unsigned int i, j, k; + char *domname; + int print_header; + int cqm_domains = 0; + uint16_t *rmid_to_dom; + uint64_t *l3c_data; + uint32_t first_domain = 0; + unsigned int num_domains = 1024; + + if (info->nr_rmids == 0) { + printf("System doesn't support CQM.\n"); + return; + } + + print_header = 1;tools/libxl/libxl_types.idl
Quoted 10 lines
tools/libxl/libxl_types.idl +10
-0+ l3c_data = (uint64_t *)(info->buffer_virt); + rmid_to_dom = (uint16_t *)(info->buffer_virt + + info->nr_sockets * info->nr_rmids * sizeof(uint64_t)); + for (i = first_domain; i < (first_domain + num_domains); i++) { + for (j = 0; j < info->nr_rmids; j++) { + if (rmid_to_dom[j] != i) + continue; + + if (print_header) { + printf("NameID");
Quoted 10 lines
tools/libxl/libxl_types.idl +10
-0+ for (k = 0; k < info->nr_sockets; k++) + printf("\tSocketID\tL3C_Usage"); + print_header = 0; + } + + domname = libxl_domid_to_name(ctx, i); + printf("\n%-40s %5d", domname, i); + free(domname); + cqm_domains++; +
Quoted 8 lines
tools/libxl/libxl_types.idl
Quoted 4 lines
tools/libxl/libxl_types.idl +4
-0+ for (k = 0; k < info->nr_sockets; k++) + printf("%10u %16lu ", + k, l3c_data[info->nr_rmids * k + j]); + }This should be transformed into a sensible interface within libxl so that it can be consumed in a straightforward manner by the users of libxl, rather than asking them all to reimplement this.
Okay.
Quoted 2 lines
Is the buffer format considered a frozen ABI?
Yes, it is a fixed style for CQM.
Quoted 20 lines
Quoted 7 lines
tools/libxl/xl_cmdtable.c +0
-0@@ -494,6 +494,21 @@ struct cmd_spec cmd_table[] = { "[options]",tools/libxl/xl_cmdtable.c struct cmd_spec cmd_table[] = { · line 504
Quoted 10 lines
tools/libxl/xl_cmdtable.c +8
-0"-F Run in the foreground" , }, + { "pqos-attach", + &main_pqosattach,0 ,1 , +"Allocate and map qos resource" , +"<Resource> <Domain>" , + }, + { "pqos-detach", + &main_pqosdetach,0 ,1 , + "Reliquish qos resource","Relinquish"
Quoted 1 line
and perhaps "resources" (in both cases)
Okay.
Thanks,
Dongxiao
Quoted 12 lines
Quoted 11 lines
tools/libxl/xl_cmdtable.c +7
-0+ "<Resource> <Domain>", + }, + {"pqos-list" , + &main_pqoslist,0 ,0 , +"List qos information for all domains" , + "<Resource>", + }, };int cmdtable_len =sizeof (cmd_table)/sizeof (struct cmd_spec );