Skip to contentSkip to conversation

x86/dom0: Add log for dom0_nodes and dom0_max_vcpus_max conflict

PATCH In review Jane Malalane 2 participants 4 messages Feb 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/dom0: Add log for dom0_nodes and dom0_max_vcpus_max conflict

This is not a bug. The xen cmdline can request both a NUMA restriction and a vcpu count restriction for Dom0. The node restriction wil always be respected which might mean either using dom0_max_vcpus < opt_dom0_max_vcpus_max or using more vCPUs than pCPUs on a node. In the case where dom0_max_vcpus gets capped at the maximum number of pCPUs for the number of nodes chosen, it can be useful particularly for debugging to print a message in the serial log.

---
CC: Jan Beulich <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: "Roger Pau Monné" <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/dom0_build.c | 5 +++++
 1 file changed, 5 insertions(+)
xen/arch/x86/dom0_build.c +5 -0
index fe24e11b37..e57cc80ef0 100644
@@ -240,6 +240,11 @@ unsigned int __init dom0_max_vcpus(void)
     if ( max_vcpus > limit )
         max_vcpus = limit;
 
+    if ( max_vcpus < opt_dom0_max_vcpus_max && max_vcpus > opt_dom0_max_vcpus_min )
+        printk(XENLOG_INFO "Dom0 using %d vCPUs conflicts with request to use"
+               " %d node(s), using up to %d vCPUs\n", opt_dom0_max_vcpus_max,
+               dom0_nr_pxms, max_vcpus);
+
     return max_vcpus;
 }
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 25 lines · Jane Malalane

This is not a bug. The xen cmdline can request both a NUMA restriction and a vcpu count restriction for Dom0. The node restriction wil always be respected which might mean either using dom0_max_vcpus < opt_dom0_max_vcpus_max or using more vCPUs than pCPUs on a node. In the case where dom0_max_vcpus gets capped at the maximum number of pCPUs for the number of nodes chosen, it can be useful particularly for debugging to print a message in the serial log.

---
CC: Jan Beulich <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: "Roger Pau Monné" <[email protected]>
CC: Wei Liu <[email protected]>

---
  xen/arch/x86/dom0_build.c | 5 +++++
  1 file changed, 5 insertions(+)
xen/arch/x86/dom0_build.c +0 -0
index fe24e11b37..e57cc80ef0 100644
@@ -240,6 +240,11 @@ unsigned int __init dom0_max_vcpus(void)
      if ( max_vcpus > limit )

xen/arch/x86/dom0_build.c unsigned int __init dom0_max_vcpus(void) · line 250

Quoted 10 lines
xen/arch/x86/dom0_build.c +5 -0
          max_vcpus = limit;
 
+    if ( max_vcpus < opt_dom0_max_vcpus_max && max_vcpus > opt_dom0_max_vcpus_min )
+        printk(XENLOG_INFO "Dom0 using %d vCPUs conflicts with request to use"
+               " %d node(s), using up to %d vCPUs\n", opt_dom0_max_vcpus_max,
+               dom0_nr_pxms, max_vcpus);
+
      return max_vcpus;
  }
 

Here I was debating whether to use a printk or a dprintk, as although this would be useful for debugging, it gives general info on dom0 vCPU topology, as does for e.g. 'Dom0 has maximimum ... vCPUS'. However, I defer to the maintainers, as I'm still getting acquainted with Xen (I also understand this patch is of minor importance).

Thanks,

Jane.

#2 lore raw
In reply to Jane Malalane
Quoted 4 lines · Jane Malalane

This is not a bug. The xen cmdline can request both a NUMA restriction and a vcpu count restriction for Dom0. The node restriction wil always be respected which might mean either using dom0_max_vcpus < opt_dom0_max_vcpus_max

This is quite normal a case if a range was specified, or did you mean opt_dom0_max_vcpus_min? But min and max get applied last anyway, so those always override what was derived from dom0_nr_pxms.

Quoted 4 lines

or using more vCPUs than pCPUs on a node. In
the case where dom0_max_vcpus gets capped at the maximum number of pCPUs for the number of nodes chosen, it can be useful particularly for debugging to print a message in the serial log.

The number of vCPU-s Dom0 gets is logged in all cases. And the reasons why a certain value is uses depends on more than just the number-of-nodes restriction. I therefor wonder whether the wording as you've chosen it is potentially misleading, and properly expressing everything in a single message is going to be quite a bit too noisy. Furthermore ...

xen/arch/x86/dom0_build.c unsigned int __init dom0_max_vcpus(void) · line 246

Quoted 10 lines
xen/arch/x86/dom0_build.c +4 -0
@@ -240,6 +240,11 @@ unsigned int __init dom0_max_vcpus(void)
     if ( max_vcpus > limit )
         max_vcpus = limit;
 
+    if ( max_vcpus < opt_dom0_max_vcpus_max && max_vcpus > opt_dom0_max_vcpus_min )
+        printk(XENLOG_INFO "Dom0 using %d vCPUs conflicts with request to use"
+               " %d node(s), using up to %d vCPUs\n", opt_dom0_max_vcpus_max,
+               dom0_nr_pxms, max_vcpus);

... the function can be called more than once, whereas such a message (if we really want it) would better be issued just once.

To answer your later reply to yourself: I think printk() is fine here (again assuming we want such a message in the first place); it's a boot-time-only message after all.

Jan

#3 lore raw
Quoted 11 lines · Jan Beulich

[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.

Quoted 4 lines · Jane Malalane

This is not a bug. The xen cmdline can request both a NUMA restriction and a vcpu count restriction for Dom0. The node restriction wil always be respected which might mean either using dom0_max_vcpus < opt_dom0_max_vcpus_max

This is quite normal a case if a range was specified, or did you mean opt_dom0_max_vcpus_min? But min and max get applied last anyway, so those always override what was derived from dom0_nr_pxms.

Yes, I was just giving context here for what I say in the following sentence. Maybe this became more confusing than helpful.

Quoted 8 lines
Quoted 6 lines

or using more vCPUs than pCPUs on a node. In
the case where dom0_max_vcpus gets capped at the maximum number of pCPUs for the number of nodes chosen, it can be useful particularly for debugging to print a message in the serial log.
The number of vCPU-s Dom0 gets is logged in all cases. And the

reasons why a certain value is uses depends on more than just the number-of-nodes restriction.

Maybe I should have said 'Dom0 "receiving" %d vCPUS' instead of "using" in the serial log, in which case I can amend that to make it clearer (that ofc if we still want this change)?
I therefor wonder whether the

Quoted 10 lines

wording as you've chosen it is potentially misleading, and properly expressing everything in a single message is going to be quite a bit too noisy. Furthermore ...

Quoted 6 lines
xen/arch/x86/dom0_build.c +0 -0
@@ -240,6 +240,11 @@ unsigned int __init dom0_max_vcpus(void)
      if ( max_vcpus > limit )
          max_vcpus = limit;
 
Quoted 7 lines

xen/arch/x86/dom0_build.c unsigned int __init dom0_max_vcpus(void) · line 246

Quoted 4 lines
xen/arch/x86/dom0_build.c +4 -0
+    if ( max_vcpus < opt_dom0_max_vcpus_max && max_vcpus > opt_dom0_max_vcpus_min )
+        printk(XENLOG_INFO "Dom0 using %d vCPUs conflicts with request to use"
+               " %d node(s), using up to %d vCPUs\n", opt_dom0_max_vcpus_max,
+               dom0_nr_pxms, max_vcpus);

... the function can be called more than once, whereas such a message (if we really want it) would better be issued just once.

Yes, that is true and this code would have to live outside of dom0_build.c.

Quoted 5 lines

To answer your later reply to yourself: I think printk() is fine here (again assuming we want such a message in the first place); it's a boot-time-only message after all.

Okay.

Thank you,

Jane.