mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Paul Burton <paul.burton@mips.com>,
	linux-mips@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	MIPS Creator CI20 Development 
	<mips-creator-ci20-dev@googlegroups.com>,
	Discussions about the Letux Kernel 
	<letux-kernel@openphoenux.org>
Subject: Re: MIPS: bug: gettimeofday syscall broken on CI20 board
Date: Wed, 27 Nov 2019 14:53:20 +0100	[thread overview]
Message-ID: <8D151C34-41A1-4DFE-92D6-D1B27AEC8730@goldelico.com> (raw)
In-Reply-To: <3190d1a4-96c4-1843-3ae1-bae3a97af9fb@arm.com>

Hi Vincenzo,

> Am 26.11.2019 um 11:52 schrieb Vincenzo Frascino <vincenzo.frascino@arm.com>:
> 
> Hi Nikolaus,
> 
> sorry for the delay in answering to your email but due to personal reasons I had
> to pull off the linux development for few weeks.

No problem.

> 
> On 17/11/2019 13:14, H. Nikolaus Schaller wrote:
>> Hi Vincenzo,
>> 
> 
> [...]
> 
>> 
>> If I look at the definition of vdso_data it *is* significantly differen
>> from mips_vdso_data.
>> 
>> What I would assume is that the struct mips_vdso_data is embossed in user
>> space code and therefore using vdso_data instead is breaking API.
>> 
> 
> vdso_data and mips_vdso_data before are not part of the ABI hence they are not
> bind by a contract with the userspace.
> 
> This means that they can change at any point and if a userspace software relies
> on a specific layout of these data structures is doing something wrong.

Maybe the libs are clever enough to find that out dynamically but I have no
idea about how gettimeofday() and user-space VDSO is implemented to handle such
changes.

> 
>> Please advise what I should try or check to narrow down further.
>> 
> 
> I had a look at [1] line 200 and seems that the error you are seeing is
> generated by:
>  if (gettimeofday(&tv, NULL) == -1) { ... }

Yes.

> 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
> 
>> BR and thanks,
>> Nikolaus Schaller
>> 
> 
> 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@letux:~# 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);
}
root@letux:~# make gettime
cc     gettime.c   -o gettime
root@letux:~# ./gettime 
r = -1
tv.sec = 1431857456
tv.usec = 2012065500
rt = 1478206565
t = 1478206565
root@letux:~# ./gettime 
r = -1
tv.sec = 1431873840
tv.usec = 2012065500
rt = 1478206573
t = 1478206573
root@letux:~# uname -a
Linux letux 5.4.0-letux-l400+ #1485 PREEMPT Wed Nov 27 10:23:16 CET 2019 mips GNU/Linux
root@letux:~# cat /proc/cpuinfo 
system type             : JZ4780
machine                 : img,ci20
processor               : 0
cpu model               : Ingenic JZRISC V4.15  FPU V0.0
BogoMIPS                : 1196.85
wait instruction        : yes
microsecond timers      : no
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 1, address/irw mask: [0x0fff]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        :
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

root@letux:~# dpkg -l | grep libc6
ii  libc6:mipsel                   2.24-11+deb9u4                 mipsel       GNU C Library: Shared libraries
ii  libc6-dev:mipsel               2.24-11+deb9u4                 mipsel       GNU C Library: Development Libraries and Header Files
root@letux:~# cat /etc/debian_version 
9.11
root@letux:~# 

b) same system booted with 4.19 kernel:

root@letux:~# ./gettime 
r = 0
tv.sec = 1574862135
tv.usec = 27974
rt = 1574862135
t = 1574862135
root@letux:~# uname -a
Linux letux 4.19.86-letux-l400+ #1450 PREEMPT Sun Nov 24 17:17:19 CET 2019 mips GNU/Linux
root@letux:~# cat /proc/cpuinfo 
system type             : JZ4780
machine                 : img,ci20
processor               : 0
cpu model               : Ingenic JZRISC V4.15  FPU V0.0
BogoMIPS                : 1196.85
wait instruction        : yes
microsecond timers      : no
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 1, address/irw mask: [0x0fff]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        :
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

root@letux:~# cat /etc/debian_version 
9.11
root@letux:~# 


  reply	other threads:[~2019-11-27 13:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 16:21 MIPS: bug: gettimeofday syscall broken on CI20 board? H. Nikolaus Schaller
2019-11-17 13:14 ` MIPS: bug: gettimeofday syscall broken on CI20 board H. Nikolaus Schaller
2019-11-23  7:29   ` H. Nikolaus Schaller
2019-11-26 10:52   ` MIPS: " Vincenzo Frascino
2019-11-27 13:53     ` H. Nikolaus Schaller [this message]
2019-11-27 14:29       ` H. Nikolaus Schaller
2019-11-28 12:05         ` Vincenzo Frascino
2019-11-28 12:16           ` H. Nikolaus Schaller
2019-11-28 14:04             ` Vincenzo Frascino
2019-11-28 15:10               ` H. Nikolaus Schaller
2019-11-28 11:51       ` Vincenzo Frascino
2019-11-28 12:11         ` H. Nikolaus Schaller
2019-11-28 12:21           ` Vincenzo Frascino
2019-11-28 12:33             ` H. Nikolaus Schaller
2019-11-28 13:29               ` Maarten ter Huurne
2019-11-28 13:48                 ` H. Nikolaus Schaller
2019-11-28 14:01                   ` Vincenzo Frascino
2019-11-28 15:42                     ` H. Nikolaus Schaller
2019-11-28 15:07                   ` Thomas Bogendoerfer
2019-11-28 15:41                     ` H. Nikolaus Schaller
2019-11-28 15:46                       ` Vincenzo Frascino
2019-11-28 16:47                         ` H. Nikolaus Schaller
2019-11-29  8:57                           ` Vincenzo Frascino
2019-11-29 10:53                             ` Vincenzo Frascino
2019-11-29 11:51                               ` H. Nikolaus Schaller
2019-12-01  3:08                         ` [PATCH] Mips32 gettimeofday fix kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8D151C34-41A1-4DFE-92D6-D1B27AEC8730@goldelico.com \
    --to=hns@goldelico.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mips-creator-ci20-dev@googlegroups.com \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®