
Please disregard this patch. There is a bug in the logic: On 3/16/20 6:53 PM, Daniel Henrique Barboza wrote:
Commit 7b79ee2f78 makes assumptions about die_id parsing in the sysfs that aren't true for Power hosts. In both Power8 and Power9 the die_id is set to -1:
[...]
--- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -220,15 +220,20 @@ virHostCPUGetSocket(unsigned int cpu, unsigned int *socket) int virHostCPUGetDie(unsigned int cpu, unsigned int *die) { - int ret = virFileReadValueUint(die, - "%s/cpu/cpu%u/topology/die_id", - SYSFS_SYSTEM_PATH, cpu); + int die_id; + int ret = virFileReadValueInt(&die_id, + "%s/cpu/cpu%u/topology/die_id", + SYSFS_SYSTEM_PATH, cpu);
- /* If the file is not there, it's 0 */ - if (ret == -2) + /* If the file is not there, it's 0. + * PowerPC hosts can report die_id = -1, which for our + * case here it's the same as absent file. */ + if (ret == -2 || die_id < 0)
If 'ret == -1' we'll end up making a comparison with a bogus 'die_id' value, which will be either uninitialized or invalid due to the parsing error. I fixed it in the v2. DHB