From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Evan Green <evan@rivosinc.com>, libc-alpha@sourceware.org
Cc: palmer@rivosinc.com, slewis@rivosinc.com, vineetg@rivosinc.com
Subject: Re: [PATCH v2 2/3] riscv: Add hwprobe vdso call support
Date: Wed, 29 Mar 2023 15:39:31 -0300 [thread overview]
Message-ID: <4c4b73eb-7cdc-bc91-857a-c1451210ce1d@linaro.org> (raw)
In-Reply-To: <20230221191537.3159966-3-evan@rivosinc.com>
On 21/02/23 16:15, Evan Green wrote:
> The new riscv_hwprobe syscall also comes with a vDSO for faster answers
> to your most common questions. Call in today to speak with a kernel
> representative near you!
>
> Signed-off-by: Evan Green <evan@rivosinc.com>
> ---
>
> Changes in v2:
> - Add vDSO interface
>
> sysdeps/unix/sysv/linux/dl-vdso-setup.c | 10 ++++++++++
> sysdeps/unix/sysv/linux/dl-vdso-setup.h | 3 +++
> sysdeps/unix/sysv/linux/riscv/hwprobe.c | 6 ++++++
> sysdeps/unix/sysv/linux/riscv/sysdep.h | 1 +
> 4 files changed, 20 insertions(+)
>
> diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
> index 68fa8de641..3fe304a0c7 100644
> --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c
> +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
> @@ -71,6 +71,16 @@ PROCINFO_CLASS int (*_dl_vdso_clock_getres_time64) (clockid_t,
> # ifdef HAVE_GET_TBFREQ
> PROCINFO_CLASS uint64_t (*_dl_vdso_get_tbfreq)(void) RELRO;
> # endif
> +
> +/* RISC-V specific ones. */
> +# ifdef HAVE_RISCV_HWPROBE
> +PROCINFO_CLASS int (*_dl_vdso_riscv_hwprobe)(void *,
> + long,
> + long,
> + unsigned long *,
> + long) RELRO;
> +# endif
> +
> #endif
>
> #undef RELRO
> diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
> index 867072b897..39eafd5316 100644
> --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h
> +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
> @@ -47,6 +47,9 @@ setup_vdso_pointers (void)
> #ifdef HAVE_GET_TBFREQ
> GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
> #endif
> +#ifdef HAVE_RISCV_HWPROBE
> + GLRO(dl_vdso_riscv_hwprobe) = dl_vdso_vsym (HAVE_RISCV_HWPROBE);
> +#endif
> }
>
> #endif
> diff --git a/sysdeps/unix/sysv/linux/riscv/hwprobe.c b/sysdeps/unix/sysv/linux/riscv/hwprobe.c
> index 74f68889ca..2c61a67db7 100644
> --- a/sysdeps/unix/sysv/linux/riscv/hwprobe.c
> +++ b/sysdeps/unix/sysv/linux/riscv/hwprobe.c
> @@ -20,11 +20,17 @@
> #include <sys/syscall.h>
> #include <sys/hwprobe.h>
> #include <sysdep.h>
> +#include <sysdep-vdso.h>
>
> int
> __riscv_hwprobe (struct riscv_hwprobe *pairs, long pair_count,
> long cpu_count, unsigned long *cpus, unsigned long flags)
> {
> + /* The vDSO may be able to provide the answer without a syscall. */
> +#ifdef HAVE_RISCV_HWPROBE
> + INLINE_VSYSCALL(riscv_hwprobe, 5, pairs, pair_count, cpu_count, cpus, flags);
> +#else
> return INLINE_SYSCALL_CALL (riscv_hwprobe, pairs, pair_count,
> cpu_count, cpus, flags);
> +#endif
> }
The HAVE_RISCV_HWPROBE is always defined for RISCV, so there is no need
to use the fallback (INLINE_VSYSCALL already issues the syscall if the
dl_vdso_get_tbfreq is NULL).
> diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> index 4af5fe5dbc..ba17aaaff2 100644
> --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> @@ -155,6 +155,7 @@
> /* List of system calls which are supported as vsyscalls (for RV32 and
> RV64). */
> # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
> +# define HAVE_RISCV_HWPROBE "__vdso_riscv_hwprobe"
>
> # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
> # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
next prev parent reply other threads:[~2023-03-29 18:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 19:15 [PATCH v2 0/3] RISC-V: ifunced memcpy using new kernel hwprobe interface Evan Green
2023-02-21 19:15 ` [PATCH v2 1/3] riscv: Add Linux hwprobe syscall support Evan Green
2023-03-29 18:38 ` Adhemerval Zanella Netto
2023-02-21 19:15 ` [PATCH v2 2/3] riscv: Add hwprobe vdso call support Evan Green
2023-03-29 18:39 ` Adhemerval Zanella Netto [this message]
2023-02-21 19:15 ` [PATCH v2 3/3] riscv: Add and use alignment-ignorant memcpy Evan Green
2023-03-28 22:54 ` [PATCH v2 0/3] RISC-V: ifunced memcpy using new kernel hwprobe interface Palmer Dabbelt
2023-03-28 23:41 ` Adhemerval Zanella Netto
2023-03-29 0:01 ` Palmer Dabbelt
2023-03-29 19:16 ` Adhemerval Zanella Netto
2023-03-29 19:45 ` Palmer Dabbelt
2023-03-29 20:13 ` Adhemerval Zanella Netto
2023-03-30 18:31 ` Evan Green
2023-03-30 19:43 ` Adhemerval Zanella Netto
2023-03-30 6:20 ` Jeff Law
2023-03-30 18:43 ` Evan Green
2023-03-31 5:09 ` Jeff Law
2023-03-30 19:38 ` Adhemerval Zanella Netto
2023-03-31 18:07 ` Jeff Law
2023-03-31 18:34 ` Palmer Dabbelt
2023-03-31 19:32 ` Adhemerval Zanella Netto
2023-03-31 20:19 ` Jeff Law
2023-03-31 21:03 ` Palmer Dabbelt
2023-03-31 21:35 ` Jeff Law
2023-03-31 21:38 ` Palmer Dabbelt
2023-03-31 22:10 ` Jeff Law
2023-04-07 15:36 ` Palmer Dabbelt
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=4c4b73eb-7cdc-bc91-857a-c1451210ce1d@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=evan@rivosinc.com \
--cc=libc-alpha@sourceware.org \
--cc=palmer@rivosinc.com \
--cc=slewis@rivosinc.com \
--cc=vineetg@rivosinc.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 read-only IMAP folder(s) and NNTP newsgroup(s).