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