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