Skip to content

Commit

Permalink
powerpc/vdso: fix clock_gettime_fallback for vdso32
Browse files Browse the repository at this point in the history
The second argument of __kernel_clock_gettime64 points to a struct
__kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
in the fallback function for the 32-bit vdso.  Similarily,
clock_getres_fallback should use the clock_getres_time64 syscall, though
it isn't yet called from the 32-bit vdso.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
[chleroy: Moved into the #ifdef CONFIG_VDSO32 block]
Fixes: d0e3fc6 ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
  • Loading branch information
andreas-schwab authored and intel-lab-lkp committed Jan 11, 2021
1 parent e71ba94 commit 49b084d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions arch/powerpc/include/asm/vdso/gettimeofday.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
}

#ifdef CONFIG_VDSO32

#define BUILD_VDSO32 1

static __always_inline
int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
}

static __always_inline
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
}

#ifdef CONFIG_VDSO32

#define BUILD_VDSO32 1

static __always_inline
int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
{
Expand All @@ -130,6 +130,21 @@ int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
{
return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
}

#else

static __always_inline
int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
}

static __always_inline
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
}

#endif

static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
Expand Down

0 comments on commit 49b084d

Please sign in to comment.