xref: /linux/kernel/time/Kconfig (revision cd38bdb8e696a1a1eb12fc6662a6e420977aacfd)
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# Timer subsystem related configuration options
4#
5
6# Options selectable by arch Kconfig
7
8# Watchdog function for clocksources to detect instabilities
9config CLOCKSOURCE_WATCHDOG
10	bool
11
12# Architecture has extra clocksource data
13config ARCH_CLOCKSOURCE_DATA
14	bool
15
16# Architecture has extra clocksource init called from registration
17config ARCH_CLOCKSOURCE_INIT
18	bool
19
20config ARCH_WANTS_CLOCKSOURCE_READ_INLINE
21	bool
22
23# Timekeeping vsyscall support
24config GENERIC_TIME_VSYSCALL
25	bool
26
27# The generic clock events infrastructure
28config GENERIC_CLOCKEVENTS
29	def_bool !LEGACY_TIMER_TICK
30
31# Architecture can handle broadcast in a driver-agnostic way
32config ARCH_HAS_TICK_BROADCAST
33	bool
34
35# Clockevents broadcasting infrastructure
36config GENERIC_CLOCKEVENTS_BROADCAST
37	bool
38	depends on GENERIC_CLOCKEVENTS
39
40# Handle broadcast in default_idle_call()
41config GENERIC_CLOCKEVENTS_BROADCAST_IDLE
42	bool
43	depends on GENERIC_CLOCKEVENTS_BROADCAST
44
45# Automatically adjust the min. reprogramming time for
46# clock event device
47config GENERIC_CLOCKEVENTS_MIN_ADJUST
48	bool
49
50config GENERIC_CLOCKEVENTS_COUPLED
51	bool
52
53# Generic update of CMOS clock
54config GENERIC_CMOS_UPDATE
55	bool
56
57# Select to handle posix CPU timers from task_work
58# and not from the timer interrupt context
59config HAVE_POSIX_CPU_TIMERS_TASK_WORK
60	bool
61
62config POSIX_CPU_TIMERS_TASK_WORK
63	bool
64	default y if POSIX_TIMERS && HAVE_POSIX_CPU_TIMERS_TASK_WORK
65
66config LEGACY_TIMER_TICK
67	bool
68	help
69	  The legacy timer tick helper is used by platforms that
70	  lack support for the generic clockevent framework.
71	  New platforms should use generic clockevents instead.
72
73config TIME_KUNIT_TEST
74	tristate "KUnit test for kernel/time functions" if !KUNIT_ALL_TESTS
75	depends on KUNIT
76	default KUNIT_ALL_TESTS
77	help
78	  Enable this option to test RTC library functions.
79
80	  If unsure, say N.
81
82config CONTEXT_TRACKING
83	bool
84
85config CONTEXT_TRACKING_IDLE
86	bool
87	select CONTEXT_TRACKING
88	help
89	  Tracks idle state on behalf of RCU.
90
91menu "Timers subsystem"
92
93if GENERIC_CLOCKEVENTS
94# Core internal switch. Selected by NO_HZ_COMMON / HIGH_RES_TIMERS. This is
95# only related to the tick functionality. Oneshot clockevent devices
96# are supported independent of this.
97config TICK_ONESHOT
98	bool
99
100config NO_HZ_COMMON
101	bool
102	select TICK_ONESHOT
103
104choice
105	prompt "Timer tick handling"
106	default NO_HZ_IDLE if NO_HZ
107
108config HZ_PERIODIC
109	bool "Periodic timer ticks (constant rate, no dynticks)"
110	help
111	  This option keeps the tick running periodically at a constant
112	  rate, even when the CPU doesn't need it.
113
114config NO_HZ_IDLE
115	bool "Idle dynticks system (tickless idle)"
116	select NO_HZ_COMMON
117	help
118	  This option enables a tickless idle system: timer interrupts
119	  will only trigger on an as-needed basis when the system is idle.
120	  This is usually interesting for energy saving.
121
122	  Most of the time you want to say Y here.
123
124config NO_HZ_FULL
125	bool "Full dynticks system (tickless)"
126	# NO_HZ_COMMON dependency
127	# We need at least one periodic CPU for timekeeping
128	depends on SMP
129	depends on HAVE_CONTEXT_TRACKING_USER
130	# VIRT_CPU_ACCOUNTING_GEN dependency
131	depends on HAVE_VIRT_CPU_ACCOUNTING_GEN
132	select NO_HZ_COMMON
133	select RCU_NOCB_CPU
134	select VIRT_CPU_ACCOUNTING_GEN
135	select IRQ_WORK
136	select CPU_ISOLATION
137	help
138	 Adaptively try to shutdown the tick whenever possible, even when
139	 the CPU is running tasks. Typically this requires running a single
140	 task on the CPU. Chances for running tickless are maximized when
141	 the task mostly runs in userspace and has few kernel activity.
142
143	 You need to fill up the nohz_full boot parameter with the
144	 desired range of dynticks CPUs to use it. This is implemented at
145	 the expense of some overhead in user <-> kernel transitions:
146	 syscalls, exceptions and interrupts.
147
148	 By default, without passing the nohz_full parameter, this behaves just
149	 like NO_HZ_IDLE.
150
151	 If you're a distro say Y.
152
153endchoice
154
155config CONTEXT_TRACKING_USER
156	bool
157	depends on HAVE_CONTEXT_TRACKING_USER
158	select CONTEXT_TRACKING
159	help
160	  Track transitions between kernel and user on behalf of RCU and
161	  tickless cputime accounting. The former case relies on context
162	  tracking to enter/exit RCU extended quiescent states.
163
164config CONTEXT_TRACKING_USER_FORCE
165	bool "Force user context tracking"
166	depends on CONTEXT_TRACKING_USER
167	default y if !NO_HZ_FULL
168	help
169	  The major pre-requirement for full dynticks to work is to
170	  support the user context tracking subsystem. But there are also
171	  other dependencies to provide in order to make the full
172	  dynticks working.
173
174	  This option stands for testing when an arch implements the
175	  user context tracking backend but doesn't yet fulfill all the
176	  requirements to make the full dynticks feature working.
177	  Without the full dynticks, there is no way to test the support
178	  for user context tracking and the subsystems that rely on it: RCU
179	  userspace extended quiescent state and tickless cputime
180	  accounting. This option copes with the absence of the full
181	  dynticks subsystem by forcing the user context tracking on all
182	  CPUs in the system.
183
184	  Say Y only if you're working on the development of an
185	  architecture backend for the user context tracking.
186
187	  Say N otherwise, this option brings an overhead that you
188	  don't want in production.
189
190config NO_HZ
191	bool "Old Idle dynticks config"
192	help
193	  This is the old config entry that enables dynticks idle.
194	  We keep it around for a little while to enforce backward
195	  compatibility with older config files.
196
197config HIGH_RES_TIMERS
198	bool "High Resolution Timer Support"
199	select TICK_ONESHOT
200	help
201	  This option enables high resolution timer support. If your
202	  hardware is not capable then this option only increases
203	  the size of the kernel image.
204
205config CLOCKSOURCE_WATCHDOG_MAX_SKEW_US
206	int "Clocksource watchdog maximum allowable skew (in microseconds)"
207	depends on CLOCKSOURCE_WATCHDOG
208	range 50 1000
209	default 125
210	help
211	  Specify the maximum amount of allowable watchdog skew in
212	  microseconds before reporting the clocksource to be unstable.
213	  The default is based on a half-second clocksource watchdog
214	  interval and NTP's maximum frequency drift of 500 parts
215	  per million.	If the clocksource is good enough for NTP,
216	  it is good enough for the clocksource watchdog!
217endif
218
219config POSIX_AUX_CLOCKS
220	bool "Enable auxiliary POSIX clocks"
221	depends on POSIX_TIMERS
222	help
223	  Auxiliary POSIX clocks are clocks which can be steered
224	  independently of the core timekeeper, which controls the
225	  MONOTONIC, REALTIME, BOOTTIME and TAI clocks.  They are useful to
226	  provide e.g. lockless time accessors to independent PTP clocks
227	  and other clock domains, which are not correlated to the TAI/NTP
228	  notion of time.
229
230endmenu
231