Re: [PATCH] Documentation: riscv: note that counter access is part of the uABI
From: Conor Dooley
Date: Mon Jan 09 2023 - 16:47:11 EST
On Mon, Jan 09, 2023 at 01:36:19PM -0800, Atish Patra wrote:
> On Sat, Dec 3, 2022 at 2:57 AM Conor Dooley <conor@xxxxxxxxxx> wrote:
> >
> > On Sat, Dec 03, 2022 at 03:45:35AM -0700, Jonathan Corbet wrote:
> > > Jonathan Corbet <corbet@xxxxxxx> writes:
> > >
> > > > Palmer Dabbelt <palmer@xxxxxxxxxxx> writes:
> > > >> Reviewed-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
> > > >> Acked-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
> > > >>
> > > >> I think I merged the last one of these, but if the doc folks pick it up
> > > >> that's fine with me. Otherwise I'll take it when it comes back around,
> > > >> so folks have time to take a look.
> > > >
> > > > "Doc folks" applied it, thanks. :)
> > >
> > > Actually, I take that back. I'd missed this part from the patch:
> > >
> > > > Based on an, as yet, unsent v2 of my other uABI changes. I don't expect
> > > > it to be applicable, just getting a patch into patchwork while I don't
> > > > forget about this.
> > >
> > > ...but b4 happily picked up a couple of *other* patches from this thread
> > > and applied them instead; I've now undone that. Sorry for the noise.
> >
> > Huh, I accidentally put an "in-reply-to" header on this patch. I have
> > been updating some of my submission helper scripts & I must have left
> > the field populated from sending another set by accident:
> > https://lore.kernel.org/linux-riscv/20221129144742.2935581-1-conor.dooley@xxxxxxxxxxxxx/
> >
>
> I don't see the patch upstream. Is this patch merged already ?
No it's not. I was going to resend it actually, but I noticed the thread
yesterday or something. Not sure why you CC'ed half the world on it but
not linux-riscv? Or me if you didn't want me resending it!
> If not, please hold on merging this for now. We had some discussions
> around this in the perf community.
> Here is the thread
> https://lore.kernel.org/lkml/Y7gN32eHJNyWBvVD@FVFF77S0Q05N/T/
>
> TLDR; Even though x86 allows unrestricted access through rdpmc (not
> default), it still reads zero unless a privileged root user modifies
> the MSR interface exposed by the kernel.
>
> Quoting PeterZ
>
> "RDPMC is only useful if you read counters you own on yourself -- IOW
> selfmonitoring, using the interface outlined in uapi/linux/perf_events.h
> near struct perf_event_mmap_page.
>
> Any other usage -- you get to keep the pieces."
>
> "Anyway, given RISC-V being a very young platform, I would try really
> *really* *REALLY* hard to stomp on these applications and get them to
> change in order to reclaim the PMU usage."
>
> We need to decide what's the best approach for RISC-V. The current
> text in uABI will let users assume that
> cycle/instret can be read without any issues which is wrong.
>
> There are few options what we can do for RISC-V:
>
> 1. We can trap n emulate and report 0 always as suggested by Mark in
> that thread.
> 2. Continue to allow the user to read the counters directly but
> expects the garbage value depending on the other activities
> on the system. Hopefully, folks will fix their application by that time.
>
> Once we have the procfs interface, we enforce the behavior by breaking
> the application.
>
> In either case, the uABI needs to be updated accordingly.
I don't disagree with what I saw either PeterZ or Mark say. I'm happy
not to resend this, I've got no skin in the game other than not wanting
something like that "documented" only in the driver.
What do you intend doing to instigate the "stomping"?
Thanks,
Conor.
Attachment:
signature.asc
Description: PGP signature