[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 21:35:18 UTC 2015



On 02/10/2015 01:26 PM, Thierry Fauck ( thierry @ linux.vnet.ibm.com )
wrote:
> Hi,
> 
> 1) on ppc64le lscpu works properly:
> ubuntu at fauck3:~$ lscpu
> Architecture:          ppc64le
> Byte Order:            Little Endian
> CPU(s):                160
> On-line CPU(s) list:   0-159
> Thread(s) per core:    4
> Core(s) per socket:    1
> Socket(s):             40
> NUMA node(s):          1
> Model:                 IBM pSeries (emulated by qemu)
> L1d cache:             32K
> L1i cache:             32K
> NUMA node0 CPU(s):     0-159
> ubuntu at fauck3:~$ ppc64_cpu --threads-per-core
> Threads per core: 4
> ubuntu at fauck3:~$ dpkg-query -S /usr/sbin/ppc64_cpu
> powerpc-ibm-utils: /usr/sbin/ppc64_cpu
> ubuntu at fauck3:~$ ppc64_cpu --cores-present  
> Number of cores present = 40
> 
> 2) Do you agree that we need to handle this kind of error ? even though
> current proposed package is an updated package which works properly on
> ubuntu/trusty - so may be not necessary to go further. May be just
> handling a possible error and avoid a start fail.

If the older version of ppc64_cpu without the --threads-per-core
argument is all that's available in any supported distros, we should fix
it. If not, we could add some safe-guarding and also set all the values
back to the defaults (e.g. False and all 0's, as at the beginning of the
function).

...

And, just a suggestion: If you put

*.py    diff=python

into the .git/info/attributes for your kimchi project, it will create
better diffs. The main thing I like about it is that instead of the
class name, it lists the function the change is to as well.

> 
> Thanks
> 
> On 02/10/15 16:33, Christy Perez wrote:
>> 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
>>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
> 
> 




More information about the Kimchi-devel mailing list