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