Re: [PATCH 7/7] time: remove timespec64 hack
From: John Stultz
Date: Tue Oct 24 2017 - 16:49:50 EST
On Thu, Oct 19, 2017 at 4:14 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> This may be a somewhat controversial change, changing 64-bit architectures
> to use the same 'struct timespec64' definition that 32-bit architectures
> have, and removing a micro-optimization that tries to minimize the
> difference between timespec and timespec64.
>
> Starting with gcc-5, the compiler can completely optimize away the
> timespec_to_timespec64 and timespec64_to_timespec functions on 64-bit
> architectures. With older compilers, we introduce a couple of extra
> copies of local variables, but those are easily avoided by using
> the timespec64 based interfaces consistently, as we do in most of the
> important code paths already.
>
> The main upside of removing the hack is that printing the tv_sec
> field of a timespec64 structure can now use the %lld format
> string on all architectures without a cast to time64_t. Without
> this patch, the field is a 'long' type and would have to be printed
> using %ld on 64-bit architectures.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
This one doesn't seem to build for me... In the meantime, I'm going
to go ahead testing with patches 1-6.
jstultz@buildbox:~/projects/linux/time$ make -j24 bzImage > /dev/null
fs/select.c: In function âcompat_core_sys_selectâ:
fs/select.c:1244:27: error: passing argument 3 of âdo_selectâ from
incompatible pointer type [-Werror=incompatible-pointer-types]
ret = do_select(n, &fds, end_time);
^
fs/select.c:451:12: note: expected âstruct timespec64 *â but argument
is of type âstruct timespec *â
static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time)
^
fs/select.c: In function âC_SYSC_selectâ:
fs/select.c:1279:31: error: passing argument 1 of
âpoll_select_set_timeoutâ from incompatible pointer type
[-Werror=incompatible-pointer-types]
if (poll_select_set_timeout(to,
^
fs/select.c:273:5: note: expected âstruct timespec64 *â but argument
is of type âstruct timespec *â
int poll_select_set_timeout(struct timespec64 *to, time64_t sec, long nsec)
^
fs/select.c: In function âdo_compat_pselectâ:
fs/select.c:1325:31: error: passing argument 1 of
âpoll_select_set_timeoutâ from incompatible pointer type
[-Werror=incompatible-pointer-types]
if (poll_select_set_timeout(to, ts.tv_sec, ts.tv_nsec))
^
fs/select.c:273:5: note: expected âstruct timespec64 *â but argument
is of type âstruct timespec *â
int poll_select_set_timeout(struct timespec64 *to, time64_t sec, long nsec)
^
fs/select.c: In function âC_SYSC_ppollâ:
fs/select.c:1394:31: error: passing argument 1 of
âpoll_select_set_timeoutâ from incompatible pointer type
[-Werror=incompatible-pointer-types]
if (poll_select_set_timeout(to, ts.tv_sec, ts.tv_nsec))
^
fs/select.c:273:5: note: expected âstruct timespec64 *â but argument
is of type âstruct timespec *â
int poll_select_set_timeout(struct timespec64 *to, time64_t sec, long nsec)
^
fs/select.c:1409:32: error: passing argument 3 of âdo_sys_pollâ from
incompatible pointer type [-Werror=incompatible-pointer-types]
ret = do_sys_poll(ufds, nfds, to);
^
fs/select.c:928:12: note: expected âstruct timespec64 *â but argument
is of type âstruct timespec *â
static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds,
^
cc1: some warnings being treated as errors
thanks
-john