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