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