After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 619733 - gnome-system-monitor displays extra "Unknown CPU mode" on ppc64
gnome-system-monitor displays extra "Unknown CPU mode" on ppc64
Status: RESOLVED FIXED
Product: system-monitor
Classification: Core
Component: sysinfo
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: System-monitor maintainers
System-monitor maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-26 15:45 UTC by Luciano Chavez
Modified: 2011-11-11 10:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch: Ignore sysinfo record that contains no cpu model information (441 bytes, patch)
2010-05-26 15:45 UTC, Luciano Chavez
none Details | Review
Screenshot of "Unknown CPU model" in System tab (48.31 KB, image/jpeg)
2010-05-26 15:46 UTC, Luciano Chavez
  Details
Screenshot using patched gnome-system-monitor (40.07 KB, image/png)
2010-05-26 15:47 UTC, Luciano Chavez
  Details
Fix falsly reporting 'Unknown CPU model'. (1.53 KB, patch)
2011-03-02 23:24 UTC, Chris Kühl
committed Details | Review

Description Luciano Chavez 2010-05-26 15:45:21 UTC
Created attachment 162027 [details] [review]
Patch: Ignore sysinfo record that contains no cpu model information

While testing RHEL6, the gnome-system-monitor tool always displays an
extra CPU as "Unknown CPU model" in the "System" tabbed section. For
example, the host has only two virtual processors
(Processor 0 and Processor 1), but there is always an extra CPU
displayed at the end with a description of "Processor 2: Unknown CPU
model". You could see details in the attachment "Unknown CPU model".

Recreation steps:
1. Launch System Monitor Tool (gnome-system-monitor)
2. Look at "Hardware" item of "System" tabbed section like following sentence:
   Processor 2: Unknown CPU model

Additional information:

# rpm -q gnome-system-monitor
gnome-system-monitor-2.28.0-4.el6.ppc64
# cat /proc/cpuinfo
processor       : 0
cpu             : POWER6 (architected), altivec supported
clock           : 4204.000000MHz
revision        : 3.1 (pvr 003e 0301)

processor       : 1
cpu             : POWER6 (architected), altivec supported
clock           : 4204.000000MHz
revision        : 3.1 (pvr 003e 0301)

timebase        : 512000000
platform        : pSeries
model           : IBM,8204-E8A
machine         : CHRP IBM,8204-E8A

The problem stems from the processing done in the gnome-system-monitor
src/sysinfo.cpp source and specifically in the load_processors_info()
method:

    void load_processors_info()
    {
      const glibtop_sysinfo *info = glibtop_get_sysinfo();

      for (guint i = 0; i != info->ncpu; ++i) {
        const char * const keys[] = { "model name", "cpu" };
        gchar *model = 0;

        for (guint j = 0; !model && j != G_N_ELEMENTS(keys); ++j)
          model =
static_cast<char*>(g_hash_table_lookup(info->cpuinfo[i].values,
                                                         keys[j]));

        if (!model)
          model = _("Unknown CPU model");

        this->processors.push_back(model);
      }
    }

It first invokes the glibtop_get_sysinfo() call which comes from the
external libgtop to retrieve the system info (I will explain where from
shortly) and then uses the keys "model name" and "cpu" to retrieve the
corresponding strings in a hash table that correspond to those keys.
What is retrieved is what ends up being displayed under the Hardware
section.

In the libgtop source we find a file called  sysdeps/linux/sysinfo.c
which contains the source for the glibtop_get_sysinfo() which almost
wholly contained in the function init_sysinfo(). It essentially reads
the contents of /proc/cpuinfo into a buffer then parses each line and
uses the label before the ":" as the key and the remaining as the value
and the labels/keys are loaded into string array and the string values
are added into a hash table with the label as the key.

init_sysinfo() parses the /proc/cpuinfo and considers each set of text
interrupted by "\n\n" as a new record of information. However, in
the /proc/cpuinfo output for a ppc64 system the last "record" is not
information about a specific cpu but mostly extra general information.

timebase        : 512000000
platform        : pSeries
model           : IBM,8204-E8A
machine         : CHRP IBM,8204-E8A

So when the load_processors_info() iterates into that last record, it
does not retrieve anything corresponding to "model name" or "cpu" key
and we end up displaying this last extra "Unknown CPU model" line.

The attached patch makes one simple change that removes the display of
the "Unknown CPU model" string and instead continues iteration of the
loop if the sysinfo record contains no "cpu" or "model name" key or
value in it.

This second screenshot is from the same system as the first screenshot
but using the gnome-system-monitor with the patch applied showing no
extra processor with "Unknown CPU model".

The patch applies cleanly to the latest gnome-system-monitor-2.28.1 source.
Comment 1 Luciano Chavez 2010-05-26 15:46:56 UTC
Created attachment 162028 [details]
Screenshot of "Unknown CPU model" in System tab
Comment 2 Luciano Chavez 2010-05-26 15:47:21 UTC
Created attachment 162029 [details]
Screenshot using patched gnome-system-monitor
Comment 3 Luciano Chavez 2011-02-11 17:12:42 UTC
Hello,

Is it possible to get a comment regarding the patch please?
Comment 4 Chris Kühl 2011-03-02 23:24:11 UTC
Thanks for the patch. Sorry it took so long to tend to it.
Comment 5 Chris Kühl 2011-03-02 23:24:14 UTC
Created attachment 182314 [details] [review]
Fix falsly reporting 'Unknown CPU model'.
Comment 6 Luciano Chavez 2011-03-03 01:57:30 UTC
Thanks Chris!

I noticed that patch checked in had three additional line changes but that might have just been minor white space differences?
Comment 7 Chris Kühl 2011-03-03 07:08:16 UTC
(In reply to comment #6)
> Thanks Chris!
> 
> I noticed that patch checked in had three additional line changes but that
> might have just been minor white space differences?

Yes, the patch wouldn't apply cleanly due to recent major changes so I made the change myself but marked you as the author since you tracked it down and were nice enough to submit a patch for. I'm always happy to get rid of trailing whitespace, which my editor automatically does on save, so I left those changes too.

Thanks again.
Comment 8 Luciano Chavez 2011-03-03 14:11:19 UTC
Understood. Thanks!