blob: ce4cc34381fcb2e95cd18ed9167f3ab8e358a0f6 (
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
|
<table class="head">
<tr>
<td class="head-ltitle">KVMCLOCK(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">KVMCLOCK(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">kvmclock</code> —
<span class="Nd">Para-virtualized clock driver for x86 KVM guests</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp">To compile this driver into the kernel, place the following line
in your kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">device kvm_clock</code></div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This driver reads time-keeping information from the
para-virtualized clock device provided by the KVM hypervisor on Linux hosts.
The <code class="Nm">kvmclock</code> driver is only implemented on i386 and
amd64 platforms. It acts as a <a class="Xr">timecounters(4)</a> device and
is preferred over the Time Stamp Counter (TSC) when available. The driver
exports timekeeping information via <span class="Pa">/dev/pvclock</span>,
enabling the implementation of <a class="Xr">clock_gettime(2)</a> and
related functions without entering the kernel.</p>
<p class="Pp">The <code class="Nm">kvmclock</code> driver works by accessing a
per-vCPU timekeeping structure maintained by the hypervisor. It uses a
combination of TSC readings and information from the shared structure to
produce a high-resolution timecounter which is invariant under hypervisor
events such as vCPU migration and live VM migration.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYSCTL_VARIABLES"><a class="permalink" href="#SYSCTL_VARIABLES">SYSCTL
VARIABLES</a></h1>
<p class="Pp">The following variables are available as both
<a class="Xr">sysctl(8)</a> variables and <a class="Xr">loader(8)</a>
tunables:</p>
<dl class="Bl-tag">
<dt id="dev.kvmclock.0.vdso_enable_without_rdtscp"><var class="Va">dev.kvmclock.0.vdso_enable_without_rdtscp</var></dt>
<dd>By default, timekeeping information is exported to userspace only when the
(virtual) CPU announces support for the “rdtscp”
instruction. Setting this sysctl to 1 overrides this behavior, allowing
timekeeping information to be exported even in the absence of
“rdtscp” support. However, this breaks compatibility with
copies of <span class="Pa">/lib/libc.so.7</span> released prior to
<span class="Ux">FreeBSD 14.0</span>, and statically linked binaries which
embed a copy of the system C library. Thus, this sysctl value should not
be changed if the system may execute binaries older than
<span class="Ux">FreeBSD 14.0</span>.</dd>
<dt id="dev.kvmclock.0.vdso_force_unstable"><var class="Va">dev.kvmclock.0.vdso_force_unstable</var></dt>
<dd>Mark the timecounter as unstable for userspace consumers. This is mostly
useful for debugging the driver and userspace timekeeping code, and
generally should not be touched.</dd>
</dl>
</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">timecounters(4)</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">kvmclock</code> driver first appeared in
<span class="Ux">FreeBSD 13.1</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">February 1, 2023</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|