linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Maarten ter Huurne <maarten@treewalker.org>,
	mips-creator-ci20-dev@googlegroups.com,
	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>,
	Discussions about the Letux Kernel 
	<letux-kernel@openphoenux.org>
Subject: Re: MIPS: bug: gettimeofday syscall broken on CI20 board
Date: Thu, 28 Nov 2019 17:47:38 +0100	[thread overview]
Message-ID: <BF04DB35-9DBA-4297-8FCA-BB422A56DFEC@goldelico.com> (raw)
In-Reply-To: <04b509b4-b1ef-3bcb-433e-8eed5772288f@arm.com>

Hi Vincenzo,

> Am 28.11.2019 um 16:46 schrieb Vincenzo Frascino <vincenzo.frascino@arm.com>:
> 
> 
> On 28/11/2019 15:41, H. Nikolaus Schaller wrote:
>> 
>>> Am 28.11.2019 um 16:07 schrieb Thomas Bogendoerfer <tsbogend@alpha.franken.de>:
>>> 
>>> On Thu, Nov 28, 2019 at 02:48:46PM +0100, H. Nikolaus Schaller wrote:
>>>> 
>>>> What still does not fit into the picture is the errno = 1 i.e. EPERM.
>>>> Maybe I have to study the libc code that tries to read the ELF symbols
>>>> you have mentioned. It may fail for unknown reasons.
>>> 
>>> to understand vdso you might look at arch/mips/vdso and lib/vdso
>>> kernel sources.
>> 
>> Yes that is what I know, but I do not know how glibc can return an EPERM
>> through VDSO.
>> 
>>> 
>>> And if I understand it correctly you neither have a working high resolution
>>> timer usable bei do_hres() in lib/vdso/gettimeofday.c or a working
>>> gettimeofday_fallback(), which is enabled via CONFIG_MIPS_CLOCK_VSYSCALL
>>> and needs either CSRC_R4K or CLKSRC_MIPS_GIC.
>> 
>> Well, on kernel v4.19 or using v5.4 with Jessie, gettimeofday() works.
>> 
>> So this may only be part of the reason it starts to fail with commit
>> 24640f233b466051ad3a5d2786d2951e43026c9d.
>> 
>> MIPS_CLOCK_VSYSCALL is neither defined nor undefined in the defconfig.
>> And removed if I manually add it to my defconfig.
>> And yes, it depends on either CSRC_R4K || CLKSRC_MIPS_GIC by arch/mips/Kconfig.
>> 
>> Maybe this was just forgotten to properly handle for the ci20_defconfig
>> or jz4780?
>> 
>> What does CSRC_R4K resp. CLKSRC_MIPS_GIC ecactly mean? Does the jz4780 have this
>> feature?
>> 
> 
> I think I know what is going on, it is the way on which libc does the fallback.
> Could you please try the patch below the scissors and let me know if it works?

Well, it does not immediately compile because CONFIG_MIPS_CLOCK_VSYSCALL is not
set and can not be configured by normal means:

Error:

/Volumes/CaseSensitive/master/lib/vdso/gettimeofday.c: In function '__cvdso_gettimeofday':
/Volumes/CaseSensitive/master/lib/vdso/gettimeofday.c:152:4: error: implicit declaration of function 'gettimeofday_fallback' [-Werror=implicit-function-declaration]
    return gettimeofday_fallback(tv, tz);
    ^

So I force-#defined CONFIG_MIPS_CLOCK_VSYSCALL in arch/mips/include/asm/vdso/gettimeofday.h
which is also included by lib/vdso/gettimeofday.c

Yes, it works now! Great!!!

root@letux:~# ./gettime 
r = 0 errno=0
tv.sec = 1574959485
tv.usec = 671306
rt = 1574959485 errno=0
t = 1574959485
root@letux:~# cat /etc/debian_version 
9.11
root@letux:~# uname -a
Linux letux 5.4.0-letux-l400+ #1490 PREEMPT Thu Nov 28 17:23:32 CET 2019 mips GNU/Linux
root@letux:~# dhclient
root@letux:~# 

> If it does I will create a proper one.

It needs some mechanism to set CONFIG_MIPS_CLOCK_VSYSCALL.

I'll test if you have something new.

BR and thanks,
Nikolaus



  reply	other threads:[~2019-11-28 16:47 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
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 [this message]
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=BF04DB35-9DBA-4297-8FCA-BB422A56DFEC@goldelico.com \
    --to=hns@goldelico.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maarten@treewalker.org \
    --cc=mips-creator-ci20-dev@googlegroups.com \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=tsbogend@alpha.franken.de \
    --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;
as well as URLs for NNTP newsgroup(s).