https://bugs.kde.org/show_bug.cgi?id=434922

Matteo <mat...@matteopiscitelli.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mat...@matteopiscitelli.it

--- Comment #18 from Matteo <mat...@matteopiscitelli.it> ---
Seems to me that bug is in linuxcpuplugin.cpp, row 72:

```
 for (QByteArray line = cpuinfo.readLine(); !line.isEmpty(); line =
cpuinfo.readLine()) {
        CpuInfo info;
        // Processors are divided by empty lines
        for (; line != "\n";  line = cpuinfo.readLine()) {
            // we are interested in processor number as identifier for
/proc/stat, physical id (the
            // cpu the core belongs to) and the number of the core. However
with hyperthreading
            // multiple entries will have the same combination of physical id
and core id. So we just
            // count up the core number. For mapping temperature both ids are
still needed nonetheless.
            const int delim = line.indexOf(":");
            const QByteArray field = line.left(delim).trimmed();
            const QByteArray value = line.mid(delim + 1).trimmed();
            if (field == "processor") {
                info.id = value.toInt();
            } else if (field == "physical id") {
                info.cpu = value.toInt();
            } else if (field == "core id") {
                info.core = value.toInt();
            } else if (field == "cpu MHz") {
                info.frequency = value.toDouble();
            } else if (field == "siblings") {
                info.siblings = value.toInt();
            }
        }
```

and depends on the fact that inner loop doesn't check for empty line, baseing
on assumption that every cpu block in /proc/cpuinfo is terminated by and empty
line. Problem is that arm cpuinfo terminates with one or more lines that are
not part of any cpu-block, like the following raspi5 example:

```
cat /proc/cpuinfo 
processor       : 0
BogoMIPS        : 108.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp
asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x4
CPU part        : 0xd0b
CPU revision    : 1

processor       : 1
BogoMIPS        : 108.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp
asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x4
CPU part        : 0xd0b
CPU revision    : 1

processor       : 2
BogoMIPS        : 108.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp
asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x4
CPU part        : 0xd0b
CPU revision    : 1

processor       : 3
BogoMIPS        : 108.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp
asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x4
CPU part        : 0xd0b
CPU revision    : 1

Hardware        : BCM2835
Revision        : d04170
Serial          : XXXXXXXXXXXXXXXXXXXXXX
Model           : Raspberry Pi 5 Model B Rev 1.0
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to