Bug 256905 - Missing clock_gettime VDSO on RISC-V
Summary: Missing clock_gettime VDSO on RISC-V
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: riscv (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-riscv (Team)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-30 14:30 UTC by Alex Richardson
Modified: 2021-09-07 16:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Richardson freebsd_committer freebsd_triage 2021-06-30 14:30:23 UTC
I just ran truss on a Qt application and saw tons of clock_gettime syscalls. Looking at it in GDB shows that __vdso_clock_gettime returns ENOSYS.

It appears that riscv_timer_timecount does not have a tc_fill_vdso_timehands function, so the tc_fill_vdso_timehands() function will always return 0.
Comment 1 Jessica Clarke freebsd_committer freebsd_triage 2021-06-30 15:09:00 UTC
Patch: https://reviews.freebsd.org/D30963
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-07-05 15:18:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=348c41d1815dc2e872a1deba1f4bf760caaa1094

commit 348c41d1815dc2e872a1deba1f4bf760caaa1094
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-07-05 15:16:53 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-07-05 15:16:53 +0000

    riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep

    PR:     256905
    Reviewed by:    arichardson, mhorne
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D30963

 lib/libc/riscv/sys/Makefile.inc         |  2 +-
 lib/libc/riscv/sys/__vdso_gettc.c (new) | 56 +++++++++++++++++++++++++++++++++
 sys/riscv/include/vdso.h                |  2 ++
 sys/riscv/riscv/elf_machdep.c           |  4 +--
 sys/riscv/riscv/timer.c                 | 14 +++++++++
 5 files changed, 75 insertions(+), 3 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-09-07 12:10:39 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c69a739379bea9de88869f7abc3db58f1a16363c

commit c69a739379bea9de88869f7abc3db58f1a16363c
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-07-05 15:16:53 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-09-07 12:06:44 +0000

    riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep

    PR:     256905
    Reviewed by:    arichardson, mhorne
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D30963

    (cherry picked from commit 348c41d1815dc2e872a1deba1f4bf760caaa1094)

 lib/libc/riscv/sys/Makefile.inc         |  2 +-
 lib/libc/riscv/sys/__vdso_gettc.c (new) | 56 +++++++++++++++++++++++++++++++++
 sys/riscv/include/vdso.h                |  2 ++
 sys/riscv/riscv/elf_machdep.c           |  4 +--
 sys/riscv/riscv/timer.c                 | 14 +++++++++
 5 files changed, 75 insertions(+), 3 deletions(-)