Solaris processor count facts - bug or feature?

199 views
Skip to first unread message

Alex Harvey

unread,
Nov 19, 2012, 8:02:21 PM11/19/12
to puppet...@googlegroups.com
Hi all,

This relates to a discussion we are having in the Redmine ticket https://projects.puppetlabs.com/issues/11612.

I am extending the processorcount, physicalprocessorcount and processorX facts that exist for Linux and Solaris.

I personally find the behaviour of the processor facts on Solaris surprising -

myhost# facter |grep proc
physicalprocessorcount => 1
processor0 => SPARC64-VII
processor1 => SPARC64-VII
processor2 => SPARC64-VII
processor3 => SPARC64-VII
processor4 => SPARC64-VII
processor5 => SPARC64-VII
processor6 => SPARC64-VII
processor7 => SPARC64-VII
processorcount => 4

We can see that physicalprocessorcount is returning the number of physical CPUs which is good, the processorX array is getting populated with virtual CPUs, and processorcount is returning the number of cores.  The command used to set processorcount is essentially kstat cpu_info |grep core_id |sort -u.

However, I suspect Solaris sysadmins are more familiar with using commands like psrinfo, prtdiag, and mpstat to get CPU count, and these all report the number of CPUs as 8 rather than 4.

If I was writing this from scratch I would have a fact called something like ProcessorCoreCount and have that report 4 and then a separate fact ProcessorCount that would report 8 - as psrinfo is doing.

Therefore I am interested to know if others out there regard this behaviour as a 'bug or feature', and also get some feedback on how people are using these facts out there.

Thanks in advance.

Best regards,
Alex Harvey

Alex Harvey

unread,
Dec 2, 2012, 9:03:25 PM12/2/12
to puppet...@googlegroups.com

There were no responses here - I'd like to bump this up for a second go at getting some responses. 

Alex Harvey

unread,
Dec 4, 2012, 11:37:19 PM12/4/12
to puppet...@googlegroups.com


On Monday, December 3, 2012 9:54:49 PM UTC+11, Andrew Beresford wrote:
Feature :)
 
I do understand what the code is doing but question whether that's what it should be doing.  While it's ultimately a matter of opinion, it violates the 'principle of least surprise' for me and also my Solaris colleagues.

At any rate, I finally managed to find a multi-core linux box I could try this on and have confirmed that the associated linux facts behave in the way I would have expected them to on Solaris -

physicalprocessorcount => 1
processor0 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor1 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor2 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor3 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor4 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor5 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor6 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processor7 => Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
processorcount => 8

This is a 4-core CPU with 8 threads. 

See the spec for the i7-2600
http://ark.intel.com/products/52213

So I do think the Solaris behaviour is in error.

Maybe we need a 'processorcorecount' fact instead?

Andrew Beresford

unread,
Dec 5, 2012, 10:18:22 AM12/5/12
to puppet...@googlegroups.com
Apologies, 

I re-read your post and understand what you mean.

I prefer the core count definition, but whatever it is, it should be consistent between Linux and Solaris. 

Andrew

Alex Harvey

unread,
Dec 6, 2012, 7:58:55 PM12/6/12
to puppet...@googlegroups.com

I prefer the core count definition, but whatever it is, it should be consistent between Linux and Solaris.

Yes it certainly should be the same on all platforms - the question is if we change it who is going to be impacted and how can we manage the change?  I believe the vast majority of Puppet users run linux so probably the Solaris code needs to be changed to conform to the linux rather than vice versa.  Unless lots of people think the linux fact is in fact the one that's 'wrong'?

Andrew Beresford

unread,
Dec 7, 2012, 5:05:32 AM12/7/12
to puppet...@googlegroups.com
How about creating a processorcorecount and processorthreadcount with
"correct" meanings? That then leaves the option to deprecate
processorcount.

I've realised that at some point in the past I have created a
processorthreadcount fact because I needed a consistent source of this
information on both Solaris and Linux.
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/zZSTUqGrMRAJ.
>
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

Alex Harvey

unread,
Dec 9, 2012, 8:12:53 AM12/9/12
to puppet...@googlegroups.com


On Friday, December 7, 2012 9:05:32 PM UTC+11, Andrew Beresford wrote:
How about creating a processorcorecount and processorthreadcount with
"correct" meanings? That then leaves the option to deprecate
processorcount.

I've realised that at some point in the past I have created a
processorthreadcount fact because I needed a consistent source of this
information on both Solaris and Linux.

I'm not sure - certainly I'd agree those would be good names for the facts if we were starting again (and should the 'processorX' facts be renamed as well)?  I think for the moment I'm just going to implement the HP-UX facts to work the same way as the linux facts and create a thread on the puppet developers list to see what others think should be done about this cores vs threads connundrum. 

Jakov Sosic

unread,
Dec 11, 2012, 7:53:28 PM12/11/12
to puppet...@googlegroups.com
On 12/07/2012 11:05 AM, Andrew Beresford wrote:
> How about creating a processorcorecount and processorthreadcount with
> "correct" meanings? That then leaves the option to deprecate
> processorcount.
>
> I've realised that at some point in the past I have created a
> processorthreadcount fact because I needed a consistent source of this
> information on both Solaris and Linux.

+1


--
Jakov Sosic
www.srce.unizg.hr
Reply all
Reply to author
Forward
0 new messages