[PATCH v4 00/10] riscv: Allow userspace to directly access perf counters
Rémi Denis-Courmont
remi at remlab.net
Tue Jul 18 12:04:45 PDT 2023
Le tiistaina 18. heinäkuuta 2023, 21.45.15 EEST Atish Patra a écrit :
> > I agree that it's not only insecure but also incorrect. However it mostly
> > works. In fact I don't disagree with the change as such, but I think that
> > the commit messages are misleading and confusing. For a start, in one
> > place it says that it is not breaking user space and in another it says
> > basically the opposite.
>
> Agreed. We will improve the commit message to clarify that. That's also the
> reason I started this whole thread :)
>
> > (Unfortunately, not everybody agrees with the change. I can't seem to get
> > FFmpeg's checkasm tool fixed:
> > http://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312245.html )
>
> Why can't rdtime(equivalent of rdtsc) be used instead of rdcycle ?
Isn't RDTIM susceptible to interference from power management and CPU
frequency scaling? I suppose that RDCYCLE may behave differently depending on
PM in *some* designs, but that would still be way better than RDTIME for the
purpose.
As far as benchmarking is concerned (_excluding_ system security), RDTIME
seems to have all the problems of RDCYCLE, and then some more, no?
> The perf syscall overhead is just one time setup thing during the
> start of the application.
> For counting the cycles before/after a loop, it still provides a
> direct CSR access in user mode.
I suppose that you allude to mmap() here? The (dumb) FFmpeg code is using the
ioctl() interface though, but that's just laziness.
--
レミ・デニ-クールモン
http://www.remlab.net/
More information about the linux-riscv
mailing list