[Kimchi-devel] [PATCH] Old version of ppc64_cpu command doesn't support option --threads-per-core
Christy Perez
christy at linux.vnet.ibm.com
Tue Feb 10 15:33:14 UTC 2015
This isn't a good way to go. lscpu Threads/core is showing '1', b/c, on
Power, SMT has to be off to use SMT for guests.
# lscpu
Architecture: ppc64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Big Endian
CPU(s): 56
On-line CPU(s) list: 0,4,12,16,20,28,32,36,40,44,48,52,56,60
Off-line CPU(s) list:
1-3,5-7,13-15,17-19,21-23,29-31,33-35,37-39,41-43,45-47,49-51,53-55,57-59,61-63
Thread(s) per core: 1
Core(s) per socket: 7
Socket(s): 2
# ppc64_cpu --threads-per-core
Threads per core: 4
On 02/06/2015 05:50 AM, thierry at linux.vnet.ibm.com wrote:
> From: Thierry FAUCK - IBM LTC <thierry at linux.vnet.ibm.com>
>
> Old version of ppc64_cpu command doesn't support option
> --threads-per-core and raises a start message
> ValueError: invalid literal for int() with base 10: 'information)'
> Solution is to get info from lscpu which sounds accurate
>
> Remove dependency to qemu-kvm
>
> Signed-off-by: Thierry FAUCK - IBM LTC <thierry at linux.vnet.ibm.com>
>
> modified: contrib/DEBIAN/control.in
> modified: src/kimchi/model/cpuinfo.py
> ---
> contrib/DEBIAN/control.in | 1 -
> src/kimchi/model/cpuinfo.py | 20 +++++++++++++++-----
> 2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
> index 069e14b..776b033 100644
> --- a/contrib/DEBIAN/control.in
> +++ b/contrib/DEBIAN/control.in
> @@ -14,7 +14,6 @@ Depends: python-cherrypy3 (>= 3.2.0),
> libvirt-bin,
> nfs-common,
> python-m2crypto,
> - qemu-kvm,
> python-pam,
> python-parted,
> python-psutil (>= 0.6.0),
> diff --git a/src/kimchi/model/cpuinfo.py b/src/kimchi/model/cpuinfo.py
> index 3411ef5..d43f21f 100644
> --- a/src/kimchi/model/cpuinfo.py
> +++ b/src/kimchi/model/cpuinfo.py
> @@ -80,11 +80,21 @@ class CPUInfoModel(object):
> out, error, rc = run_command(['ppc64_cpu', '--cores-on'])
> if not rc:
> self.cores_available = int(out.split()[-1])
> - out, error, rc = run_command(['ppc64_cpu', '--threads-per-core'])
> - if not rc:
> - self.threads_per_core = int(out.split()[-1])
> - self.sockets = self.cores_present/self.threads_per_core
> - self.cores_per_socket = self.cores_present/self.sockets
> + try:
> + out, error, rc = run_command(['ppc64_cpu', '--threads-per-core'])
> + if not rc:
> + self.threads_per_core = int(out.split()[-1])
> + self.sockets = self.cores_present/self.threads_per_core
> + self.cores_per_socket = self.cores_present/self.sockets
> + except:
> + out, error, rc = run_command(['sh', '-c', 'lscpu |
> + grep "Thread(s) per core:"'])
> + if not rc:
> + self.cores_present = int(out.split()[-1])
> + out, error, rc = run_command(['sh', '-c', 'lscpu |
> + grep "Core(s) per socket:"'])
> + if not rc:
> + self.cores_available = int(out.split()[-1])
> else:
> # Intel or AMD
> self.guest_threads_enabled = True
>
More information about the Kimchi-devel
mailing list