Skip to contentSkip to conversation

Support for hwloc

RFC PATCH In review Andrew Cooper 4 participants 13 messages Feb 27, 2014 – Mar 14, 2014

lore
Share & tools
lore
#0 lore raw

cover Support for hwloc

These two patches have been developed in combination with a Xen pluging for hwloc, to allow a toolstack domain to gather the system topology rather than the virtual topology.

An experimental hwloc branch can be found here:

git://xenbits.xen.org/people/andrewcoop/hwloc.git hwloc-xen-topology-v5
http://xenbits.xen.org/gitweb/?p=people/andrewcoop/hwloc.git;a=shortlog;h=refs/heads/hwloc-xen-topology-v5

and depends on these two patches to function.

Patch 1 is extending xc_{topology,numa}info() functions to include a version which performs correct hypercall bounce buffering.

Patch 2 introduced SYSCTL_xen_cpuid which allows a toolstack to perform arbitrary cpuid instructions on specific physical cpus. hwloc uses this to enumerate the cpuid cache leaves without resorting to tactics of pinning vcpus to specific pcpus and running native cpuid.

Comments welcome,

~Andrew

#1 lore raw

RFC PATCH 1/2 tools/libxc: Improved xc_{topology, numa}info functions.

These two new functions provide a substantially easier-to-use API, where libxc itself takes care of all the appropriate bounce buffering.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
---
 tools/libxc/xc_misc.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xenctrl.h |   49 ++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+)
tools/libxc/xc_misc.c +85 -0
index 3303454..4f672ce 100644
@@ -195,6 +195,46 @@ int xc_topologyinfo(xc_interface *xch,
     return 0;
 }
 
+int xc_topologyinfo_bounced(xc_interface *xch,
+                            uint32_t *max_cpu_index,
+                            uint32_t *cpu_to_core,
+                            uint32_t *cpu_to_socket,
+                            uint32_t *cpu_to_node)
+{
+    int ret = -1;
+    size_t sz = sizeof(uint32_t) * (*max_cpu_index + 1);
+
+    DECLARE_HYPERCALL_BOUNCE(cpu_to_core, sz, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_HYPERCALL_BOUNCE(cpu_to_socket, sz, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_HYPERCALL_BOUNCE(cpu_to_node, sz, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_SYSCTL;
+
+    if ( xc_hypercall_bounce_pre(xch, cpu_to_core) ||
+         xc_hypercall_bounce_pre(xch, cpu_to_socket) ||
+         xc_hypercall_bounce_pre(xch, cpu_to_node) )
+        goto out;
+
+    sysctl.cmd = XEN_SYSCTL_topologyinfo;
+    sysctl.u.topologyinfo.max_cpu_index = *max_cpu_index;
+
+    set_xen_guest_handle(sysctl.u.topologyinfo.cpu_to_core, cpu_to_core);
+    set_xen_guest_handle(sysctl.u.topologyinfo.cpu_to_socket, cpu_to_socket);
+    set_xen_guest_handle(sysctl.u.topologyinfo.cpu_to_node, cpu_to_node);
+
+    ret = do_sysctl(xch, &sysctl);
+
+    if ( ret )
+        goto out;
+
+    *max_cpu_index = sysctl.u.topologyinfo.max_cpu_index;
+
+out:
+    xc_hypercall_bounce_post(xch, cpu_to_node);
+    xc_hypercall_bounce_post(xch, cpu_to_socket);
+    xc_hypercall_bounce_post(xch, cpu_to_core);
+    return ret;
+}
+
 int xc_numainfo(xc_interface *xch,
                 xc_numainfo_t *put_info)
 {
@@ -213,6 +253,51 @@ int xc_numainfo(xc_interface *xch,
     return 0;
 }
 
+int xc_numainfo_bounced(xc_interface *xch,
+                        uint32_t *max_node_index,
+                        uint64_t *node_to_memsize,
+                        uint64_t *node_to_memfree,
+                        uint32_t *node_to_node_distance)
+{
+    int ret = -1;
+    size_t mem_sz = sizeof(uint64_t) * (*max_node_index + 1);
+    size_t distance_sz = (sizeof(uint32_t) * (*max_node_index + 1) *
+                          (*max_node_index + 1));
+
+    DECLARE_HYPERCALL_BOUNCE(node_to_memsize, mem_sz,
+                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_HYPERCALL_BOUNCE(node_to_memfree, mem_sz,
+                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_HYPERCALL_BOUNCE(node_to_node_distance, distance_sz,
+                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    DECLARE_SYSCTL;
+
+    if ( xc_hypercall_bounce_pre(xch, node_to_memsize) ||
+         xc_hypercall_bounce_pre(xch, node_to_memfree) ||
+         xc_hypercall_bounce_pre(xch, node_to_node_distance) )
+        goto out;
+
+    sysctl.cmd = XEN_SYSCTL_numainfo;
+    sysctl.u.numainfo.max_node_index = *max_node_index;
+
+    set_xen_guest_handle(sysctl.u.numainfo.node_to_memsize, node_to_memsize);
+    set_xen_guest_handle(sysctl.u.numainfo.node_to_memfree, node_to_memfree);
+    set_xen_guest_handle(sysctl.u.numainfo.node_to_node_distance,
+                         node_to_node_distance);
+
+    ret = do_sysctl(xch, &sysctl);
+
+    if ( ret )
+        goto out;
+
+    *max_node_index = sysctl.u.numainfo.max_node_index;
+
+out:
+    xc_hypercall_bounce_post(xch, node_to_node_distance);
+    xc_hypercall_bounce_post(xch, node_to_memfree);
+    xc_hypercall_bounce_post(xch, node_to_memsize);
+    return ret;
+}
 
 int xc_sched_id(xc_interface *xch,
                 int *sched_id)
tools/libxc/xenctrl.h +49 -0

58 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH RFC 1/2] tools/libxc: Improved xc_{topology, numa}info functions.

Quoted 3 lines · Andrew Cooper

These two new functions provide a substantially easier-to-use API, where libxc itself takes care of all the appropriate bounce buffering.

So, because of the stalled discussion on patch 2 of this series, this patch was hardly considered, I guess, is that so?

Personally, I think this is an improvement in its own right, and I'd like to have it, independently from the CPUID stuff. Are you up, perhaps, for submitting it as a separate patch?

One thing I'm not sure is why you're introducing new *_bounced variants, rather than going ahead and modifying xc_topologyinfo() and xc_numainfo() directly. libxc is not an API we committed to keep stable, is it?

Thanks and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH RFC 1/2] tools/libxc: Improved xc_{topology, numa}info functions.

Quoted 2 lines · Dario Faggioli
Quoted 1 line · Andrew Cooper

These two new functions provide a substantially easier-to-use API,

where libxc

Quoted 9 lines
Quoted 2 lines

itself takes care of all the appropriate bounce buffering.

So, because of the stalled discussion on patch 2 of this series, this patch was hardly considered, I guess, is that so?

Personally, I think this is an improvement in its own right, and I'd like to have it, independently from the CPUID stuff. Are you up, perhaps, for submitting it as a separate patch?

Quoted 8 lines

One thing I'm not sure is why you're introducing new *_bounced variants, rather than going ahead and modifying xc_topologyinfo() and xc_numainfo() directly. libxc is not an API we committed to keep stable, is it?

Thanks and Regards,
Dario

I certainly can modify the original ones directly. When developing, it in the 4.4 freeze, and I wanted my changes to easily co-exist with libxc. (If you notice, these patches are in XenServer trunk for easy deployment against our entire set of weird & wacky hardware).

If there general agreement that making the old xc_{topology,numa}info() functions have the prototype and behaviour of my _bounced variants, then I will happy do that, and send some fixup to make libxl work against it.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Re: [PATCH RFC 1/2] tools/libxc: Improved xc_{topology, numa}info functions.

Quoted 6 lines · Andrew Cooper

On 12/03/14 08:34, Dario Faggioli wrote:
I certainly can modify the original ones directly. When developing, it in the 4.4 freeze, and I wanted my changes to easily co-exist with libxc. (If you notice, these patches are in XenServer trunk for easy deployment against our entire set of weird & wacky hardware).

Sure, I know. That's why I sent this 'kind-of-ping' :-)

Quoted 5 lines

If there general agreement that making the old xc_{topology,numa}info() functions have the prototype and behaviour of my _bounced variants, then I will happy do that, and send some fixup to make libxl work against it.

Of course. Let's hear maintainers. FWIW, I vote for it. As you already say in the cover letter of the series, the current implementation in both libxc and libxl is a pain to use and maintain, and set a very ba example for people wanting to do similar things.

In fact, it was me that, as one of my first contributions to Xen, (re)implemented libxl_get_numainfo(), out of inspiration from libxl_get_cpu_topology()! :-/

So, to summarize my view, let's switch the existing to yours ASAP. Ian-s? :-)

Thanks and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH RFC 1/2] tools/libxc: Improved xc_{topology, numa}info functions.

In reply to Andrew Cooper
Quoted 3 lines · Andrew Cooper

If there general agreement that making the old xc_{topology,numa}info() functions have the prototype and behaviour of my _bounced variants, then I will happy do that,

I think that is the correct thing to do, thanks.

In general hiding the bouncing inside libxc is nicer for everyone I think, unless they are called incredibly frequently (like the inner loop of a migrate), I don't think these fit that profile

The only question is whether the function params should explode xc_topology_info or whether that struct should be redefined without guest handles for the callers to use (bouncing into the matching fields in xen_sysctl_topologyinfo_t). That's up to you, I assume it will become obvious which to pick when you look at the callers.

Quoted 1 line

and send some fixup to make libxl work against it.

and Python's xc bindings too I'm afraid.

Ian.

#6 lore raw

RFC PATCH 2/2 SYSCTL subop to execute cpuid on a specified pcpu

In reply to Andrew Cooper
---
 tools/libxc/xc_misc.c       |   25 +++++++++++++++++++++++++
 tools/libxc/xenctrl.h       |    7 +++++++
 xen/arch/x86/sysctl.c       |   30 ++++++++++++++++++++++++++++++
 xen/include/public/sysctl.h |    9 +++++++++
 4 files changed, 71 insertions(+)
tools/libxc/xc_misc.c +25 -0
index 4f672ce..48ef33e 100644
@@ -774,6 +774,31 @@ int xc_hvm_inject_trap(
     return rc;
 }
 
+int xc_xen_cpuid(xc_interface *xch, uint32_t cpu, uint32_t *eax,
+                 uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+{
+    int ret;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_cpuid;
+    sysctl.u.cpuid.cpu = cpu;
+    sysctl.u.cpuid.eax = *eax;
+    sysctl.u.cpuid.ebx = *ebx;
+    sysctl.u.cpuid.ecx = *ecx;
+    sysctl.u.cpuid.edx = *edx;
+
+    ret = do_sysctl(xch, &sysctl);
+    if ( ret )
+        return ret;
+
+    *eax = sysctl.u.cpuid.eax;
+    *ebx = sysctl.u.cpuid.ebx;
+    *ecx = sysctl.u.cpuid.ecx;
+    *edx = sysctl.u.cpuid.edx;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
tools/libxc/xenctrl.h +7 -0
index 50126ae..a714156 100644
@@ -1801,6 +1801,13 @@ int xc_hvm_inject_trap(
     uint64_t cr2);
 
 /*
+ * Run the cpuid instruction on a specificied physical cpu with the given
+ * parameters.
+ */
+int xc_xen_cpuid(xc_interface *xch, uint32_t cpu, uint32_t *eax,
+                 uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
+
+/*
  *  LOGGING AND ERROR REPORTING
  */
 
xen/arch/x86/sysctl.c +30 -0
index 15d4b91..dbad1ee 100644
@@ -66,6 +66,18 @@ void arch_do_physinfo(xen_sysctl_physinfo_t *pi)
         pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio;
 }
 
+void sysctl_cpuid_helper(void *data)
+{
+    struct xen_sysctl_cpuid *cpuid = data;
+
+    ASSERT(smp_processor_id() == cpuid->cpu);
+    asm volatile ("cpuid"
+                  : "=a" (cpuid->eax), "=b" (cpuid->ebx),
+                    "=c" (cpuid->ecx), "=d" (cpuid->edx)
+                  : "a" (cpuid->eax), "b" (cpuid->ebx),
+                    "c" (cpuid->ecx), "d" (cpuid->edx) );
+}
+
 long arch_do_sysctl(
     struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
 {
@@ -101,6 +113,24 @@ long arch_do_sysctl(
     }
     break;
 
+    case XEN_SYSCTL_cpuid:
+    {
+        int cpu = sysctl->u.cpuid.cpu;
+
+        if ( cpu == smp_processor_id() )
+            sysctl_cpuid_helper(&sysctl->u.cpuid);
+        else if ( cpu >= nr_cpu_ids || !cpu_online(cpu) )
+            ret = -EINVAL;
+        else
+            on_selected_cpus(cpumask_of(cpu),
+                             sysctl_cpuid_helper,
+                             &sysctl->u.cpuid, 1);
+
+        if ( !ret && __copy_to_guest(u_sysctl, sysctl, 1) )
+            ret = -EFAULT;
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
xen/include/public/sysctl.h +9 -0
index 8437d31..afa8a73 100644
@@ -633,6 +633,13 @@ typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
 
 
+struct xen_sysctl_cpuid {
+    uint32_t cpu; /* IN - Pcpu to execute on */
+    uint32_t eax, ebx, ecx, edx; /* IN/OUT - Parameters to `cpuid` */
+};
+typedef struct xen_sysctl_cpuid xen_sysctl_cpuid_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuid_t);
+
 struct xen_sysctl {
     uint32_t cmd;
 #define XEN_SYSCTL_readconsole                    1
@@ -654,6 +661,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_cpuid                         21
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
         struct xen_sysctl_readconsole       readconsole;
@@ -675,6 +683,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_cpuid             cpuid;
         uint8_t                             pad[128];
     } u;
 };
Signature · 1 line
1.7.10.4
#7 lore raw

RFC PATCH 2/2 xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

In reply to Andrew Cooper

which permits a toolstack to execute an arbitrary cpuid instruction on a specified physical cpu.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
---
 tools/libxc/xc_misc.c       |   25 +++++++++++++++++++++++++
 tools/libxc/xenctrl.h       |    7 +++++++
 xen/arch/x86/sysctl.c       |   30 ++++++++++++++++++++++++++++++
 xen/include/public/sysctl.h |    9 +++++++++
 4 files changed, 71 insertions(+)
tools/libxc/xc_misc.c +25 -0
index 4f672ce..48ef33e 100644
@@ -774,6 +774,31 @@ int xc_hvm_inject_trap(
     return rc;
 }
 
+int xc_xen_cpuid(xc_interface *xch, uint32_t cpu, uint32_t *eax,
+                 uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+{
+    int ret;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_cpuid;
+    sysctl.u.cpuid.cpu = cpu;
+    sysctl.u.cpuid.eax = *eax;
+    sysctl.u.cpuid.ebx = *ebx;
+    sysctl.u.cpuid.ecx = *ecx;
+    sysctl.u.cpuid.edx = *edx;
+
+    ret = do_sysctl(xch, &sysctl);
+    if ( ret )
+        return ret;
+
+    *eax = sysctl.u.cpuid.eax;
+    *ebx = sysctl.u.cpuid.ebx;
+    *ecx = sysctl.u.cpuid.ecx;
+    *edx = sysctl.u.cpuid.edx;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
tools/libxc/xenctrl.h +7 -0
index 50126ae..a714156 100644
@@ -1801,6 +1801,13 @@ int xc_hvm_inject_trap(
     uint64_t cr2);
 
 /*
+ * Run the cpuid instruction on a specificied physical cpu with the given
+ * parameters.
+ */
+int xc_xen_cpuid(xc_interface *xch, uint32_t cpu, uint32_t *eax,
+                 uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
+
+/*
  *  LOGGING AND ERROR REPORTING
  */
 
xen/arch/x86/sysctl.c +30 -0
index 15d4b91..dbad1ee 100644
@@ -66,6 +66,18 @@ void arch_do_physinfo(xen_sysctl_physinfo_t *pi)
         pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio;
 }
 
+void sysctl_cpuid_helper(void *data)
+{
+    struct xen_sysctl_cpuid *cpuid = data;
+
+    ASSERT(smp_processor_id() == cpuid->cpu);
+    asm volatile ("cpuid"
+                  : "=a" (cpuid->eax), "=b" (cpuid->ebx),
+                    "=c" (cpuid->ecx), "=d" (cpuid->edx)
+                  : "a" (cpuid->eax), "b" (cpuid->ebx),
+                    "c" (cpuid->ecx), "d" (cpuid->edx) );
+}
+
 long arch_do_sysctl(
     struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
 {
@@ -101,6 +113,24 @@ long arch_do_sysctl(
     }
     break;
 
+    case XEN_SYSCTL_cpuid:
+    {
+        int cpu = sysctl->u.cpuid.cpu;
+
+        if ( cpu == smp_processor_id() )
+            sysctl_cpuid_helper(&sysctl->u.cpuid);
+        else if ( cpu >= nr_cpu_ids || !cpu_online(cpu) )
+            ret = -EINVAL;
+        else
+            on_selected_cpus(cpumask_of(cpu),
+                             sysctl_cpuid_helper,
+                             &sysctl->u.cpuid, 1);
+
+        if ( !ret && __copy_to_guest(u_sysctl, sysctl, 1) )
+            ret = -EFAULT;
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
xen/include/public/sysctl.h +9 -0
index 8437d31..afa8a73 100644
@@ -633,6 +633,13 @@ typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
 
 
+struct xen_sysctl_cpuid {
+    uint32_t cpu; /* IN - Pcpu to execute on */
+    uint32_t eax, ebx, ecx, edx; /* IN/OUT - Parameters to `cpuid` */
+};
+typedef struct xen_sysctl_cpuid xen_sysctl_cpuid_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuid_t);
+
 struct xen_sysctl {
     uint32_t cmd;
 #define XEN_SYSCTL_readconsole                    1
@@ -654,6 +661,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_cpuid                         21
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
         struct xen_sysctl_readconsole       readconsole;
@@ -675,6 +683,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_cpuid             cpuid;
         uint8_t                             pad[128];
     } u;
 };
Signature · 1 line
1.7.10.4
#8 lore raw

Re: [PATCH RFC 2/2] xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

which permits a toolstack to execute an arbitrary cpuid instruction on a specified physical cpu.

For one - is it a good idea to expose the unprocessed CPUID to any guest code? After all even the Dom0 kernel only gets to see processed values, and the fact the without CPUID faulting apps in PV guests can inadvertently use the raw values is known to be a problem, not a feature.

And then - if you already have access to control operations, I don't think you need the hyypervisor to help you: Limit your vCPU's affinity to the particular pCPU you care about, and do what you need doing from the kernel (by also setting the processes affinity to the particular CPU you could achieve the same even from user land).

Jan

#9 lore raw

Re: [PATCH RFC 2/2] xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

Quoted 8 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

which permits a toolstack to execute an arbitrary cpuid instruction on a specified physical cpu.

For one - is it a good idea to expose the unprocessed CPUID to any guest code? After all even the Dom0 kernel only gets to see processed values, and the fact the without CPUID faulting apps in PV guests can inadvertently use the raw values is known to be a problem, not a feature.

Any toolstack which uses this specific hypercall to find out information normally hidden from dom0 using faulting/masking/policy can only shoot itself.

The usecase is for enumerating the real cache leaves, which are normally faked up in the policy anyway, so of no use.

Quoted 10 lines

And then - if you already have access to control operations, I don't think you need the hyypervisor to help you: Limit your vCPU's affinity to the particular pCPU you care about, and do what you need doing from the kernel (by also setting the processes affinity to the particular CPU you could achieve the same even from user land).

Jan

Having a toolstack rely on being able to pin its vcpus around so some userspace can enumerate the cache leaves is horrific.

Apart from forcibly messing with a balanced numa setup, what about cpu pools, or toolstack disaggregation where pinning is restricted?

~Andrew

#10 lore raw

Re: [PATCH RFC 2/2] xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

Apart from forcibly messing with a balanced numa setup, what about cpu pools, or toolstack disaggregation where pinning is restricted?

There no messing with a balanced setup here - everything should of course be transient, i.e. get restored to previous values right after. And I can't see a reason not to permit the hardware domain to temporarily escape its enclave, as it can do worse to the overall system anyway.

The new hypercall is simple enough (yet very x86-centric) that I'm not really against it; what I'm against is adding functionality to the hypervisor that is already available by other means.

Jan

#11 lore raw

Re: [PATCH RFC 2/2] xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

Quoted 6 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

Apart from forcibly messing with a balanced numa setup, what about cpu pools, or toolstack disaggregation where pinning is restricted?

There no messing with a balanced setup here - everything should of course be transient, i.e. get restored to previous values right after.

But anything else happening on that vcpu at the same time is transiently out of balance.

Quoted 3 lines

And I can't see a reason not to permit the hardware domain
to temporarily escape its enclave, as it can do worse to the overall system anyway.

True

Quoted 7 lines

The new hypercall is simple enough (yet very x86-centric) that I'm not really against it; what I'm against is adding functionality to the hypervisor that is already available by other means.

Jan

As I said before, the cache information is faked up by the cpuid policy, so might be subject to policy depending on faulting or non-dom0 hardware domian, or PVH dom0 in the near future.

I think there is a legitimate case for "I really truely need the real hardware values, without anything in the policy getting in the way". 'cpuid' is indeed very x86 specific, but it is not information readily available by other means.

~Andrew

Acked-by on v1 2/2
#12 lore raw

Re: [PATCH RFC 2/2] xen/x86: Introduce XEN_SYSCTL_cpuid hypercall

In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

which permits a toolstack to execute an arbitrary cpuid instruction on a specified physical cpu.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
Quoted 3 lines
---
 tools/libxc/xc_misc.c       |   25 +++++++++++++++++++++++++
 tools/libxc/xenctrl.h       |    7 +++++++

These are a pretty straightforward encapsulation of the hypercall, so subject to agreement with the h/w maintainers about the hypercall interface the toolside is:

Ian.