Jira (FACT-2980) Facter 4 outputs the processors.speed fact differently on Linux

18 views
Skip to first unread message

Gabriel Nagy (Jira)

unread,
Mar 16, 2021, 7:09:03 AM3/16/21
to puppe...@googlegroups.com
Gabriel Nagy updated an issue
 
Facter / Bug FACT-2980
Facter 4 outputs the processors.speed fact differently on Linux
Change By: Gabriel Nagy
Summary: CLONE - Facter 4 outputs the processors.speed fact differently on Linux
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Gabriel Nagy (Jira)

unread,
Mar 16, 2021, 7:18:02 AM3/16/21
to puppe...@googlegroups.com
Gabriel Nagy updated an issue
Running * puppet facts diff Note: * This might be an issue only on AIX 7 non-virtualized systems (with processors that support variable frequency)

facter 3

{code}
$ /usr/bin/facter processors
. 1 and AIX 7 speed
4
. 2 gives the following output: 20 GHz
{code
:json }
{
facter 4 (2 consecutive queries)
  { code}
  " $ bundle exec facter processors.speed "
3.18 GHz
$ bundle exec facter processors.speed
1.06 GHz
{code}

Facter 4 reads from /proc/cpuinfo which reports the current speed of the processors
:

{ code}
    "new_value" $ grep 'cpu MHz' /proc/cpuinfo
cpu MHz
: "3 1724 . 42 GHz", 163
    "old_value" cpu MHz : "3 1899 . 43 GHz" 271
cpu MHz  : 2135.291
cpu MHz  : 1625.782
cpu MHz  : 1729.682
cpu MHz  : 1817.039
cpu MHz  : 1729.482
cpu MHz  : 1993.369
{code
  }

Facter 3 reads the max speed from the first CPU (in kHz, then converts it):

{code
}
$ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
4200000
{code}
Note
Facter 3 relevant code path
: *EXCLUDE_LIST* from https://github.com/puppetlabs/ puppet facter /blob/ 6 3 .x/lib/ puppet src / face/ facts /linux/processor_resolver . rb cc # L5 needs to be manually emptied to see above results. L192
More info Facter 4 relevant code path : [ https:// docs github . google. com/ document puppetlabs / d facter / 1QlX_mv17fZ4eVZa9zHxvTRVJ5sq88aj3GjUC6lVFiz0 blob / edit#heading=h 5f092a30cd5c33c2715619cada943bc1a8e0fa04/lib/facter/resolvers/processors . gnnvlmulav1v] rb#L75

Andrei Filipovici (Jira)

unread,
Mar 17, 2021, 4:12:04 AM3/17/21
to puppe...@googlegroups.com
Andrei Filipovici commented on Bug FACT-2980
 
Re: Facter 4 outputs the processors.speed fact differently on Linux

This processor speed is extracted differently for x86 and power architectures.

On Facter 3, for x86, it's read from /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq. This is the maximum frequency the processor can achieve.
On the other hand, for power architecture, the speed is read from /proc/cpuinfo, the `clock` attribute. From what I saw, this is the processor's current speed. The only info I found, backing this up is here: https://comp.os.linux.powerpc.narkive.com/LKZEgCMF/proc-cpuinfo.

On Facter 4, for both architectures, the speed is read from /proc/cpuinfo, the `clock` and `cpu MHz` attributes. They both represent the actual processor frequency, not the maximum frequency.

The Facter documentation states that `processor.speed` is the processor speed. So we don't know if that's the current or the maximum speed.

In conclusion, I think that the Facter 4's implementation is the best because it's consistent, offering the actual speed for both architectures.

Josh Cooper (Jira)

unread,
Apr 1, 2021, 12:57:02 PM4/1/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug FACT-2980

I think the intent is to report on the maximum speed, especially given the comment in https://github.com/puppetlabs/facter/blob/ce1f2bb4a91a1ac4ae5852091c96ae6ee3712e23/lib/src/facts/linux/processor_resolver.cc#L190.

Interestingly Windows processor speed is omitted, but is included in the model description:

C:\> facter processors
{
  count => 2,
  isa => "x64",
  models => [
    "Intel(R) Xeon(R) CPU E5-2697 v4 @ 2.30GHz",
    "Intel(R) Xeon(R) CPU E5-2697 v4 @ 2.30GHz"
  ],
  physicalcount => 2
}

Claire Cadman (Jira)

unread,
Apr 16, 2021, 5:43:02 AM4/16/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
 
Change By: Claire Cadman
Labels: doc_reviewed
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Claire Cadman (Jira)

unread,
Apr 16, 2021, 5:44:02 AM4/16/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
Change By: Claire Cadman
Labels: doc_reviewed known-issue-added

Josh Cooper (Jira)

unread,
Apr 21, 2022, 1:11:01 PM4/21/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Component/s: Facter 4
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Josh Cooper (Jira)

unread,
Jan 9, 2023, 1:00:02 PM1/9/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Labels: doc_reviewed known-issue-added regression
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Jan 9, 2023, 3:03:01 PM1/9/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 24, 2023, 2:31:02 PM4/24/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages