Commit a941a034 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers-core-2021-06-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer updates from Thomas Gleixner:
 "Time and clocksource/clockevent related updates:

  Core changes:

   - Infrastructure to support per CPU "broadcast" devices for per CPU
     clockevent devices which stop in deep idle states. This allows us
     to utilize the more efficient architected timer on certain ARM SoCs
     for normal operation instead of permanentely using the slow to
     access SoC specific clockevent device.

   - Print the name of the broadcast/wakeup device in /proc/timer_list

   - Make the clocksource watchdog more robust against delays between
     reading the current active clocksource and the watchdog
     clocksource. Such delays can be caused by NMIs, SMIs and vCPU
     preemption.

     Handle this by reading the watchdog clocksource twice, i.e. before
     and after reading the current active clocksource. In case that the
     two watchdog reads shows an excessive time delta, the read sequence
     is repeated up to 3 times.

   - Improve the debug output and add a test module for the watchdog
     mechanism.

   - Reimplementation of the venerable time64_to_tm() function with a
     faster and significantly smaller version. Straight from the source,
     i.e. the author of the related research paper contributed this!

  Driver changes:

   - No new drivers, not even new device tree bindings!

   - Fixes, improvements and cleanups and all over the place"

* tag 'timers-core-2021-06-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
  time/kunit: Add missing MODULE_LICENSE()
  time: Improve performance of time64_to_tm()
  clockevents: Use list_move() instead of list_del()/list_add()
  clocksource: Print deviation in nanoseconds when a clocksource becomes unstable
  clocksource: Provide kernel module to test clocksource watchdog
  clocksource: Reduce clocksource-skew threshold
  clocksource: Limit number of CPUs checked for clock synchronization
  clocksource: Check per-CPU clock synchronization when marked unstable
  clocksource: Retry clock read if long delays detected
  clockevents: Add missing parameter documentation
  clocksource/drivers/timer-ti-dm: Drop unnecessary restore
  clocksource/arm_arch_timer: Improve Allwinner A64 timer workaround
  clocksource/drivers/arm_global_timer: Remove duplicated argument in arm_global_timer
  clocksource/drivers/arm_global_timer: Make symbol 'gt_clk_rate_change_nb' static
  arm: zynq: don't disable CONFIG_ARM_GLOBAL_TIMER due to CONFIG_CPU_FREQ anymore
  clocksource/drivers/arm_global_timer: Implement rate compensation whenever source clock changes
  clocksource/drivers/ingenic: Rename unreasonable array names
  clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG
  clocksource/drivers/mediatek: Ack and disable interrupts on suspend
  clocksource/drivers/samsung_pwm: Constify source IO memory
  ...
parents 21edf509 2d0a9eb2
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -581,6 +581,28 @@
			loops can be debugged more effectively on production
			systems.

	clocksource.max_cswd_read_retries= [KNL]
			Number of clocksource_watchdog() retries due to
			external delays before the clock will be marked
			unstable.  Defaults to three retries, that is,
			four attempts to read the clock under test.

	clocksource.verify_n_cpus= [KNL]
			Limit the number of CPUs checked for clocksources
			marked with CLOCK_SOURCE_VERIFY_PERCPU that
			are marked unstable due to excessive skew.
			A negative value says to check all CPUs, while
			zero says not to check any.  Values larger than
			nr_cpu_ids are silently truncated to nr_cpu_ids.
			The actual CPUs are chosen randomly, with
			no replacement if the same CPU is chosen twice.

	clocksource-wdtest.holdoff= [KNL]
			Set the time in seconds that the clocksource
			watchdog test waits before commencing its tests.
			Defaults to zero when built as a module and to
			10 seconds when built into the kernel.

	clearcpuid=BITNUM[,BITNUM...] [X86]
			Disable CPUID feature X for the kernel. See
			arch/x86/include/asm/cpufeatures.h for the valid bit
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ config ARCH_ZYNQ
	select ARCH_SUPPORTS_BIG_ENDIAN
	select ARM_AMBA
	select ARM_GIC
	select ARM_GLOBAL_TIMER if !CPU_FREQ
	select ARM_GLOBAL_TIMER
	select CADENCE_TTC_TIMER
	select HAVE_ARM_SCU if SMP
	select HAVE_ARM_TWD if SMP
+3 −1
Original line number Diff line number Diff line
@@ -1128,6 +1128,7 @@ static int tsc_cs_enable(struct clocksource *cs)
static struct clocksource clocksource_tsc_early = {
	.name			= "tsc-early",
	.rating			= 299,
	.uncertainty_margin	= 32 * NSEC_PER_MSEC,
	.read			= read_tsc,
	.mask			= CLOCKSOURCE_MASK(64),
	.flags			= CLOCK_SOURCE_IS_CONTINUOUS |
@@ -1152,7 +1153,8 @@ static struct clocksource clocksource_tsc = {
	.mask			= CLOCKSOURCE_MASK(64),
	.flags			= CLOCK_SOURCE_IS_CONTINUOUS |
				  CLOCK_SOURCE_VALID_FOR_HRES |
				  CLOCK_SOURCE_MUST_VERIFY,
				  CLOCK_SOURCE_MUST_VERIFY |
				  CLOCK_SOURCE_VERIFY_PERCPU,
	.vdso_clock_mode	= VDSO_CLOCKMODE_TSC,
	.enable			= tsc_cs_enable,
	.resume			= tsc_resume,
+14 −0
Original line number Diff line number Diff line
@@ -358,6 +358,20 @@ config ARM_GLOBAL_TIMER
	help
	  This option enables support for the ARM global timer unit.

config ARM_GT_INITIAL_PRESCALER_VAL
	int "ARM global timer initial prescaler value"
	default 2 if ARCH_ZYNQ
	default 1
	depends on ARM_GLOBAL_TIMER
	help
	  When the ARM global timer initializes, its current rate is declared
	  to the kernel and maintained forever. Should it's parent clock
	  change, the driver tries to fix the timer's internal prescaler.
	  On some machs (i.e. Zynq) the initial prescaler value thus poses
	  bounds about how much the parent clock is allowed to decrease or
	  increase wrt the initial clock value.
	  This affects CPU_FREQ max delta from the initial frequency.

config ARM_TIMER_SP804
	bool "Support for Dual Timer SP804 module" if COMPILE_TEST
	depends on GENERIC_SCHED_CLOCK && CLKDEV_LOOKUP
+1 −2
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ struct arch_timer {
#define to_arch_timer(e) container_of(e, struct arch_timer, evt)

static u32 arch_timer_rate __ro_after_init;
u32 arch_timer_rate1 __ro_after_init;
static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI] __ro_after_init;

static const char *arch_timer_ppi_names[ARCH_TIMER_MAX_TIMER_PPI] = {
@@ -365,7 +364,7 @@ static u64 notrace arm64_858921_read_cntvct_el0(void)
	do {								\
		_val = read_sysreg(reg);				\
		_retries--;						\
	} while (((_val + 1) & GENMASK(9, 0)) <= 1 && _retries);	\
	} while (((_val + 1) & GENMASK(8, 0)) <= 1 && _retries);	\
									\
	WARN_ON_ONCE(!_retries);					\
	_val;								\
Loading