Skip to content

Conversation

@benjamreis
Copy link
Contributor

Discussed here: #5462

Discussed here: xapi-project#5462

Signed-off-by: Benjamin Reis <benjamin.reis@vates.tech>
@benjamreis benjamreis force-pushed the hyperthreading-host-info branch from 0087026 to 79a0ab5 Compare February 21, 2024 14:34
@robhoes
Copy link
Member

robhoes commented Feb 21, 2024

@andyhhp I know you have ideas about exposing CPU topologies... does this proposal fit?

@andyhhp
Copy link
Collaborator

andyhhp commented Feb 21, 2024

Right now it's going to give you some quite creative (mis)truths. We have plans, but there's quite a lot of upstream Xen work required before we can provide good accurate information here.

@benjamreis What precisely are you looking for here? I presume some kind of "is SMT activate or not?"

@olivierlambert
Copy link

olivierlambert commented Feb 21, 2024

For Windows server licenses or other Oracle-like commercial reasons, people need to have the number of real physical cores on a machine. If it works 80% of the time, it might be enough. On the hardware we tested, it seems to be right.

@benjamreis
Copy link
Contributor Author

Thx for the answer Olivier.

Tested:

                              cpu_info (MRO): cpu_count: 1; socket_count: 1; threads_per_core: 1; vendor: GenuineIntel; speed: 1700.121; modelname: Intel(R) Xeon(R) CPU E5-2650L v2 @ 1.70GHz; family: 6; model: 62; stepping: 4; flags: fpu de tsc msr pae mce cx8 apic sep mca cmov pat clflush acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc rep_good ...

and compared to:

[15:49 xcp-ng-fnownclp ~]# xl info threads_per_core
1

@benjamreis benjamreis marked this pull request as ready for review February 21, 2024 15:02
@andyhhp
Copy link
Collaborator

andyhhp commented Feb 21, 2024

Right, but note how https://ark.intel.com/content/www/us/en/ark/products/75270.html is 10 cores and 20 threads.

@robhoes
Copy link
Member

robhoes commented Feb 21, 2024

And we are missing a core_count also, if cpu_count isn't that :)

@olivierlambert
Copy link

@andyhhp that's an example in a nested VM. The result of xl works fine in the "real" dom0:

# xl info
host                   : R620-1
release                : 4.19.0+1
version                : #1 SMP Wed Aug 9 11:41:08 CEST 2023
machine                : x86_64
nr_cpus                : 40
max_cpu_id             : 47
nr_nodes               : 2
cores_per_socket       : 10
threads_per_core       : 2

@xapi-project xapi-project deleted a comment from codecov bot Feb 22, 2024
@andyhhp
Copy link
Collaborator

andyhhp commented Feb 22, 2024

@andyhhp that's an example in a nested VM. The result of xl works fine in the "real" dom0:

# xl info
host                   : R620-1
release                : 4.19.0+1
version                : #1 SMP Wed Aug 9 11:41:08 CEST 2023
machine                : x86_64
nr_cpus                : 40
max_cpu_id             : 47
nr_nodes               : 2
cores_per_socket       : 10
threads_per_core       : 2

And what value do you want to get when you turn HT/SMT off in the firmware? (Hint, you'll get different behaviour on Intel and AMD when trying this.)

What value do you expect to get when booting Xen with smt=0 ?

What behaviour do you want if someone runs xen-hptool smt-disable on a live system?

@olivierlambert
Copy link

olivierlambert commented Feb 22, 2024

I don't think our target (ie people using this number for inventory/licensing reasons, NOT security) will ever do smt=0, disabling it in the firmware or xen-hptool smt-disable. As soon they done that, they are "advanced enough" to know what's going on. The average joe just needs an info "as is" without doing any tinkering. Even if we answer correctly in only 80% of the cases (which will be likely closer to 99%), it's good enough to me :)

@lindig
Copy link
Contributor

lindig commented Feb 26, 2024

I would be fine to merge this if we understand that these numbers don't mean much in a virtual environment.

@olivierlambert
Copy link

@lindig what do you mean exactly? it's just exposing something already exposed by xl info, we are not creating new data.

Copy link
Member

@robhoes robhoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've talked to Andy about this. Generally speaking, there is a lot to improve in the way we expose CPU topology info. However, this is passing on data from Xen that fits within the context of what is already there. So it's fine to add it, if we acknowledge and accept its limitations.

@lindig
Copy link
Contributor

lindig commented Feb 26, 2024

I'm not saying you are inventing numbers but is the number XL presents even well defined? @andyhhp's comments suggests to me that what we think and what code using that number thinks it means could be different. And you are adding this because you want some code to use it, I assume.

@olivierlambert
Copy link

Sorry for answering later than I wanted: in short, we don't want any code to "use it" (in a way to do any computation), we just want to expose it in XO (web UI, CLI or API), so our users can do whatever they want with it 🙂

I already know that it's mostly for display purpose/being aware of the reported topology for licensing/reporting reasons. So even if it's not perfectly correct in all cases, it won't be used for anything critical itself.

@robhoes robhoes merged commit 34e92c9 into xapi-project:master Mar 4, 2024
@xapi-project xapi-project deleted a comment from github-actions bot Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants