Bug 1849215
| Summary: | Parse the number of cpus correctly on s390 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | John Kacur <jkacur> | ||||
| Component: | python-linux-procfs | Assignee: | John Kacur <jkacur> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Mike Stowell <mstowell> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 8.3 | CC: | akhisti, bhu, kcarcia, qzhao, rt-maint | ||||
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
||||
| Target Release: | 8.0 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | python-linux-procfs-0.6.2-1.el8 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2020-11-04 02:09:48 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1823810 | ||||||
| Attachments: |
|
||||||
Created attachment 1698175 [details]
Parse the number of cpus correctly
Hi John, I try to reproduce/test this problem on s390x, but I met problem when use tuna command: # tuna --cpus=1 --isolate Function: isolate_cpus , Invalid argument # rpm -q tuna python3-linux-procfs tuna-0.14-4.el8.noarch python3-linux-procfs-0.6-7.el8.noarch Is there anything wrong with my steps? - Qiao Hi Qiao, I believe the tuna error in comment #2 is actually proving the issue exists, whereas the patch should fix this issue. On this particular s390x system with 2 cores: # cat /proc/cpuinfo [...snip...] processor 0: version = FF, identification = 3433E8, machine = 2964 processor 1: version = FF, identification = 3433E8, machine = 2964 cpu number : 0 cpu MHz dynamic : 5000 cpu MHz static : 5000 cpu number : 1 cpu MHz dynamic : 5000 cpu MHz static : 5000 If we look at the function in procfs.py the patch touches and have it print the cpuinfo class properties, we see: # tuna --cpus=1 --isolate self.nr_cpus = 0, self.nr_sockets = 0.0, self.nr_cores = 0.0 <---------- Function: isolate_cpus , Invalid argument So before the patch, python-linux-procfs tells us the system has 0 CPUs. This is because on x86_64 systems in /proc/cpuinfo output, we count the number of times 'processor' appears before a ':' in each line output, which does not occur in above output (note for s390x it prints "processor <#>:" ...). After the patch, nr_cpus increases for s390x systems on each occurrence of the line 'cpu number' before a ':', which in the above output, will (correctly) be 2 CPUs. Then the tuna command should be able to proceed. (In reply to Qiao Zhao from comment #2) > Hi John, > > I try to reproduce/test this problem on s390x, but I met problem when use > tuna command: > # tuna --cpus=1 --isolate > Function: isolate_cpus , Invalid argument > > # rpm -q tuna python3-linux-procfs > tuna-0.14-4.el8.noarch > python3-linux-procfs-0.6-7.el8.noarch > > Is there anything wrong with my steps? > > - Qiao No, you did it perfectly. You have correctly reproduced the problem. :) (In reply to Mike Stowell from comment #3) > Hi Qiao, > > I believe the tuna error in comment #2 is actually proving the issue exists, > whereas the patch should fix this issue. > > On this particular s390x system with 2 cores: > > # cat /proc/cpuinfo > > [...snip...] > > processor 0: version = FF, identification = 3433E8, machine = 2964 > processor 1: version = FF, identification = 3433E8, machine = 2964 > > cpu number : 0 > cpu MHz dynamic : 5000 > cpu MHz static : 5000 > > cpu number : 1 > cpu MHz dynamic : 5000 > cpu MHz static : 5000 > > If we look at the function in procfs.py the patch touches and have it print > the cpuinfo class properties, we see: > > # tuna --cpus=1 --isolate > self.nr_cpus = 0, self.nr_sockets = 0.0, self.nr_cores = 0.0 > <---------- > Function: isolate_cpus , Invalid argument > > So before the patch, python-linux-procfs tells us the system has 0 CPUs. > This is because on x86_64 systems in /proc/cpuinfo output, we count the > number of times 'processor' appears before a ':' in each line output, which > does not occur in above output (note for s390x it prints "processor <#>:" > ...). > > After the patch, nr_cpus increases for s390x systems on each occurrence of > the line 'cpu number' before a ':', which in the above output, will > (correctly) be 2 CPUs. Then the tuna command should be able to proceed. Yes, good analysis Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (python-linux-procfs bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:4584 |
bpython-linux-procfs: Parse the number of cpus correctly on s390(x) Getting the number of cpus breaks on s390 and s390x due to differences in /proc/cpuinfo This can cause problems in other programs such as tuna when running tuna --cpus=1 --isolate for example Fix this by testing whether we are on s390 and increasing the cpu count if we match "cpu number"