API to query NUMA node of mfn
I would like to verify on which NUMA node the PFNs used by a HVM guest are located. Is there an API for that? Something like:
foreach (pfn, domid)
mfns_per_node[pfn_to_node(pfn)]++
foreach (node)
printk("%x %x\n", node, mfns_per_node[node])Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 10.07.17 at 12:10, <[email protected]> wrote:
I would like to verify on which NUMA node the PFNs used by a HVM guest are located. Is there an API for that? Something like:
foreach (pfn, domid)
mfns_per_node[pfn_to_node(pfn)]++ foreach (node) printk("%x %x\n", node, mfns_per_node[node])
phys_to_nid() ?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 10 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 10.07.17 at 12:10, <[email protected]> wrote:
I would like to verify on which NUMA node the PFNs used by a HVM guest are located. Is there an API for that? Something like:
foreach (pfn, domid)
mfns_per_node[pfn_to_node(pfn)]++ foreach (node) printk("%x %x\n", node, mfns_per_node[node])
phys_to_nid()?
Soo I wrote some code for exactly this for Xen 4.4.4 , along with creation of a PGM map to see the NUMA nodes locality.
Attaching them here..
Quoted 9 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Froma5e039801c989df29b704a4a5256715321906535Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 6 Jun 2017 20:31:21 -0400
Subject: [PATCH 1/7] xen/x86: XENDOMCTL_get_memlist: Make it work
This hypercall has a bunch of problems which this patch fixes.
Specifically it is not preempt capable, takes a nested lock, and the data is stale after you get it.
The nested lock (and order inversion) is due to the copy_to_guest_offset call. The particular implementation (see __hvm_copy) makes P2M calls (p2m_mem_paging_populate), which take the p2m_lock.
We avoid this by taking the p2m lock early (before page_lock) in:
if ( !guest_handle_okay(domctl->u.getmemlist.buffer, max_pfns) )
here (this takes the p2m lock and then unlocks). And since it checks out, we can use the fast variant of copy_to_guest (which still takes the p2m lock).
And we extend this thinking in the copying of the values to the guest. The loop that copies the mfns[] to buffer takes (potentially) a p2m lock on every invocation. So to not make us holding the page_alloc_lock we create a temporary array (mfns) - which is filled while holding page_alloc_lock. But we don't hold any locks (well, we hold the domctl lock) while copying to the guest.
The preemption is used and we also honor 'start_pfn' which is renamed to 'index' - as there is no enforced order in which the pages correspond to PFNs.
All of those are fixed by this patch, also it means that the callers of xc_get_pfn_list have to take into account that max_pfns != num_pfns value and loop around.
See patch: "libxc: Use XENDOMCTL_get_memlist properly" and "xen-mceinj: Loop around xc_get_pfn_list"
--- xen/arch/x86/domctl.c | 76 ++++++++++++++++++++++++++++++--------------- xen/arch/x86/mm/hap/hap.c | 1 + xen/arch/x86/mm/p2m-ept.c | 2 ++ xen/include/asm-x86/p2m.h | 2 ++ xen/include/public/domctl.h | 36 ++++++++++++++++----- 5 files changed, 84 insertions(+), 33 deletions(-)
xen/arch/x86/domctl.c +51 -25
@@ -325,57 +325,83 @@ long arch_do_domctl(case XEN_DOMCTL_getmemlist: { -int i; +#define XEN_DOMCTL_getmemlist_max_pfns (GB(1) / PAGE_SIZE) +unsigned int i =0 , idx =0 ;unsigned long max_pfns = domctl->u.getmemlist.max_pfns; +unsigned long index = domctl->u.getmemlist.index;uint64_t mfn;struct page_info *page; +uint64_t *mfns;if (unlikely (d->is_dying) ) { ret = -EINVAL ;break ; } +/* XSA-74: This sub-hypercall is fixed. */ -/* -* XSA-74: This sub-hypercall is broken in several ways: -* - lock order inversion (p2m locks inside page_alloc_lock) -* - no preemption on huge max_pfns input -* - not (re-)checking d->is_dying with page_alloc_lock held -* - not honoring start_pfn input (which libxc also doesn't set) -* Additionally it is rather useless, as the result is stale by the -* time the caller gets to look at it. -* As it only has a single, non-production consumer (xen-mceinj), -* rather than trying to fix it we restrict it for the time being. -*/ -if (/* No nested locks inside copy_to_guest_offset(). */ -paging_mode_external (current->domain) || -/* Arbitrary limit capping processing time. */ - max_pfns >GB (4 ) /PAGE_SIZE ) + ret = -E2BIG ; +if ( max_pfns > XEN_DOMCTL_getmemlist_max_pfns ) + max_pfns = XEN_DOMCTL_getmemlist_max_pfns; + +/* Report the max number we are OK with. */ +if ( !max_pfns &&guest_handle_is_null (domctl->u.getmemlist.buffer) ) { - ret = -EOPNOTSUPP ; + domctl->u.getmemlist.max_pfns = XEN_DOMCTL_getmemlist_max_pfns; + copyback =1 ;break ; } -spin_lock (&d->page_alloc_lock); + ret = -EINVAL ; +if ( !guest_handle_okay (domctl->u.getmemlist.buffer, max_pfns) ) +break ; + + mfns =xmalloc_array (uint64_t, max_pfns); +if ( !mfns ) + { + ret = -ENOMEM ; +break ; + } - ret = i =0 ; + ret = -EINVAL ; +spin_lock (&d->page_alloc_lock);page_list_for_each (page, &d->page_list) { -if ( i >= max_pfns ) +if ( idx >= max_pfns )break ; + +if ( index > i++ ) +continue ; + +if ( idx && !(idx &0xFF ) &&hypercall_preempt_check () ) +break ; + mfn =page_to_mfn (page); -if (copy_to_guest_offset (domctl->u.getmemlist.buffer, - i, &mfn,1 ) ) + mfns[idx++] = mfn; + } +spin_unlock (&d->page_alloc_lock); + + ret =0 ; +for ( i =0 ; i < idx; i++ ) + { + +if (__copy_to_guest_offset (domctl->u.getmemlist.buffer, + i, &mfns[i],1 ) ) { ret = -EFAULT ;break ; } - ++i; } -spin_unlock (&d->page_alloc_lock); - domctl->u.getmemlist.num_pfns = i; +/* +* A poor-man way of keeping track of P2M changes. If the P2M +* is changed the version will change as well and the caller +* can redo it's list. +*/ + domctl->u.getmemlist.version =p2m_get_hostp2m (d)->version; + copyback =1 ; +xfree (mfns); }break ;
xen/arch/x86/mm/hap/hap.c +1 -0
@@ -709,6 +709,7 @@ hap_write_p2m_entry(struct vcpu *v, unsigned long gfn, l1_pgentry_t *p,if ( old_flags & _PAGE_PRESENT )flush_tlb_mask (d->domain_dirty_cpumask); +p2m_get_hostp2m (d)->version++;paging_unlock (d);if ( flush_nestedp2m )
xen/arch/x86/mm/p2m-ept.c +2 -0
@@ -674,6 +674,8 @@ void ept_sync_domain(struct p2m_domain *p2m) {struct domain *d = p2m->domain;struct ept_data *ept = &p2m->ept; + + p2m->version++;/* Only if using EPT and this domain has some VCPUs to dirty. */ if ( !paging_mode_hap (d) || !d->vcpu || !d->vcpu[0 ] )return ;
xen/include/asm-x86/p2m.h +2 -0
@@ -293,6 +293,8 @@ struct p2m_domain {struct ept_data ept;/* NPT-equivalent structure could be added here. */ }; +/* OVM: Every update to P2M increases this version. */ +unsigned long version; };/* get host p2m table */
xen/include/public/domctl.h +28 -8
@@ -118,16 +118,36 @@ typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;DEFINE_XEN_GUEST_HANDLE (xen_domctl_getdomaininfo_t); -/* XEN_DOMCTL_getmemlist */ +/* +* XEN_DOMCTL_getmemlist +* Retrieve an array of mfns of the guest. +* +* If the hypercall returns an zero value, then it has copied 'num_pfns' +* (up to `max_pfns`) of the MFNs in 'buffer', along with the +* `version` updated (it may be the same across hypercalls. If it +* varies the data is stale and it is recommended that the caller restart +* iwht 'index' being zero). +* +* If the 'max_pfns' is zero, and 'buffer' is NULL, the hypercall returns +* -E2BIG and updates the 'max_pfns' with the recommend value to be used. +* +* Note that due to the asynchronous nature of hypercalls the domain might have +* added or removed the number of MFNS making this information stale. It is +* the responsibility of the toolstack to use the `version` field to check +* between each invocation. if the version differs it should discard the stale +* data and start from scratch. It is OK for the toolstack to use the new +* `version` field. +*/ struct xen_domctl_getmemlist { -/* IN variables. */ -/* Max entries to write to output buffer. */ +/* IN/OUT: Max entries to write to output buffer. If max_pfns is zero and +* buffer is NULL, this has the recommend max size of buffer. */ uint64_aligned_t max_pfns; -/* Start index in guest's page list. */ -uint64_aligned_t start_pfn; -XEN_GUEST_HANDLE_64 (uint64) buffer; -/* OUT variables. */ -uint64_aligned_t num_pfns; +uint64_aligned_t index;/* IN: Start index in guest's page list. */ +XEN_GUEST_HANDLE_64 (uint64) buffer;/* IN: If NULL with max_pfns == 0, then +* max_pfns has recommend value. */ +uint64_aligned_t version;/* IN/OUT: If value differs, prior calls may +* have stale data. */ +uint64_aligned_t num_pfns;/* OUT: Number (up to max_pfns) copied. */ };typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t ;DEFINE_XEN_GUEST_HANDLE (xen_domctl_getmemlist_t);
Signature · 1 line
2.9.4
Quoted 1 line
From
d2edab820ee1bf4c354836e33c427602963986baMon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Fri, 9 Jun 2017 12:00:24 -0400
Subject: [PATCH 2/7] libxc: libxc: Use XENDOMCTL_get_memlist properly
With the hypervisor having this working well we take advantage of that. The process has changed as we need to figure out what the upper limit of PFNs the hypervisor is willing to provide.
Fortunatly for us, if we provide max_pfns with a zero value and buffer to be NULL, we get in max_pfns the acceptable max number.
With this information we can make the hypercall - however the amount we get may be smaller than max, hence we adjust the number and also let the caller know. Furtheremore the 'version' is provided as a way for the caller to restart from scratch if that version is different from its previous call.
Also we modify the tools to compile, but not neccessarily work well (see "xen-mceinj: Loop around xc_get_pfn_list".
--- tools/libxc/xc_private.c | 50 +++++++++++++++++++++++++-------- tools/libxc/xenctrl.h | 2 +- tools/ocaml/libs/xc/xenctrl_stubs.c | 3 +- tools/tests/mce-test/tools/xen-mceinj.c | 3 +- 4 files changed, 43 insertions(+), 15 deletions(-)
tools/libxc/xc_private.c +38 -12
71 lines not on this page · raw message
tools/libxc/xenctrl.h +1 -1
@@ -1443,7 +1443,7 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,* without a backing MFN. */ int xc_get_pfn_list (xc_interface *xch,uint32_t domid,uint64_t *pfn_buf, -unsigned long max_pfns); +unsigned long start_pfn,unsigned long max_pfns,unsigned long *version);int xc_copy_to_domain_page (xc_interface *xch,uint32_t domid,unsigned long dst_pfn,const char *src_page);
tools/ocaml/libs/xc/xenctrl_stubs.c +2 -1
@@ -1055,6 +1055,7 @@ CAMLprim value stub_xc_domain_get_pfn_list(value xch, value domid,CAMLparam3 (xch, domid, nr_pfns);CAMLlocal2 (array, v);unsigned long c_nr_pfns; +unsigned long version;long ret, i;uint64_t *c_array;
@@ -1065,7 +1066,7 @@ CAMLprim value stub_xc_domain_get_pfn_list(value xch, value domid,caml_raise_out_of_memory (); ret =xc_get_pfn_list (_H (xch),_D (domid), - c_array, c_nr_pfns); + c_array,0 , c_nr_pfns, &version);if (ret <0 ) {free (c_array);failwith_xc (_H (xch));
tools/tests/mce-test/tools/xen-mceinj.c +2 -1
@@ -263,6 +263,7 @@ static uint64_t guest_mfn(xc_interface *xc_handle,unsigned long max_mfn =0 ;/* max mfn of the whole machine */ unsigned long m2p_mfn0;unsigned int guest_width; +unsigned long version;long max_gpfn,i;uint64_t mfn =MCE_INVALID_MFN ;
@@ -289,7 +290,7 @@ static uint64_t guest_mfn(xc_interface *xc_handle,err (xc_handle,"Failed to alloc pfn buf\n" );memset (pfn_buf,0 ,sizeof (uint64_t ) * max_gpfn); - ret =xc_get_pfn_list (xc_handle, domain, pfn_buf, max_gpfn); + ret =xc_get_pfn_list (xc_handle, domain, pfn_buf,0 , max_gpfn, &version);if ( ret <0 ) {free (pfn_buf);err (xc_handle,"Failed to get pfn list %x\n" , ret);
Signature · 1 line
2.9.4
Quoted 1 line
From
483e55bc13c6ab246251fcd62c59adc7bf169c52Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 13 Jun 2017 10:56:52 -0400
Subject: [PATCH 3/7] xen-mceinj: Loop around xc_get_pfn_list
Now that the xc_get_pfn_list can return max != num_pfns we need to take that into account and loop around.
While at it fix the code:
- Move the memset in the loop.
- Change the loop conditions to exit if the mfn has been found.
- Explain why 262144 is used.
- Add munmap if we failed to allocate the buffer.
--- tools/tests/mce-test/tools/xen-mceinj.c | 67 ++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 22 deletions(-)
tools/tests/mce-test/tools/xen-mceinj.c +45 -22
92 lines not on this page · raw message
Signature · 1 line
2.9.4
Quoted 1 line
From
c6bf254298d68638ca8652825a28fa97cee51ff4Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 6 Jun 2017 13:04:22 -0400
Subject: [PATCH 4/7] x86:domctl: Add XEN_DOMCTL_get_numa_ranges
This is a fairly simple hypercall - it allows us to return the list (and ranges) of NUMA nodes. Like:
NODE0 0 -> 100000
NODE1 100000 -> 230000
This is different from XEN_SYSCTL_numainfo which returns size of the NODEs and its distance - but not the ranges.
Alternatively this functionality can be stuffed in XEN_SYSCTL_numainfo.
Also this hypercall - if nodes is set to zero, then it will return the number of nodes so that the caller can allocate right away the right buffer for it.
--- tools/flask/policy/policy/modules/xen/xen.te | 1 + xen/arch/x86/domctl.c | 50 ++++++++++++++++++++++++++++ xen/include/public/domctl.h | 17 ++++++++++ xen/xsm/flask/hooks.c | 3 ++ xen/xsm/flask/policy/access_vectors | 2 ++ 5 files changed, 73 insertions(+)
tools/flask/policy/policy/modules/xen/xen.te +1 -0
@@ -68,6 +68,7 @@ allow dom0_t xen_t:xen { allow dom0_t xen_t:xen2 { livepatch_op module_op + get_numa_ranges }; # Allow dom0 to use all XENVER_ subops that have checks.
xen/arch/x86/domctl.c +50 -0
56 lines not on this page · raw message
xen/include/public/domctl.h +17 -0
@@ -955,6 +955,21 @@ struct xen_domctl_smt {typedef struct xen_domctl_smt xen_domctl_smt ;DEFINE_XEN_GUEST_HANDLE (xen_domctl_smt); +/* +* Returns how many more there are. If ranges is NULL +* and nodes is zero, then we provide the number of +* nodes in 'nodes'. +* +* Negative values on errors. Zero on success. +*/ +struct xen_domctl_numa { +uint32_t nodes;/* IN: How many nodes are requested. +* OUT: How many copied (zero based index). */ +XEN_GUEST_HANDLE_64 (xen_vmemrange_t) ranges; +}; +typedef struct xen_domctl_numa xen_domctl_numa_t ; +DEFINE_XEN_GUEST_HANDLE (xen_domctl_numa_t); +struct xen_domctl {uint32_t cmd;#define XEN_DOMCTL_createdomain 1
@@ -1035,6 +1050,7 @@ struct xen_domctl {#define XEN_DOMCTL_hide_device 2001#define XEN_DOMCTL_unhide_device 2002#define XEN_DOMCTL_setsmt 2003 +#define XEN_DOMCTL_get_numa_ranges 2004uint32_t interface_version;/* XEN_DOMCTL_INTERFACE_VERSION */ domid_t domain;union {
@@ -1094,6 +1110,7 @@ struct xen_domctl {struct xen_domctl_gdbsx_domstatus gdbsx_domstatus;struct xen_domctl_vnuma vnuma;struct xen_domctl_smt smt; +struct xen_domctl_numa get_numa_ranges;uint8_t pad[128 ]; } u; };
xen/xsm/flask/hooks.c +3 -0
@@ -740,6 +740,9 @@ static int flask_domctl(struct domain *d, int cmd)case XEN_DOMCTL_setsmt:return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__SETSMT ); +case XEN_DOMCTL_get_numa_ranges: +return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__GET_NUMA_RANGES ); +default :printk ("flask_domctl: Unknown op %d\n" , cmd);return -EPERM ;
xen/xsm/flask/policy/access_vectors +2 -0
@@ -214,6 +214,8 @@ class domain2 soft_reset # XEN_DOMCTL_setsmt setsmt +# XEN_DOMCTL_get_numa_ranges + get_numa_ranges } # Similar to class domain, but primarily contains domctls related to HVM domains
Signature · 1 line
2.9.4
Quoted 1 line
From
5b9c5881773f209d06235fba421704f0a0e44712Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Fri, 9 Jun 2017 12:21:52 -0400
Subject: [PATCH 5/7] libxc: Add xc_list_numa
Implement the libxc call to retrieve NUMA ranges.
--- tools/libxc/xc_misc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 1 + 2 files changed, 63 insertions(+)
tools/libxc/xc_misc.c +62 -0
68 lines not on this page · raw message
tools/libxc/xenctrl.h +1 -0
@@ -2569,4 +2569,5 @@ int xc_livepatch_revert(xc_interface *xch, char *name, uint32_t timeout);int xc_livepatch_unload (xc_interface *xch,char *name,uint32_t timeout);int xc_livepatch_replace (xc_interface *xch,char *name,uint32_t timeout); +int xc_list_numa (xc_interface *xch,struct xen_vmemrange ** _info);#endif /* XENCTRL_H */
Signature · 1 line
2.9.4
Quoted 1 line
From
033baca36963923c467adcb3d0473ea1f1e9b440Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Fri, 9 Jun 2017 12:22:24 -0400
Subject: [PATCH 6/7] xen-numa: Diagnostic tool to figure out NUMA issues.
The tool can provide multiple views of a guest.
- 'mfns' will dump all of the MFNs of a guest, useful
for sorting and such and double-checking.
- 'pfns' is an upgraded version of the above. It includes
such details as what the PFN is within the guest. The list is not sorted. The PFNs are decimal, while the MFNs are hex to easy sorting.
- 'node' digs in the PFNs and MFNs and figures out where
they are - which PFNs belong to what NODE. This should match the guest view, otherwise we have issues.
For example on Dom0 on SuperMicro H8DG6:
sh-4.1# xen-numa node 0
-bash-4.1# /xen-numa node 0
NODE0 0 -> 0x1a8000 (6784 MB)
NODE1 0x1a8000 -> 0x2a8000 (4096 MB) 0.0%..10.0%..20.0%..30.0%..40.0%..50.0%..60.0%..70.0%..80.0%..90.0%.. Max gpfn is 0x40069 (1024 MB)
- NODE0 PFNs (33.173813%):
0x8352->0x8553 (514)
0x28554->0x2b995 (13378)
0x2b997->0x2d10c (6006)
0x2d10d->0x2d5a1 (1173)
0x2d5a3->0x38553 (44977)
0x3dc00->0x3e553 (2388)
0x3f554->0x3fd53 (2048)
0x3ff54->0x3ffd3 (128)
0x3fff4->0x3fffb (8)
0x39c00->0x3dbff (16384)
0x620a->0x620c (3)
0x61fe->0x6200 (3)0x6215, 0x621b, 0x6221, 0x6249, 0x6231, 0x63a7, 0x635f,
- NODE1 PFNs (66.771660%):
0x0->0x97 (152)
0x40000->0x40068 (105)
0x100->0x61fd (24830)
0x6201->0x6209 (9)
0x620d->0x6214 (8)
0x6216->0x621a (5)
0x621c->0x6220 (5)
0x6222->0x6230 (15)
0x6232->0x6248 (23)
0x624a->0x635e (277)
0x6360->0x63a6 (71)
0x63a8->0x8351 (8106)0x8353, 0x8554->0x28553 (131072)
0x38554->0x39bff (5804)
0x3e554->0x3f553 (4096)
0x3fd54->0x3ff53 (512)
0x3ffd4->0x3fff3 (32)
0x3fffc->0x3ffff (4)
--- tools/misc/Makefile | 5 + tools/misc/xen-numa.c | 556 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 561 insertions(+) create mode 100644 tools/misc/xen-numa.c
tools/misc/Makefile +5 -0
@@ -17,6 +17,7 @@ TARGETS-y += xen-insmod TARGETS-y += xen-rmmod TARGETS-y += xen-lsmod TARGETS-y += xen-attribute +TARGETS-y += xen-numa TARGETS := $(TARGETS-y) SUBDIRS := $(SUBDIRS-y)
@@ -34,6 +35,7 @@ INSTALL_SBIN-y += xen-insmod INSTALL_SBIN-y += xen-rmmod INSTALL_SBIN-y += xen-lsmod INSTALL_SBIN-y += xen-attribute +INSTALL_SBIN-y += xen-numa INSTALL_SBIN := $(INSTALL_SBIN-y) INSTALL_PRIVBIN-y := xenpvnetboot
@@ -100,6 +102,9 @@ xen-lsmod xen-rmmod xen-insmod: xen-%: xen-%.o xen-attribute: xen-%: xen-%.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-numa: xen-numa.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS) + xen-lowmemd: xen-lowmemd.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
tools/misc/xen-numa.c new file +556 -0
556 lines not on this page · raw message
Signature · 1 line
2.9.4
Quoted 1 line
From
901fe4364deb69a6a803f540f03c1d8cf418dbc0Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Fri, 9 Jun 2017 13:44:22 -0400
Subject: [PATCH 7/7] xen-numa: Add a heatmap.
- 'heatmap' outputs an PGM file of where the MFNs of a guest
reside. Use ImageMagick to convert this file to PNG:
Also there is an third optional parameter to change the width of the file. And a fourth optional to inverse the colors. That can help as ImageMagick looks to be ignoring the PGM spec and printing 0 as white instead of as black.
The heatmap illustrates a picture of 0..max_gpfns and the colors are the N NODEs. For two nodes we should see three colors - NODE0, NODE1, and holes.
For example to use it:
-bash-4.1# /xen-numa heatmap 1 1600 1 > /isos/heatmap-32gb-xl-vnuma.pgm
See
http://char.us.oracle.com/isos/heatmap-32gb-xl-vnuma.png
http://char.us.oracle.com/isos/heatmap-32gb-xm-vnuma.png
--- tools/misc/xen-numa.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+)
tools/misc/xen-numa.c +124 -0
130 lines not on this page · raw message
Signature · 1 line
2.9.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 2 lines · Konrad Rzeszutek Wilk
Soo I wrote some code for exactly this for Xen 4.4.4 , along with creation of a PGM map to see the NUMA nodes locality.
Are you planning to prepare that for staging at some point? I have not checked this series is already merged.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Olaf Hering
Quoted 2 lines · Konrad Rzeszutek Wilk
Soo I wrote some code for exactly this for Xen 4.4.4 , along with creation of a PGM map to see the NUMA nodes locality.
Are you planning to prepare that for staging at some point? I have not checked this series is already merged.
At some point when life is not as crazy. You are of course welcome to see if these patches help you and if they do and you are itching to get them in the repo - to upstream them.
Quoted 2 lines
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel