Re: [PATCH v2 1/1] virhostcpu.c: fix 'die_id' parsing for Power hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17. 3. 2020 1:01, 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, running 5.6 and 4.18 kernel respectively,
> 'die_id' is set to -1:
> 
> $ cat /sys/devices/system/cpu/cpu0/topology/die_id
> -1
> 
> This breaks virHostCPUGetDie() parsing because it is trying to
> retrieve an unsigned integer, causing problems during VM start:
> 
> virFileReadValueUint:4128 : internal error: Invalid unsigned integer
> value '-1' in file '/sys/devices/system/cpu/cpu0/topology/die_id'
> 
> This isn't necessarily a PowerPC only behavior. Linux kernel commit
> 0e344d8c70 added in the former Documentation/cputopology.txt, now
> Documentation/admin-guide/cputopology.rst, that:
> 
> ---

This line makes git-am cut the commit message here. I'm dropping it and
increasing indend of the paragraph below.

> To be consistent on all architectures, include/linux/topology.h
> provides default definitions for any of the above macros that are
> not defined by include/asm-XXX/topology.h:
> 
> 1) topology_physical_package_id: -1
> 2) topology_die_id: -1
> (...)
> ---
> 
> This means that it can be expected that an architecture that
> does not implement the die_id element will mark it as -1 in
> sysfs.
> 
> Let's change the parsing being done in virHostCPUGetDie(), reading
> die_id as an integer instead of unsigned int. In case die_id is -1,
> default it to zero like the case of file not found.
> 
> Fixes: 7b79ee2f78bbf2af76df2f6466919e19ae05aeeb
> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
> ---
>  src/util/virhostcpu.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

and pushed.

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux