All of lore.kernel.org
 help / color / mirror / Atom feed
* rdcycle from userland with RISCV_PMU_SBI=y
@ 2022-09-01 21:15 Aurelien Jarno
       [not found] ` <CAOnJCUJ-E-VyQOyh+psbJP4mDO9F+ShvnxDYjoCUUkH4rddJtw@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Aurelien Jarno @ 2022-09-01 21:15 UTC (permalink / raw)
  To: linux-riscv; +Cc: Atish Patra, Mathieu Malaterre

Hi all,

Mathieu Malaterre reported an issue in Debian with the highway package,
which uses the rdcycle pseudo instruction, and started to fail recently.

We tracked down an issue to the "perf platform driver based on SBI PMU
extension" recently added in Linux 5.18 [1]. On a board which runs an
SBI with the PMU extension, this causes the rdcycle pseudo instruction
to generate a SIGILL. This is because the driver explicitly set
CSR_SCOUNTEREN to 0x02, giving access from userland to rdtime but not
rdcycle.

I wonder if this change is intentional, and if there is a reason to
forbid using the rdcycle pseudo instruction from userland. If it is the
case, this should probably be changed so that the behaviour does not
differ from board to board depending on the available PMU extension.

Aurelien

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9991434596f5373dfd75857b445eb92a9253c56
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/perf/riscv_pmu_sbi.c?id=2880e1a175b9f31798f9d9482ee49187f61b5539#n649

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-28 13:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-09-05  5:40             ` Jan Wassenberg
2022-09-28 13:20               ` Palmer Dabbelt

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.