[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3E2EEC19-F320-4320-9A85-67B4E615C74A@goldelico.com>
Date: Wed, 27 Nov 2019 15:29:12 +0100
From: "H. Nikolaus Schaller" <hns@...delico.com>
To: Vincenzo Frascino <vincenzo.frascino@....com>
Cc: linux-mips@...r.kernel.org, Ralf Baechle <ralf@...ux-mips.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Paul Burton <paul.burton@...s.com>,
MIPS Creator CI20 Development
<mips-creator-ci20-dev@...glegroups.com>,
Discussions about the Letux Kernel
<letux-kernel@...nphoenux.org>
Subject: Re: MIPS: bug: gettimeofday syscall broken on CI20 board
Hi Vincenco,
> Am 27.11.2019 um 14:53 schrieb H. Nikolaus Schaller <hns@...delico.com>:
>
> Hi Vincenzo,
>
>> Am 26.11.2019 um 11:52 schrieb Vincenzo Frascino <vincenzo.frascino@....com>:
>>
>> I do not have a CI20 hence I can't do the test myself: could you please write a
>> small application that invokes gettimeofday() as per above and report the
>> behavior (I am even interested in the value returned). If we can reproduce the
>> problem in a smaller environment it is easier to debug and get to the solution.
>>
>> [1] http://users.isc.org/~each/doxygen/bind9/isc_2unix_2time_8c-source.html
>>
>> Let me know.
>
> I have done this and it seems as if tv_usec reports something that is beyond 1e6 us
> or remains unchanged by the syscall. tv_sec seems to be set correctly. And,
> gettimeofday() reports -1.
>
> hwclock isn't set on 45.4 kernel because I have no ethernet connection due to the bug.
>
> BR,
> Nikolaus
>
>
> Here is the log
>
> a) with 5.4 kernel
>
> root@...ux:~# cat gettime.c
> #include <stdio.h>
> #include <time.h>
> #include <sys/time.h>
>
> int main(void)
> {
> struct timeval tv;
> int r = gettimeofday(&tv, NULL);
> time_t t;
> int rt = time(&t);
>
> printf("r = %d\n", r);
> printf("tv.sec = %ld\n", tv.tv_sec);
> printf("tv.usec = %d\n", tv.tv_usec);
> printf("rt = %d\n", rt);
> printf("t = %ld\n", t);
> }
I realized that this does not allow to distinguish between
uninitialized struct timeval tv and return values. And it
would be nice to print errno. So I have used a new version:
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
int main(void)
{
struct timeval tv = { 1, 1 };
int r;
time_t t;
int rt;
r = gettimeofday(&tv, NULL);
printf("r = %d errno=%d\n", r, errno);
printf("tv.sec = %ld\n", tv.tv_sec);
printf("tv.usec = %d\n", tv.tv_usec);
rt = time(&t);
printf("rt = %d errno=%d\n", rt, errno);
printf("t = %ld\n", t);
}
> root@...ux:~# make gettime
> cc gettime.c -o gettime
> root@...ux:~# ./gettime
> r = -1
> tv.sec = 1431857456
> tv.usec = 2012065500
> rt = 1478206565
> t = 1478206565
root@...ux:~# ./gettime
r = -1 errno=1
tv.sec = 1
tv.usec = 1
rt = 1478193516 errno=1
t = 1478193516
root@...ux:~#
which means that there is an -EPERM and &tv is not touched.
Well, I did run this as root.
So it may be a completely different reason than changing the
VDSO structure.
> b) same system booted with 4.19 kernel:
>
> root@...ux:~# ./gettime
> r = 0
> tv.sec = 1574862135
> tv.usec = 27974
> rt = 1574862135
> t = 1574862135
root@...ux:~# ./gettime
r = 0 errno=0
tv.sec = 1574863040
tv.usec = 874858
rt = 1574863040 errno=0
t = 1574863040
root@...ux:~#
> root@...ux:~# uname -a
> Linux letux 4.19.86-letux-l400+ #1450 PREEMPT Sun Nov 24 17:17:19 CET 2019 mips GNU/Linux
Please let me know what I should try next.
BR and thanks,
Nikolaus
Powered by blists - more mailing lists