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