Skip to content

Commit 8a1bef4

Browse files
fvincenzopaulburton
authored andcommitted
mips: vdso: Fix __arch_get_hw_counter()
On some MIPS variants (e.g. MIPS r1), vDSO clock_mode is set to VDSO_CLOCK_NONE. When VDSO_CLOCK_NONE is set the expected kernel behavior is to fallback on syscalls. To do that the generic vDSO library expects UULONG_MAX as return value of __arch_get_hw_counter(). Fix __arch_get_hw_counter() on MIPS defining a __VDSO_USE_SYSCALL case that addressed the described scenario. Reported-by: Maxime Bizon <[email protected]> Signed-off-by: Vincenzo Frascino <[email protected]> Tested-by: Maxime Bizon <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: [email protected]
1 parent 0ad8f7a commit 8a1bef4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#define VDSO_HAS_CLOCK_GETRES 1
2626

27+
#define __VDSO_USE_SYSCALL ULLONG_MAX
28+
2729
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
2830

2931
static __always_inline long gettimeofday_fallback(
@@ -205,7 +207,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode)
205207
break;
206208
#endif
207209
default:
208-
cycle_now = 0;
210+
cycle_now = __VDSO_USE_SYSCALL;
209211
break;
210212
}
211213

0 commit comments

Comments
 (0)