159243Sobrien# SPDX-License-Identifier: GPL-2.0-only
259243Sobrien#
359243Sobrien# Timer subsystem related configuration options
459243Sobrien#
559243Sobrien
659243Sobrien# Options selectable by arch Kconfig
759243Sobrien
859243Sobrien# Watchdog function for clocksources to detect instabilities
959243Sobrienconfig CLOCKSOURCE_WATCHDOG
1059243Sobrien	bool
1159243Sobrien
1259243Sobrien# Architecture has extra clocksource data
1359243Sobrienconfig ARCH_CLOCKSOURCE_DATA
1459243Sobrien	bool
1559243Sobrien
1659243Sobrien# Architecture has extra clocksource init called from registration
1759243Sobrienconfig ARCH_CLOCKSOURCE_INIT
1859243Sobrien	bool
19100616Smp
2059243Sobrien# Clocksources require validation of the clocksource against the last
2159243Sobrien# cycle update - x86/TSC misfeature
2259243Sobrienconfig CLOCKSOURCE_VALIDATE_LAST_CYCLE
2359243Sobrien	bool
2459243Sobrien
2559243Sobrien# Timekeeping vsyscall support
2659243Sobrienconfig GENERIC_TIME_VSYSCALL
2759243Sobrien	bool
2859243Sobrien
2959243Sobrien# The generic clock events infrastructure
3059243Sobrienconfig GENERIC_CLOCKEVENTS
3159243Sobrien	def_bool !LEGACY_TIMER_TICK
3259243Sobrien
3359243Sobrien# Architecture can handle broadcast in a driver-agnostic way
3459243Sobrienconfig ARCH_HAS_TICK_BROADCAST
3559243Sobrien	bool
3659243Sobrien
3759243Sobrien# Clockevents broadcasting infrastructure
3859243Sobrienconfig GENERIC_CLOCKEVENTS_BROADCAST
3959243Sobrien	bool
4059243Sobrien	depends on GENERIC_CLOCKEVENTS
41167465Smp
42167465Smp# Handle broadcast in default_idle_call()
43167465Smpconfig GENERIC_CLOCKEVENTS_BROADCAST_IDLE
4459243Sobrien	bool
45167465Smp	depends on GENERIC_CLOCKEVENTS_BROADCAST
4659243Sobrien
4759243Sobrien# Automatically adjust the min. reprogramming time for
4859243Sobrien# clock event device
4959243Sobrienconfig GENERIC_CLOCKEVENTS_MIN_ADJUST
50167465Smp	bool
5159243Sobrien
52167465Smp# Generic update of CMOS clock
5359243Sobrienconfig GENERIC_CMOS_UPDATE
54167465Smp	bool
55167465Smp
56167465Smp# Select to handle posix CPU timers from task_work
5759243Sobrien# and not from the timer interrupt context
5859243Sobrienconfig HAVE_POSIX_CPU_TIMERS_TASK_WORK
59167465Smp	bool
60167465Smp
6159243Sobrienconfig POSIX_CPU_TIMERS_TASK_WORK
6259243Sobrien	bool
63167465Smp	default y if POSIX_TIMERS && HAVE_POSIX_CPU_TIMERS_TASK_WORK
6459243Sobrien
6559243Sobrienconfig LEGACY_TIMER_TICK
6659243Sobrien	bool
6759243Sobrien	help
6859243Sobrien	  The legacy timer tick helper is used by platforms that
69167465Smp	  lack support for the generic clockevent framework.
70167465Smp	  New platforms should use generic clockevents instead.
7159243Sobrien
72167465Smpconfig TIME_KUNIT_TEST
7359243Sobrien	tristate "KUnit test for kernel/time functions" if !KUNIT_ALL_TESTS
7459243Sobrien	depends on KUNIT
7559243Sobrien	default KUNIT_ALL_TESTS
76167465Smp	help
7759243Sobrien	  Enable this option to test RTC library functions.
7859243Sobrien
79167465Smp	  If unsure, say N.
8059243Sobrien
8159243Sobrienconfig CONTEXT_TRACKING
82167465Smp	bool
8359243Sobrien
8459243Sobrienconfig CONTEXT_TRACKING_IDLE
8559243Sobrien	bool
86167465Smp	select CONTEXT_TRACKING
87167465Smp	help
88167465Smp	  Tracks idle state on behalf of RCU.
89167465Smp
9059243Sobrienif GENERIC_CLOCKEVENTS
9159243Sobrienmenu "Timers subsystem"
9259243Sobrien
9359243Sobrien# Core internal switch. Selected by NO_HZ_COMMON / HIGH_RES_TIMERS. This is
9459243Sobrien# only related to the tick functionality. Oneshot clockevent devices
9559243Sobrien# are supported independent of this.
96167465Smpconfig TICK_ONESHOT
97167465Smp	bool
98167465Smp
99167465Smpconfig NO_HZ_COMMON
10059243Sobrien	bool
10159243Sobrien	select TICK_ONESHOT
102167465Smp
103167465Smpchoice
104167465Smp	prompt "Timer tick handling"
10559243Sobrien	default NO_HZ_IDLE if NO_HZ
10659243Sobrien
10759243Sobrienconfig HZ_PERIODIC
10859243Sobrien	bool "Periodic timer ticks (constant rate, no dynticks)"
10959243Sobrien	help
11059243Sobrien	  This option keeps the tick running periodically at a constant
11159243Sobrien	  rate, even when the CPU doesn't need it.
11259243Sobrien
11359243Sobrienconfig NO_HZ_IDLE
11459243Sobrien	bool "Idle dynticks system (tickless idle)"
11559243Sobrien	select NO_HZ_COMMON
11659243Sobrien	help
117167465Smp	  This option enables a tickless idle system: timer interrupts
118167465Smp	  will only trigger on an as-needed basis when the system is idle.
119167465Smp	  This is usually interesting for energy saving.
120167465Smp
121167465Smp	  Most of the time you want to say Y here.
12259243Sobrien
123167465Smpconfig NO_HZ_FULL
124167465Smp	bool "Full dynticks system (tickless)"
125167465Smp	# NO_HZ_COMMON dependency
126167465Smp	# We need at least one periodic CPU for timekeeping
12759243Sobrien	depends on SMP
12859243Sobrien	depends on HAVE_CONTEXT_TRACKING_USER
12959243Sobrien	# VIRT_CPU_ACCOUNTING_GEN dependency
130167465Smp	depends on HAVE_VIRT_CPU_ACCOUNTING_GEN
131167465Smp	select NO_HZ_COMMON
132167465Smp	select RCU_NOCB_CPU
133167465Smp	select VIRT_CPU_ACCOUNTING_GEN
134167465Smp	select IRQ_WORK
13559243Sobrien	select CPU_ISOLATION
136167465Smp	help
137167465Smp	 Adaptively try to shutdown the tick whenever possible, even when
138167465Smp	 the CPU is running tasks. Typically this requires running a single
139167465Smp	 task on the CPU. Chances for running tickless are maximized when
140167465Smp	 the task mostly runs in userspace and has few kernel activity.
141167465Smp
142167465Smp	 You need to fill up the nohz_full boot parameter with the
143167465Smp	 desired range of dynticks CPUs to use it. This is implemented at
144167465Smp	 the expense of some overhead in user <-> kernel transitions:
145167465Smp	 syscalls, exceptions and interrupts.
146167465Smp
14759243Sobrien	 By default, without passing the nohz_full parameter, this behaves just
14859243Sobrien	 like NO_HZ_IDLE.
14959243Sobrien
15059243Sobrien	 If you're a distro say Y.
15159243Sobrien
15259243Sobrienendchoice
15359243Sobrien
15459243Sobrienconfig CONTEXT_TRACKING_USER
15559243Sobrien	bool
156167465Smp	depends on HAVE_CONTEXT_TRACKING_USER
15759243Sobrien	select CONTEXT_TRACKING
15859243Sobrien	help
159167465Smp	  Track transitions between kernel and user on behalf of RCU and
16059243Sobrien	  tickless cputime accounting. The former case relies on context
161167465Smp	  tracking to enter/exit RCU extended quiescent states.
16259243Sobrien
16359415Sobrienconfig CONTEXT_TRACKING_USER_FORCE
16459243Sobrien	bool "Force user context tracking"
165167465Smp	depends on CONTEXT_TRACKING_USER
16659243Sobrien	default y if !NO_HZ_FULL
16759243Sobrien	help
16859243Sobrien	  The major pre-requirement for full dynticks to work is to
16959243Sobrien	  support the user context tracking subsystem. But there are also
17059243Sobrien	  other dependencies to provide in order to make the full
17159243Sobrien	  dynticks working.
17259243Sobrien
17359243Sobrien	  This option stands for testing when an arch implements the
17459243Sobrien	  user context tracking backend but doesn't yet fulfill all the
17559243Sobrien	  requirements to make the full dynticks feature working.
17659243Sobrien	  Without the full dynticks, there is no way to test the support
17759243Sobrien	  for user context tracking and the subsystems that rely on it: RCU
17859243Sobrien	  userspace extended quiescent state and tickless cputime
17959243Sobrien	  accounting. This option copes with the absence of the full
180167465Smp	  dynticks subsystem by forcing the user context tracking on all
18159243Sobrien	  CPUs in the system.
18259243Sobrien
18359243Sobrien	  Say Y only if you're working on the development of an
18459243Sobrien	  architecture backend for the user context tracking.
18559243Sobrien
18659243Sobrien	  Say N otherwise, this option brings an overhead that you
18759243Sobrien	  don't want in production.
18859243Sobrien
18959243Sobrienconfig NO_HZ
19059243Sobrien	bool "Old Idle dynticks config"
19159243Sobrien	help
19259243Sobrien	  This is the old config entry that enables dynticks idle.
19359243Sobrien	  We keep it around for a little while to enforce backward
19459243Sobrien	  compatibility with older config files.
19559243Sobrien
19659243Sobrienconfig HIGH_RES_TIMERS
19759243Sobrien	bool "High Resolution Timer Support"
19859243Sobrien	select TICK_ONESHOT
19959243Sobrien	help
200167465Smp	  This option enables high resolution timer support. If your
20159243Sobrien	  hardware is not capable then this option only increases
20259243Sobrien	  the size of the kernel image.
20359243Sobrien
20459243Sobrienconfig CLOCKSOURCE_WATCHDOG_MAX_SKEW_US
20559243Sobrien	int "Clocksource watchdog maximum allowable skew (in ��s)"
206	depends on CLOCKSOURCE_WATCHDOG
207	range 50 1000
208	default 125
209	help
210	  Specify the maximum amount of allowable watchdog skew in
211	  microseconds before reporting the clocksource to be unstable.
212	  The default is based on a half-second clocksource watchdog
213	  interval and NTP's maximum frequency drift of 500 parts
214	  per million.	If the clocksource is good enough for NTP,
215	  it is good enough for the clocksource watchdog!
216
217endmenu
218endif
219