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