Skip to contentSkip to conversation

fix smt=0 fallout

PATCH Superseded Juergen Gross 3 participants 15 messages Aug 29, 2018 – Aug 30, 2018 3 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover fix smt=0 fallout

With smt=0 some output of xl is wrong. Fix it.

Juergen Gross (2):
tools/libxl: correct vcpu affinity output with sparse physical cpu map
xen: fill topology info for online cpus only

 tools/xl/xl_vcpu.c  | 4 ++--
 xen/common/sysctl.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/2 tools/libxl: correct vcpu affinity output with sparse physical cpu map

With not all physical cpus online (i.e. with smt=0) the output of hte vcpu affinities is wrong, as the affinity bitmaps are capped after nr_cpus bits, instead of using max_cpu_id.

---
 tools/xl/xl_vcpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/xl/xl_vcpu.c +2 -2
index 3384eeed06..c877f2595f 100644
@@ -144,13 +144,13 @@ static void vcpulist(int argc, char **argv)
         }
 
         for (i = 0; i<nb_domain; i++)
-            print_domain_vcpuinfo(dominfo[i].domid, physinfo.nr_cpus);
+            print_domain_vcpuinfo(dominfo[i].domid, physinfo.max_cpu_id + 1);
 
         libxl_dominfo_list_free(dominfo, nb_domain);
     } else {
         for (; argc > 0; ++argv, --argc) {
             uint32_t domid = find_domain(*argv);
-            print_domain_vcpuinfo(domid, physinfo.nr_cpus);
+            print_domain_vcpuinfo(domid, physinfo.max_cpu_id + 1);
         }
     }
   vcpulist_out:
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

PATCH 2/2 xen: fill topology info for online cpus only

In reply to Juergen Gross

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

while with this patch the output is:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  2:       1        0        0
---
 xen/common/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/sysctl.c +1 -1
index 8e83c33a16..6cef6d310b 100644
@@ -358,7 +358,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
                 num_cpus = ti->num_cpus;
             for ( i = 0; i < num_cpus; ++i )
             {
-                if ( cpu_present(i) )
+                if ( cpu_online(i) )
                 {
                     cputopo.core = cpu_to_core(i);
                     cputopo.socket = cpu_to_socket(i);
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] tools/libxl: correct vcpu affinity output with sparse physical cpu map

In reply to Juergen Gross
Quoted 5 lines · Juergen Gross

With not all physical cpus online (i.e. with smt=0) the output of hte vcpu affinities is wrong, as the affinity bitmaps are capped after nr_cpus bits, instead of using max_cpu_id.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 2/2
#8 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to Juergen Gross
Quoted 16 lines · Juergen Gross

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
Quoted 8 lines

while with this patch the output is:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  2:       1        0        0

I have always wanted to fix this but never got around to it. Thank you!

Quoted 20 lines
---
 xen/common/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/sysctl.c +1 -1
index 8e83c33a16..6cef6d310b 100644
@@ -358,7 +358,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
                 num_cpus = ti->num_cpus;
             for ( i = 0; i < num_cpus; ++i )
             {
-                if ( cpu_present(i) )
+                if ( cpu_online(i) )
                 {
                     cputopo.core = cpu_to_core(i);
                     cputopo.socket = cpu_to_socket(i);
Signature · 1 line
2.16.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

Quoted 10 lines · Wei Liu
Quoted 9 lines · Juergen Gross

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

On a dual core system without this patch xl info -n will print:

BTW I think it would be clearer if you say 2c4t, or in full -- 2 cores 4 threads.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Re: [PATCH 1/2] tools/libxl: correct vcpu affinity output with sparse physical cpu map

In reply to Juergen Gross
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

With not all physical cpus online (i.e. with smt=0) the output of hte

I think you mean "e.g." instead of "i.e." here, as there are other means to have some CPUs offline.

Jan

Quoted 4 lines

vcpu affinities is wrong, as the affinity bitmaps are capped after nr_cpus bits, instead of using max_cpu_id.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

Re: [PATCH 1/2] tools/libxl: correct vcpu affinity output with sparse physical cpu map

In reply to a message not in the archive
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

With not all physical cpus online (i.e. with smt=0) the output of hte

I think you mean "e.g." instead of "i.e." here, as there are other means to have some CPUs offline.

I used it in the meaning of "namely", in order to highlight the recent change to Xen making it more clear why the change is IMO important.

In the end I don't mind this being changed to "e.g." when committing.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to Juergen Gross
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0

which looks fine to me, apart from the missing info on CPU 11.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to a message not in the archive
Quoted 45 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0
Quoted 1 line

which looks fine to me, apart from the missing info on CPU 11.

I can change the patch to print the information for the offline cpus (including the now missing ones), too.

What is the preferred solution?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

Quoted 46 lines · Juergen Gross
Quoted 45 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0
Quoted 5 lines
Quoted 1 line

which looks fine to me, apart from the missing info on CPU 11.

I can change the patch to print the information for the offline cpus (including the now missing ones), too.

That is fine too. I just don't like inconsistent output. :p

P.S. you probably want to add a new field to the existing interface to indicate if a cpu is online.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Re: [PATCH 1/2] tools/libxl: correct vcpu affinity output with sparse physical cpu map

In reply to Juergen Gross
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 10:11, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

With not all physical cpus online (i.e. with smt=0) the output of hte

I think you mean "e.g." instead of "i.e." here, as there are other means to have some CPUs offline.

I used it in the meaning of "namely", in order to highlight the recent change to Xen making it more clear why the change is IMO important.

Iirc it was Ian who told me a while ago that our German based use of "namely" in cases like this isn't really appropriate; I'm not sure I've fully understood where "namely" would be usable or not, so I'm simply trying to avoid it now in most cases, and I'm therefore not sure if it was appropriate to be used here. I'm also not sure whether my assignment of meaning to "i.e." is really correct, but I'd generally view it as an analogue of "that is", rather than the "specifically" you appear to mean here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#17 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to Juergen Gross
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 10:31, <[email protected]> wrote:
Quoted 45 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0
Quoted 6 lines
Quoted 1 line

which looks fine to me, apart from the missing info on CPU 11.

I can change the patch to print the information for the offline cpus (including the now missing ones), too.

What is the preferred solution?

Well, by implication from my earlier reply I think adding the missing CPU's info would be better. Let's see what others think.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to Wei Liu
Quoted 50 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 10:37, <[email protected]> wrote:
Quoted 48 lines · Juergen Gross
Quoted 46 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0

which looks fine to me, apart from the missing info on CPU 11.

Quoted 8 lines
Quoted 3 lines

I can change the patch to print the information for the offline cpus (including the now missing ones), too.

That is fine too. I just don't like inconsistent output. :p

P.S. you probably want to add a new field to the existing interface to indicate if a cpu is online.

And if we extend the interface anyway, also the thread ID (as iirc pointed out as missing recently by George).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw

Re: [PATCH 2/2] xen: fill topology info for online cpus only

In reply to a message not in the archive
Quoted 54 lines · Jan Beulich
Quoted 54 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 10:37, <[email protected]> wrote:
Quoted 51 lines · Juergen Gross
Quoted 45 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 20:23, <[email protected]> wrote:

The topology information obtainable via XEN_SYSCTL_cputopoinfo is filled rather weird: the size of the array is derived from the highest online cpu number, while the data is set to "invalid" for not present cpus only.

With smt=0 the information for parked threads is all zero, so it should be best to return "invalid" information for offline cpus.

Quoted 7 lines

On a dual core system without this patch xl info -n will print:

cpu_topology :
cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0

But there's nothing wrong here. The interesting part is what would be printed for CPU 3 (perhaps on a more than two cores system). After all topology is valid irrespective of whether a CPU is online - it all depends on whether the hypervisor still has the information available. It is for a reason that cpu_smpboot_free() invalidates certain fields only upon CPU removal:

    if ( remove )
    {
        c[cpu].phys_proc_id = XEN_INVALID_SOCKET_ID;
        c[cpu].cpu_core_id = XEN_INVALID_CORE_ID;
        c[cpu].compute_unit_id = INVALID_CUID;

On a 6-core system I see

cpu: core socket node

  0:       0        0        0
  1:       0        0        0
  2:       1        0        0
  3:       1        0        0
  4:       2        0        0
  5:       2        0        0
  6:       8        0        0
  7:       8        0        0
  8:       9        0        0
  9:       9        0        0
 10:      10        0        0
Quoted 1 line

which looks fine to me, apart from the missing info on CPU 11.

I can change the patch to print the information for the offline cpus (including the now missing ones), too.

Quoted 7 lines
Quoted 4 lines

That is fine too. I just don't like inconsistent output. :p

P.S. you probably want to add a new field to the existing interface to indicate if a cpu is online.

And if we extend the interface anyway, also the thread ID (as iirc pointed out as missing recently by George).

Ha, yes!

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel