All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Anup Patel <apatel@ventanamicro.com>
Cc: Jan Wassenberg <janwas@google.com>,
	Anup Patel <anup@brainfault.org>,
	Mathieu Malaterre <malat@debian.org>,
	Atish Patra <atishp@atishpatra.org>,
	linux-riscv@lists.infradead.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Jan Newger <jannewger@google.com>
Subject: Re: rdcycle from userland with RISCV_PMU_SBI=y
Date: Fri, 2 Sep 2022 18:46:57 +0200	[thread overview]
Message-ID: <YxIzgYP3MujXdqwj@aurel32.net> (raw)
In-Reply-To: <CAK9=C2W2tkmyX0x2A7iaNLGoRq4N7L0CwwNacmdtsw6OUdfODQ@mail.gmail.com>

On 2022-09-02 17:34, Anup Patel wrote:
> On Fri, Sep 2, 2022 at 3:52 PM Jan Wassenberg <janwas@google.com> wrote:
> >
> > OK, but even if frequency changes, a cycle counter seems more useful for benchmarking than a low-resolution wall time.
> >
> > FYI it's not just Highway, the Google benchmark library also uses rdcycle.
> 
> Since the RISC-V ecosystem is still evolving, it is best time to fix
> things now rather
> than later.

Fair enough.

> Currently, only "time" CSR is available to user-space and all other performance
> counters should be enabled (or accessed) using Linux perf syscalls.

This is more complex in practice. For a recent kernel, the availability
of the "cycle" CSR depends on the PMU driver being used or compiled in
the kernel. For instance on both QEMU and a Polarfire Icicle board, the
legacy PMU is getting used, so rdcycle is available:

[   34.420435] Legacy PMU implementation is available

In the meantime, I upgraded QEMU and with it OpenSBI, so the SBI PMU is
used instead, and I should also update it on the Polarfire board, but it
is not so easy. Not that for QEMU, the value of scounteren is ignored,
so that rdcycle is still available.

We should make that consistent so that all users see the same behavior.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-09-02 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 21:15 rdcycle from userland with RISCV_PMU_SBI=y Aurelien Jarno
     [not found] ` <CAOnJCUJ-E-VyQOyh+psbJP4mDO9F+ShvnxDYjoCUUkH4rddJtw@mail.gmail.com>
     [not found]   ` <CAOnJCUKDQfCD7mh-RWrq0E8a3Fmp4Xz348THrS+SmJ71GX8=PA@mail.gmail.com>
2022-09-02  7:52     ` Mathieu Malaterre
2022-09-02  8:19       ` Anup Patel
     [not found]         ` <CAGRC-mj-v6RoGjCNr_TiabgqYX7H9mTXYE9tx6BhCKT5nHD-Aw@mail.gmail.com>
2022-09-02 10:31           ` Jan Wassenberg
2022-09-02 12:04           ` Anup Patel
2022-09-02 16:46             ` Aurelien Jarno [this message]
2022-09-05  5:40             ` Jan Wassenberg
2022-09-28 13:20               ` 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=YxIzgYP3MujXdqwj@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=anup@brainfault.org \
    --cc=apatel@ventanamicro.com \
    --cc=atishp@atishpatra.org \
    --cc=jannewger@google.com \
    --cc=janwas@google.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=malat@debian.org \
    --cc=paul.walmsley@sifive.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.