Bug 165893 - [kernel] [request] processor topology should be exported in more obvious format
Summary: [kernel] [request] processor topology should be exported in more obvious format
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-09 21:40 UTC by wollman
Modified: 2019-07-18 11:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wollman 2012-03-09 21:40:06 UTC
Currently, the sysctl variable hw.ncpu gives the number of logical
processors.  kern.sched.topology_spec gives a hard-to-parse XML
description of the system topology (is this ULE-only or 4BSD as
well?).  Grepping /var/run/dmesg.boot will tell you the number of
sockets, cores, and threads without having to parse XML.  It would be
preferable if these values were reflected in sysctl variables (in,
take your pick, the kern.sched, hw, machdep, or dev.cpu tree) so
programs don't have to parse XML or depend on being able to read
dmesg.boot.

Fix: 

Sprinkle some SYSCTL_RDINT() macros into ${ARCH}/mp_machdep.c.
Comment 1 Andriy Gapon 2012-03-09 22:32:06 UTC
OTOH, it would probably also make sense to not assume that a topology is always
uniform.  There could be a different number of (online) cores per package, etc.

BTW, you can try to use devel/hwloc (http://www.open-mpi.org/projects/hwloc/) -
it provides convenience and portability.

But I agree that this is a valid PR as our kernel could do a better job at
providing topological information to userland in more ready form.

-- 
Andriy Gapon
Comment 2 wollman 2012-03-09 23:10:22 UTC
<<On Sat, 10 Mar 2012 00:32:06 +0200, Andriy Gapon <avg@icyb.net.ua> said:

> OTOH, it would probably also make sense to not assume that a topology is always
> uniform.  There could be a different number of (online) cores per package, etc.

At a minimum, having separate "processors", "cores", and "threads"
sysctl variables would ease hardware identification, and there's no
need to assume that they are uniform in order to make use of this.

-GAWollman
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:57 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped