xref: /linux/kernel/time/Kconfig (revision 3b4128b9f374b4219eb716f4ad8a307bc7eb3d84)
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 IRQ_WORK
137	select CPU_ISOLATION
138	help
139	 Adaptively try to shutdown the tick whenever possible, even when
140	 the CPU is running tasks. Typically this requires running a single
141	 task on the CPU. Chances for running tickless are maximized when
142	 the task mostly runs in userspace and has few kernel activity.
143
144	 You need to fill up the nohz_full boot parameter with the
145	 desired range of dynticks CPUs to use it. This is implemented at
146	 the expense of some overhead in user <-> kernel transitions:
147	 syscalls, exceptions and interrupts.
148
149	 By default, without passing the nohz_full parameter, this behaves just
150	 like NO_HZ_IDLE.
151
152	 If you're a distro say Y.
153
154endchoice
155
156config CONTEXT_TRACKING_USER
157	bool
158	depends on HAVE_CONTEXT_TRACKING_USER
159	select CONTEXT_TRACKING
160	help
161	  Track transitions between kernel and user on behalf of RCU and
162	  tickless cputime accounting. The former case relies on context
163	  tracking to enter/exit RCU extended quiescent states.
164
165config CONTEXT_TRACKING_USER_FORCE
166	bool "Force user context tracking"
167	depends on CONTEXT_TRACKING_USER
168	default y if !NO_HZ_FULL
169	help
170	  The major pre-requirement for full dynticks to work is to
171	  support the user context tracking subsystem. But there are also
172	  other dependencies to provide in order to make the full
173	  dynticks working.
174
175	  This option stands for testing when an arch implements the
176	  user context tracking backend but doesn't yet fulfill all the
177	  requirements to make the full dynticks feature working.
178	  Without the full dynticks, there is no way to test the support
179	  for user context tracking and the subsystems that rely on it: RCU
180	  userspace extended quiescent state and tickless cputime
181	  accounting. This option copes with the absence of the full
182	  dynticks subsystem by forcing the user context tracking on all
183	  CPUs in the system.
184
185	  Say Y only if you're working on the development of an
186	  architecture backend for the user context tracking.
187
188	  Say N otherwise, this option brings an overhead that you
189	  don't want in production.
190
191config NO_HZ
192	bool "Old Idle dynticks config"
193	help
194	  This is the old config entry that enables dynticks idle.
195	  We keep it around for a little while to enforce backward
196	  compatibility with older config files.
197
198config HIGH_RES_TIMERS
199	bool "High Resolution Timer Support"
200	select TICK_ONESHOT
201	help
202	  This option enables high resolution timer support. If your
203	  hardware is not capable then this option only increases
204	  the size of the kernel image.
205
206endif
207
208config POSIX_AUX_CLOCKS
209	bool "Enable auxiliary POSIX clocks"
210	depends on POSIX_TIMERS
211	help
212	  Auxiliary POSIX clocks are clocks which can be steered
213	  independently of the core timekeeper, which controls the
214	  MONOTONIC, REALTIME, BOOTTIME and TAI clocks.  They are useful to
215	  provide e.g. lockless time accessors to independent PTP clocks
216	  and other clock domains, which are not correlated to the TAI/NTP
217	  notion of time.
218
219endmenu
220