Skip to content

Crash when arbitrary CPUs are disabled #439

Open
@khumba

Description

@khumba

Hello,

I have two systems running Debian testing. One is a desktop with an i7-7700 CPU, and the other is a System76 laptop with an i7-10510U CPU (both 4 cores, 8 threads). I pass nosmt to the kernel on both. This results in different CPU numbers being disabled on each.

On the desktop, cpus 0/1/2/3 are enabled, and cpus 4/5/6/7 are disabled. qps runs fine.

On the laptop, cpus 0/2/4/6 are enabled, and cpus 1/3/5/7 are disabled. qps crashes on startup with:

DEBUG: version = 60100
Qps: Error reading info for cpu1 (/proc/stat)
Aborted (core dumped)

Similarly, if I remove nosmt and manually disable any single CPU except for the last on either machine, it crashes. It looks like this is coming from Proc::read_system(), which assumes that if N CPUs are enabled then those will be the ones numbered 0 to N-1.

Expected Behavior

qps should handle arbitrary CPUs being disabled gracefully.

Current Behavior

Well, currently it crashes on startup without opening a window :).

Possible Solution

I'm not sure what makes the most sense for qps, but:

  • The read_system() logic that is parsing /proc/stat could iterate across all processors enabled or disabled, update cpu_times for the processors it finds, and skip the processors it doesn't find.
  • I haven't seen how Proc communicates the number of processors with the rest of the program, so I'm sure there are other considerations.
Steps to Reproduce (for bugs)
  1. echo 0 | sudo tee /sys/devices/system/cpu/cpu${N}/online for some 0 < N < (number of processors i.e. nproc --all) - 1.
  2. Try to start qps, observe crash.
Context

I'd just like to be able to use have SMT disabled and use qps on my laptop, but it's not the end of the world as there are other system monitors. I'm not sure why my laptop processor chooses to disable odd-numbered CPUs, I assume something to do with its physical layout as I haven't changed anything to make it do this.

System Information
  • Distribution & Version: Debian testing/trixie
  • Kernel: 6.1.27-1
  • Qt Version: 5.15.8
  • lxqt-build-tools Version: 0.13.0 (personal builds in my apt repo based on Debian's packages)
  • Package version: 2.7.0 (but also confirmed to crash for 2.6.0-1 in Debian)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions