Skip to content

Commit e279160

Browse files
committed
Merge tag 'timers-core-2020-01-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "The timekeeping and timers departement provides: - Time namespace support: If a container migrates from one host to another then it expects that clocks based on MONOTONIC and BOOTTIME are not subject to disruption. Due to different boot time and non-suspended runtime these clocks can differ significantly on two hosts, in the worst case time goes backwards which is a violation of the POSIX requirements. The time namespace addresses this problem. It allows to set offsets for clock MONOTONIC and BOOTTIME once after creation and before tasks are associated with the namespace. These offsets are taken into account by timers and timekeeping including the VDSO. Offsets for wall clock based clocks (REALTIME/TAI) are not provided by this mechanism. While in theory possible, the overhead and code complexity would be immense and not justified by the esoteric potential use cases which were discussed at Plumbers '18. The overhead for tasks in the root namespace (ie where host time offsets = 0) is in the noise and great effort was made to ensure that especially in the VDSO. If time namespace is disabled in the kernel configuration the code is compiled out. Kudos to Andrei Vagin and Dmitry Sofanov who implemented this feature and kept on for more than a year addressing review comments, finding better solutions. A pleasant experience. - Overhaul of the alarmtimer device dependency handling to ensure that the init/suspend/resume ordering is correct. - A new clocksource/event driver for Microchip PIT64 - Suspend/resume support for the Hyper-V clocksource - The usual pile of fixes, updates and improvements mostly in the driver code" * tag 'timers-core-2020-01-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits) alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n alarmtimer: Use wakeup source from alarmtimer platform device alarmtimer: Make alarmtimer platform device child of RTC device alarmtimer: Update alarmtimer_get_rtcdev() docs to reflect reality hrtimer: Add missing sparse annotation for __run_timer() lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres() MIPS: vdso: Define BUILD_VDSO32 when building a 32bit kernel clocksource/drivers/hyper-v: Set TSC clocksource as default w/ InvariantTSC clocksource/drivers/hyper-v: Untangle stimers and timesync from clocksources clocksource/drivers/timer-microchip-pit64b: Fix sparse warning clocksource/drivers/exynos_mct: Rename Exynos to lowercase clocksource/drivers/timer-ti-dm: Fix uninitialized pointer access clocksource/drivers/timer-ti-dm: Switch to platform_get_irq clocksource/drivers/timer-ti-dm: Convert to devm_platform_ioremap_resource clocksource/drivers/em_sti: Fix variable declaration in em_sti_probe clocksource/drivers/em_sti: Convert to devm_platform_ioremap_resource clocksource/drivers/bcm2835_timer: Fix memory leak of timer clocksource/drivers/cadence-ttc: Use ttc driver as platform driver clocksource/drivers/timer-microchip-pit64b: Add Microchip PIT64B support clocksource/drivers/hyper-v: Reserve PAGE_SIZE space for tsc page ...
2 parents 534b0a8 + fd928f3 commit e279160

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3027
-270
lines changed

Documentation/devicetree/bindings/arm/atmel-sysregs.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ PIT Timer required properties:
1010
- interrupts: Should contain interrupt for the PIT which is the IRQ line
1111
shared across all System Controller members.
1212

13+
PIT64B Timer required properties:
14+
- compatible: Should be "microchip,sam9x60-pit64b"
15+
- reg: Should contain registers location and length
16+
- interrupts: Should contain interrupt for PIT64B timer
17+
- clocks: Should contain the available clock sources for PIT64B timer.
18+
1319
System Timer (ST) required properties:
1420
- compatible: Should be "atmel,at91rm9200-st", "syscon", "simple-mfd"
1521
- reg: Should contain registers location and length

Documentation/devicetree/bindings/timer/renesas,cmt.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Required Properties:
2929
- "renesas,r8a77470-cmt1" for the 48-bit CMT1 device included in r8a77470.
3030
- "renesas,r8a774a1-cmt0" for the 32-bit CMT0 device included in r8a774a1.
3131
- "renesas,r8a774a1-cmt1" for the 48-bit CMT devices included in r8a774a1.
32+
- "renesas,r8a774b1-cmt0" for the 32-bit CMT0 device included in r8a774b1.
33+
- "renesas,r8a774b1-cmt1" for the 48-bit CMT devices included in r8a774b1.
3234
- "renesas,r8a774c0-cmt0" for the 32-bit CMT0 device included in r8a774c0.
3335
- "renesas,r8a774c0-cmt1" for the 48-bit CMT devices included in r8a774c0.
3436
- "renesas,r8a7790-cmt0" for the 32-bit CMT0 device included in r8a7790.

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13258,6 +13258,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
1325813258
S: Maintained
1325913259
F: fs/timerfd.c
1326013260
F: include/linux/timer*
13261+
F: include/linux/time_namespace.h
13262+
F: kernel/time_namespace.c
1326113263
F: kernel/time/*timer*
1326213264

1326313265
POWER MANAGEMENT CORE

arch/arm/include/asm/vdso/gettimeofday.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ static __always_inline long clock_gettime_fallback(
5252
return ret;
5353
}
5454

55+
static __always_inline long clock_gettime32_fallback(
56+
clockid_t _clkid,
57+
struct old_timespec32 *_ts)
58+
{
59+
register struct old_timespec32 *ts asm("r1") = _ts;
60+
register clockid_t clkid asm("r0") = _clkid;
61+
register long ret asm ("r0");
62+
register long nr asm("r7") = __NR_clock_gettime;
63+
64+
asm volatile(
65+
" swi #0\n"
66+
: "=r" (ret)
67+
: "r" (clkid), "r" (ts), "r" (nr)
68+
: "memory");
69+
70+
return ret;
71+
}
72+
5573
static __always_inline int clock_getres_fallback(
5674
clockid_t _clkid,
5775
struct __kernel_timespec *_ts)
@@ -70,6 +88,24 @@ static __always_inline int clock_getres_fallback(
7088
return ret;
7189
}
7290

91+
static __always_inline int clock_getres32_fallback(
92+
clockid_t _clkid,
93+
struct old_timespec32 *_ts)
94+
{
95+
register struct old_timespec32 *ts asm("r1") = _ts;
96+
register clockid_t clkid asm("r0") = _clkid;
97+
register long ret asm ("r0");
98+
register long nr asm("r7") = __NR_clock_getres;
99+
100+
asm volatile(
101+
" swi #0\n"
102+
: "=r" (ret)
103+
: "r" (clkid), "r" (ts), "r" (nr)
104+
: "memory");
105+
106+
return ret;
107+
}
108+
73109
static __always_inline u64 __arch_get_hw_counter(int clock_mode)
74110
{
75111
#ifdef CONFIG_ARM_ARCH_TIMER

arch/arm/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
1414
obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
1515

1616
ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
17-
ccflags-y += -DDISABLE_BRANCH_PROFILING
17+
ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO32
1818

1919
ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
2020
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \

arch/arm64/include/asm/vdso/compat_gettimeofday.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define VDSO_HAS_CLOCK_GETRES 1
1818

19-
#define VDSO_HAS_32BIT_FALLBACK 1
19+
#define BUILD_VDSO32 1
2020

2121
static __always_inline
2222
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,

arch/mips/include/asm/vdso/gettimeofday.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ static __always_inline int clock_getres_fallback(
9696

9797
#if _MIPS_SIM != _MIPS_SIM_ABI64
9898

99-
#define VDSO_HAS_32BIT_FALLBACK 1
100-
10199
static __always_inline long clock_gettime32_fallback(
102100
clockid_t _clkid,
103101
struct old_timespec32 *_ts)

arch/mips/vdso/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ ccflags-vdso := \
1818
$(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \
1919
-D__VDSO__
2020

21+
ifndef CONFIG_64BIT
22+
ccflags-vdso += -DBUILD_VDSO32
23+
endif
24+
2125
ifdef CONFIG_CC_IS_CLANG
2226
ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
2327
endif

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ config X86
124124
select GENERIC_STRNLEN_USER
125125
select GENERIC_TIME_VSYSCALL
126126
select GENERIC_GETTIMEOFDAY
127+
select GENERIC_VDSO_TIME_NS
127128
select GUP_GET_PTE_LOW_HIGH if X86_PAE
128129
select HARDLOCKUP_CHECK_TIMESTAMP if X86_64
129130
select HAVE_ACPI_APEI if ACPI

arch/x86/entry/vdso/vdso-layout.lds.S

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@ SECTIONS
1616
* segment.
1717
*/
1818

19-
vvar_start = . - 3 * PAGE_SIZE;
20-
vvar_page = vvar_start;
19+
vvar_start = . - 4 * PAGE_SIZE;
20+
vvar_page = vvar_start;
2121

2222
/* Place all vvars at the offsets in asm/vvar.h. */
2323
#define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset;
24-
#define __VVAR_KERNEL_LDS
2524
#include <asm/vvar.h>
26-
#undef __VVAR_KERNEL_LDS
2725
#undef EMIT_VVAR
2826

2927
pvclock_page = vvar_start + PAGE_SIZE;
3028
hvclock_page = vvar_start + 2 * PAGE_SIZE;
29+
timens_page = vvar_start + 3 * PAGE_SIZE;
30+
31+
#undef _ASM_X86_VVAR_H
32+
/* Place all vvars in timens too at the offsets in asm/vvar.h. */
33+
#define EMIT_VVAR(name, offset) timens_ ## name = timens_page + offset;
34+
#include <asm/vvar.h>
35+
#undef EMIT_VVAR
3136

3237
. = SIZEOF_HEADERS;
3338

0 commit comments

Comments
 (0)