summaryrefslogtreecommitdiff
path: root/static/freebsd/man4/smp.4 3.html
blob: 9fdd1f8bd71afc49dbb39e4dcff2bec0530f6df2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<table class="head">
  <tr>
    <td class="head-ltitle">SMP(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">SMP(4)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">SMP</code> &#x2014; <span class="Nd">description
    of the FreeBSD Symmetric Multi-Processor kernel</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">options SMP</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">SMP</code> kernel implements symmetric
    multi-processor support.</p>
<p class="Pp"><code class="Nm">SMP</code> support can be disabled by setting the
    loader tunable <var class="Va">kern.smp.disabled</var> to 1.</p>
<p class="Pp">The number of CPUs detected by the system is available in the
    read-only sysctl variable <var class="Va">hw.ncpu</var>.</p>
<p class="Pp">The number of online threads per CPU core is available in the
    read-only sysctl variable <var class="Va">kern.smp.threads_per_core</var>.
    The number of physical CPU cores detected by the system is available in the
    read-only sysctl variable <var class="Va">kern.smp.cores</var>.</p>
<p class="Pp"><span class="Ux">FreeBSD</span> allows specific CPUs on a
    multi-processor system to be disabled. This can be done using the
    <var class="Va">hint.lapic.X.disabled</var> tunable, where X is the APIC ID
    of a CPU. Setting this tunable to 1 will result in the corresponding CPU
    being disabled.</p>
<p class="Pp"><span class="Ux">FreeBSD</span> supports simultaneous
    multithreading on x86 and powerpc platforms. On x86, the logical CPUs can be
    disabled by setting the <var class="Va">machdep.hyperthreading_allowed</var>
    tunable to zero.</p>
<p class="Pp">The <a class="Xr">sched_ule(4)</a> scheduler implements CPU
    topology detection and adjusts the scheduling algorithms to make better use
    of modern multi-core CPUs. The sysctl variable
    <var class="Va">kern.sched.topology_spec</var> reflects the detected CPU
    hardware in a parsable XML format. The top level XML tag is &lt;groups&gt;,
    which encloses one or more &lt;group&gt; tags containing data about
    individual CPU groups. A CPU group contains CPUs that are detected to be
    &quot;close&quot; together, usually by being cores in a single multi-core
    processor. Attributes available in a &lt;group&gt; tag are
    &quot;level&quot;, corresponding to the nesting level of the CPU group and
    &quot;cache-level&quot;, corresponding to the level of CPU caches shared by
    the CPUs in the group. The &lt;group&gt; tag contains the &lt;cpu&gt; and
    &lt;flags&gt; tags. The &lt;cpu&gt; tag describes CPUs in the group. Its
    attributes are &quot;count&quot;, corresponding to the number of CPUs in the
    group and &quot;mask&quot;, corresponding to the integer binary mask in
    which each bit position set to 1 signifies a CPU belonging to the group. The
    contents (CDATA) of the &lt;cpu&gt; tag is the comma-delimited list of CPU
    indexes (derived from the &quot;mask&quot; attribute). The &lt;flags&gt; tag
    contains special tags (if any) describing the relation of the CPUs in the
    group. The possible flags are currently &quot;HTT&quot; and &quot;SMT&quot;,
    corresponding to the various implementations of hardware multithreading. An
    example topology_spec output for a system consisting of two quad-core
    processors is:</p>
<div class="Bd Pp Li">
<pre>&lt;groups&gt;
  &lt;group level=&quot;1&quot; cache-level=&quot;0&quot;&gt;
    &lt;cpu count=&quot;8&quot; mask=&quot;0xff&quot;&gt;0, 1, 2, 3, 4, 5, 6, 7&lt;/cpu&gt;
    &lt;flags&gt;&lt;/flags&gt;
    &lt;children&gt;
      &lt;group level=&quot;2&quot; cache-level=&quot;0&quot;&gt;
        &lt;cpu count=&quot;4&quot; mask=&quot;0xf&quot;&gt;0, 1, 2, 3&lt;/cpu&gt;
        &lt;flags&gt;&lt;/flags&gt;
      &lt;/group&gt;
      &lt;group level=&quot;2&quot; cache-level=&quot;0&quot;&gt;
        &lt;cpu count=&quot;4&quot; mask=&quot;0xf0&quot;&gt;4, 5, 6, 7&lt;/cpu&gt;
        &lt;flags&gt;&lt;/flags&gt;
      &lt;/group&gt;
    &lt;/children&gt;
  &lt;/group&gt;
&lt;/groups&gt;</pre>
</div>
<p class="Pp">This information is used internally by the kernel to schedule
    related tasks on CPUs that are closely grouped together.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="COMPATIBILITY"><a class="permalink" href="#COMPATIBILITY">COMPATIBILITY</a></h1>
<p class="Pp">Support for multi-processor systems is present for all Tier-1 and
    Tier-2 architectures on <span class="Ux">FreeBSD</span>. Currently, this
    includes x86, powerpc, mips, arm and arm64. Support is enabled using
    <code class="Cd">options SMP</code>. It is permissible to use the SMP kernel
    configuration on non-SMP hardware.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="I386_NOTES"><a class="permalink" href="#I386_NOTES">I386
  NOTES</a></h1>
<p class="Pp">For i386 systems, the <code class="Nm">SMP</code> kernel supports
    motherboards that follow the Intel MP specification, version 1.4. In
    addition to <code class="Cd">options SMP</code>, i386 also requires
    <code class="Cd">device apic</code>. The <a class="Xr">mptable(1)</a>
    command may be used to view the status of multi-processor support.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">cpuset(1)</a>, <a class="Xr">mptable(1)</a>,
    <a class="Xr">sched_4bsd(4)</a>, <a class="Xr">sched_ule(4)</a>,
    <a class="Xr">loader(8)</a>, <a class="Xr">sysctl(8)</a>,
    <a class="Xr">condvar(9)</a>, <a class="Xr">msleep(9)</a>,
    <a class="Xr">mtx_pool(9)</a>, <a class="Xr">mutex(9)</a>,
    <a class="Xr">rwlock(9)</a>, <a class="Xr">sema(9)</a>,
    <a class="Xr">sx(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">SMP</code> kernel's early history is not
    (properly) recorded. It was developed in a separate CVS branch until April
    26, 1997, at which point it was merged into 3.0-current. By this date
    3.0-current had already been merged with Lite2 kernel code.</p>
<p class="Pp"><span class="Ux">FreeBSD 5.0</span> introduced support for a host
    of new synchronization primitives, and a move towards fine-grained kernel
    locking rather than reliance on a Giant kernel lock. The SMPng Project
    relied heavily on the support of BSDi, who provided reference source code
    from the fine-grained SMP implementation found in
    <span class="Ux">BSD/OS</span>.</p>
<p class="Pp"><span class="Ux">FreeBSD 5.0</span> also introduced support for
    SMP on the sparc64 architecture.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><span class="An">Steve Passe</span>
    &lt;<a class="Mt" href="mailto:fsmp@FreeBSD.org">fsmp@FreeBSD.org</a>&gt;</p>
</section>
<section class="Sh">
<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1>
<p class="Pp">The <var class="Va">kern.smp.threads_per_core</var> and
    <var class="Va">kern.smp.cores</var> sysctl variables are provided as a
    best-effort guess. If an architecture or platform adds SMT and
    <span class="Ux">FreeBSD</span> has not yet implemented detection, the
    reported values may be inaccurate. In this case,
    <var class="Va">kern.smp.threads_per_core</var> will report
    <code class="Dv">1</code> and <var class="Va">kern.smp.cores</var> will
    report the same value as <var class="Va">hw.ncpu</var>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">January 4, 2019</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>