Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
powerpc-utils.33602
lparstat-Fix-offline-threads-uninitialized-entr...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File lparstat-Fix-offline-threads-uninitialized-entries.patch of Package powerpc-utils.33602
From 7a5625f2bc012fbbf0cd8384cb4e7761c5de3bb7 Mon Sep 17 00:00:00 2001 From: Laurent Dufour <ldufour@linux.ibm.com> Date: Tue, 2 May 2023 19:59:27 +0200 Subject: [PATCH 3/3] lparstat: Fix offline threads uninitialized entries When some threads are offline, lparstat -E is failing like that: $ ppc64_cpu --info # CPU 20 is offline Core 0: 0* 1* 2* 3* 4* 5* 6* 7* Core 1: 8* 9* 10* 11* 12* 13* 14* 15* Core 2: 16* 17* 18* 19* 20 21* 22* 23* Core 3: 24* 25* 26* 27* 28* 29* 30* 31* Core 4: 32* 33* 34* 35* 36* 37* 38* 39* Core 5: 40* 41* 42* 43* 44* 45* 46* 47* $ lparstat -E Failed to read /sys/devices/system/cpu/cpu0/spurr The message is complaining about CPU0 but the real issue is that in parse_sysfs_values() the test cpu_sysfs_fds[i].spurr >= 0 is valid even if the entry has not been initialized (cpu_sysfs_fds is alloc cleared). So if the number of threads online seen in assign_cpu_sysfs_fds is lower than threads_in_system, the loop in parse_sysfs_values() will read uninitialized entry, where .cpu=0. To prevent that, unset entries in the cpu_sysfs_fds should have the spurr fd set to -1. Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> --- src/lparstat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lparstat.c b/src/lparstat.c index a9e7bce..d2fdb3f 100644 --- a/src/lparstat.c +++ b/src/lparstat.c @@ -163,6 +163,10 @@ static int assign_cpu_sysfs_fds(int threads_in_system) cpu_idx++; } + /* Mark extra slots for offline threads unset, see parse_sysfs_values */ + for (; cpu_idx < threads_in_system; cpu_idx++) + cpu_sysfs_fds[cpu_idx].spurr = -1; + return 0; error: fprintf(stderr, "Failed to open %s: %s\n", -- 2.40.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor