mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xixin Liu <liuxixin@kylinos.cn>
To: pjw@kernel.org
Cc: linux-riscv@lists.infradead.org, atish.patra@linux.dev,
	anup@brainfault.org, will@kernel.org, mark.rutland@arm.com,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	liuxixin@kylinos.cn
Subject: Re: [PATCH v1 2/2] perf: RISC-V: store available counter mask as bitmap
Date: Tue, 18 Aug 2026 17:15:00 +0800	[thread overview]
Message-ID: <reply.pjw.pmumask22.1787042100.git.liuxixin@kylinos.cn> (raw)
In-Reply-To: <93cab992-f808-8f3e-03a6-19d84baf38f3@kernel.org>

Hi Paul,

On Fri, 7 Aug 2026, Paul Walmsley wrote:
> This patch contains several array indexes to element 0 of the cmask
> bitmap, but that element is going to be XLEN bits wide.   Does that
> actually work on RV32 systems?

I built with CONFIG_ARCH_RV32I=y and booted qemu-system-riscv32.
Probe reports 16 firmware and 18 hardware counters.  The available
bitmap is two words: 0xfffffffd then 0x7.  Three bits sit at index 32
and above.

When CFG_MATCH fails on the first word, the same call is retried with
base 32 and the second word.  That is the walk the stop-all path already
used.  Clearing the first word still issues that second call with
base 32.

I also booted qemu-system-riscv64.  Probe reports the same 16 firmware
and 18 hardware counters.  The available bitmap is one word:
0x7fffffffd.  CFG_MATCH and stop-all stay on that word.  Opening a
cycles event from userspace succeeds on both guests.

A legacy-only RV32 kernel sets cycle and instret in the bitmap.  Opening
a cycles event from userspace succeeds there too.

v2 walks every bitmap word for the remaining CFG_MATCH sites, same as
stop-all, with the counter base set to i times BITS_PER_LONG.

Thanks,
Xixin


  reply	other threads:[~2026-08-18  9:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  8:50 [PATCH v1 0/2] perf: RISC-V: fix SBI PMU masks for RV32 Xixin Liu
2026-08-07  8:50 ` [PATCH v1 1/2] perf: RISC-V: use BIT_ULL for u64 overflow masks Xixin Liu
2026-08-08  0:46   ` Paul Walmsley
2026-08-07  8:50 ` [PATCH v1 2/2] perf: RISC-V: store available counter mask as bitmap Xixin Liu
2026-08-08  0:32   ` Paul Walmsley
2026-08-18  9:15     ` Xixin Liu [this message]
2026-08-18  9:10 ` [PATCH v2 0/2] perf: RISC-V: fix SBI PMU masks for RV32 Xixin Liu
2026-08-18  9:10   ` [PATCH v2 1/2] perf: RISC-V: use BIT_ULL for u64 overflow masks Xixin Liu
2026-08-18  9:10   ` [PATCH v2 2/2] perf: RISC-V: store available counter mask as bitmap Xixin Liu
2026-09-01  1:20     ` patchwork-bot+linux-riscv
2026-09-01 18:52     ` Paul Walmsley
2026-09-02  0:55       ` Xixin Liu

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=reply.pjw.pmumask22.1787042100.git.liuxixin@kylinos.cn \
    --to=liuxixin@kylinos.cn \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®