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