* libperf: lack of interface @ 2021-09-01 9:45 nakamura.shun 2021-09-01 9:57 ` Peter Zijlstra 2021-09-01 13:36 ` Arnaldo Carvalho de Melo 0 siblings, 2 replies; 11+ messages in thread From: nakamura.shun @ 2021-09-01 9:45 UTC (permalink / raw) To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung, Rob Herring Cc: linux-kernel, linux-perf-users Hello. I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. Does anyone plan to implement any of these libperf features? - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland - Interfaces that can run fcntl (SIGIO) from userland [1] https://github.com/deater/perf_event_tests/tree/master/tests/rdpmc Thanks. Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-09-01 9:45 libperf: lack of interface nakamura.shun @ 2021-09-01 9:57 ` Peter Zijlstra 2021-09-01 13:36 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 11+ messages in thread From: Peter Zijlstra @ 2021-09-01 9:57 UTC (permalink / raw) To: nakamura.shun Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung, Rob Herring, linux-kernel, linux-perf-users On Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com wrote: > Hello. > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > Does anyone plan to implement any of these libperf features? > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > - Interfaces that can run fcntl (SIGIO) from userland > > [1] https://github.com/deater/perf_event_tests/tree/master/tests/rdpmc While IOC_RESET has it's uses, it really shouldn't be used in combination with RDPMC, it destroys the whole 'dont do syscalls'/performance thing. The typical RDPMC usage is: /* setup counter on self */ ... start = RDPMC /* your code */ end = RDPMC delta = end - start; ... Nowhere do we need a reset... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-09-01 9:45 libperf: lack of interface nakamura.shun 2021-09-01 9:57 ` Peter Zijlstra @ 2021-09-01 13:36 ` Arnaldo Carvalho de Melo 2021-09-02 8:41 ` Jiri Olsa 1 sibling, 1 reply; 11+ messages in thread From: Arnaldo Carvalho de Melo @ 2021-09-01 13:36 UTC (permalink / raw) To: Nakamura Shun Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > Hello. > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > Does anyone plan to implement any of these libperf features? > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > - Interfaces that can run fcntl (SIGIO) from userland > > [1] https://github.com/deater/perf_event_tests/tree/master/tests/rdpmc So, while in this specific case you should probably follow PeterZ's advice, feel free to submit patches moving stuff that is in tools/perf/util/ to tools/lib/perf/ (libperf) when you have a reasonable use case, such as Vince's test suite. We can then discuss if any adjustment is needed, but doing it this piecemeal way, with justification, should be a good way to enrich libperf with things that are in quiescent state in tools/perf/util/ and that have external users. Thanks, - Arnaldo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-09-01 13:36 ` Arnaldo Carvalho de Melo @ 2021-09-02 8:41 ` Jiri Olsa 2021-09-21 9:46 ` nakamura.shun 0 siblings, 1 reply; 11+ messages in thread From: Jiri Olsa @ 2021-09-02 8:41 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Nakamura Shun, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > Hello. > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > Does anyone plan to implement any of these libperf features? > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > - Interfaces that can run fcntl (SIGIO) from userland hi, we could add perf_evsel__fd like below, would it help your usecase? if you described your usecases in more details we could see if we could add/move something to libperf for that as Arnaldo said below it could be already in tools/perf/util/*.c somewhere ;-) jirka > > > > [1] https://github.com/deater/perf_event_tests/tree/master/tests/rdpmc > > So, while in this specific case you should probably follow PeterZ's > advice, feel free to submit patches moving stuff that is in > tools/perf/util/ to tools/lib/perf/ (libperf) when you have a reasonable > use case, such as Vince's test suite. > > We can then discuss if any adjustment is needed, but doing it this > piecemeal way, with justification, should be a good way to enrich > libperf with things that are in quiescent state in tools/perf/util/ and > that have external users. > > Thanks, > > - Arnaldo > --- tools/lib/perf/evsel.c | 13 +++++++++++++ tools/lib/perf/include/perf/evsel.h | 1 + 2 files changed, 14 insertions(+) diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c index d8886720e83d..8cbdaa78749c 100644 --- a/tools/lib/perf/evsel.c +++ b/tools/lib/perf/evsel.c @@ -413,3 +413,16 @@ void perf_evsel__free_id(struct perf_evsel *evsel) zfree(&evsel->id); evsel->ids = 0; } + +int perf_evsel__fd(struct perf_evsel *evsel, int cpu, int thread) +{ + int max_thread = xyarray__max_y(evsel->fd); + int max_cpu = xyarray__max_x(evsel->fd); + + if (thread >= max_thread) + return -EINVAL; + if (cpu >= max_cpu) + return -EINVAL; + + return FD(evsel, cpu, thread); +} diff --git a/tools/lib/perf/include/perf/evsel.h b/tools/lib/perf/include/perf/evsel.h index 60eae25076d3..5f29935efcaf 100644 --- a/tools/lib/perf/include/perf/evsel.h +++ b/tools/lib/perf/include/perf/evsel.h @@ -39,5 +39,6 @@ LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu); LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__fd(struct perf_evsel *evsel, int cpu, int thread); #endif /* __LIBPERF_EVSEL_H */ -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-09-02 8:41 ` Jiri Olsa @ 2021-09-21 9:46 ` nakamura.shun 2021-10-18 8:57 ` nakamura.shun 0 siblings, 1 reply; 11+ messages in thread From: nakamura.shun @ 2021-09-21 9:46 UTC (permalink / raw) To: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra Cc: Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Hi, Jirka, Arnaldo, and Peter Sorry for the late reply. > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > Hello. > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > Does anyone plan to implement any of these libperf features? > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > - Interfaces that can run fcntl (SIGIO) from userland > > hi, > we could add perf_evsel__fd like below, would it help your usecase? > > if you described your usecases in more details we could > see if we could add/move something to libperf for that > > as Arnaldo said below it could be already in tools/perf/util/*.c > somewhere ;-) As Peter says, I understood that for rdpmc, no reset is needed. However, PAPI resets it explicitly, for example, at PAPI_reset. In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. I think it is desirable to be able to achieve similar functionality. Best Regards Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-09-21 9:46 ` nakamura.shun @ 2021-10-18 8:57 ` nakamura.shun 2021-10-20 12:20 ` Jiri Olsa 0 siblings, 1 reply; 11+ messages in thread From: nakamura.shun @ 2021-10-18 8:57 UTC (permalink / raw) To: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra Cc: Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Hi > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > Hello. > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > hi, > > we could add perf_evsel__fd like below, would it help your usecase? > > > > if you described your usecases in more details we could > > see if we could add/move something to libperf for that > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > somewhere ;-) > > As Peter says, I understood that for rdpmc, no reset is needed. > > However, PAPI resets it explicitly, for example, at PAPI_reset. > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > I think it is desirable to be able to achieve similar functionality. Does anyone have any comments? Best Regards Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-10-18 8:57 ` nakamura.shun @ 2021-10-20 12:20 ` Jiri Olsa 2021-10-22 6:17 ` nakamura.shun 0 siblings, 1 reply; 11+ messages in thread From: Jiri Olsa @ 2021-10-20 12:20 UTC (permalink / raw) To: nakamura.shun Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users On Mon, Oct 18, 2021 at 08:57:20AM +0000, nakamura.shun@fujitsu.com wrote: > Hi > > > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > > Hello. > > > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > > > hi, > > > we could add perf_evsel__fd like below, would it help your usecase? > > > > > > if you described your usecases in more details we could > > > see if we could add/move something to libperf for that > > > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > > somewhere ;-) > > > > As Peter says, I understood that for rdpmc, no reset is needed. > > > > However, PAPI resets it explicitly, for example, at PAPI_reset. > > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > > > I think it is desirable to be able to achieve similar functionality. > > Does anyone have any comments? I'll try to add that functionality soon, I'll cc you on patch jirka ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-10-20 12:20 ` Jiri Olsa @ 2021-10-22 6:17 ` nakamura.shun 2021-12-03 9:00 ` nakamura.shun 0 siblings, 1 reply; 11+ messages in thread From: nakamura.shun @ 2021-10-22 6:17 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Hi jirka > On Mon, Oct 18, 2021 at 08:57:20AM +0000, nakamura.shun@fujitsu.com wrote: > > Hi > > > > > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > > > Hello. > > > > > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > > > > > hi, > > > > we could add perf_evsel__fd like below, would it help your usecase? > > > > > > > > if you described your usecases in more details we could > > > > see if we could add/move something to libperf for that > > > > > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > > > somewhere ;-) > > > > > > As Peter says, I understood that for rdpmc, no reset is needed. > > > > > > However, PAPI resets it explicitly, for example, at PAPI_reset. > > > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > > > > > I think it is desirable to be able to achieve similar functionality. > > > > Does anyone have any comments? > > I'll try to add that functionality soon, > I'll cc you on patch Thank you. I look forward to your patch. Best Regards Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-10-22 6:17 ` nakamura.shun @ 2021-12-03 9:00 ` nakamura.shun 2021-12-07 5:49 ` nakamura.shun 0 siblings, 1 reply; 11+ messages in thread From: nakamura.shun @ 2021-12-03 9:00 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Hi jirka > > On Mon, Oct 18, 2021 at 08:57:20AM +0000, nakamura.shun@fujitsu.com wrote: > > > Hi > > > > > > > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > > > > Hello. > > > > > > > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > > > > > > > hi, > > > > > we could add perf_evsel__fd like below, would it help your usecase? > > > > > > > > > > if you described your usecases in more details we could > > > > > see if we could add/move something to libperf for that > > > > > > > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > > > > somewhere ;-) > > > > > > > > As Peter says, I understood that for rdpmc, no reset is needed. > > > > > > > > However, PAPI resets it explicitly, for example, at PAPI_reset. > > > > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > > > > > > > I think it is desirable to be able to achieve similar functionality. > > > > > > Does anyone have any comments? > > > > I'll try to add that functionality soon, > > I'll cc you on patch > > Thank you. > I look forward to your patch. Do you have a specific plan? I would like to know the rough period until your patch is made. Best Regards Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-12-03 9:00 ` nakamura.shun @ 2021-12-07 5:49 ` nakamura.shun 2021-12-07 17:04 ` Jiri Olsa 0 siblings, 1 reply; 11+ messages in thread From: nakamura.shun @ 2021-12-07 5:49 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users Hi jirka > > > On Mon, Oct 18, 2021 at 08:57:20AM +0000, nakamura.shun@fujitsu.com wrote: > > > > Hi > > > > > > > > > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > > > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > > > > > Hello. > > > > > > > > > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > > > > > > > > > hi, > > > > > > we could add perf_evsel__fd like below, would it help your usecase? > > > > > > > > > > > > if you described your usecases in more details we could > > > > > > see if we could add/move something to libperf for that > > > > > > > > > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > > > > > somewhere ;-) > > > > > > > > > > As Peter says, I understood that for rdpmc, no reset is needed. > > > > > > > > > > However, PAPI resets it explicitly, for example, at PAPI_reset. > > > > > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > > > > > > > > > I think it is desirable to be able to achieve similar functionality. > > > > > > > > Does anyone have any comments? > > > > > > I'll try to add that functionality soon, > > > I'll cc you on patch > > > > Thank you. > > I look forward to your patch. > > Do you have a specific plan? > I would like to know the rough period until your patch is made. I will also try to implement these interfaces. Best Regards Shunsuke ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: libperf: lack of interface 2021-12-07 5:49 ` nakamura.shun @ 2021-12-07 17:04 ` Jiri Olsa 0 siblings, 0 replies; 11+ messages in thread From: Jiri Olsa @ 2021-12-07 17:04 UTC (permalink / raw) To: nakamura.shun Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Rob Herring, linux-kernel, linux-perf-users On Tue, Dec 07, 2021 at 05:49:16AM +0000, nakamura.shun@fujitsu.com wrote: > Hi jirka > > > > > On Mon, Oct 18, 2021 at 08:57:20AM +0000, nakamura.shun@fujitsu.com wrote: > > > > > Hi > > > > > > > > > > > > On Wed, Sep 01, 2021 at 10:36:40AM -0300, Arnaldo Carvalho de Melo wrote: > > > > > > > > Em Wed, Sep 01, 2021 at 09:45:10AM +0000, nakamura.shun@fujitsu.com escreveu: > > > > > > > > > Hello. > > > > > > > > > > > > > > > > > > I'm trying to change rdpmc test in perf_event_tests[1] to use libperf, but libperf doesn't have enough interfaces. > > > > > > > > > Does anyone plan to implement any of these libperf features? > > > > > > > > > > > > > > > > > > - Interfaces that can run ioctl (PERF_EVENT_IOC_RESET) from userland > > > > > > > > > - Interfaces that can run fcntl (SIGIO) from userland > > > > > > > > > > > > > > hi, > > > > > > > we could add perf_evsel__fd like below, would it help your usecase? > > > > > > > > > > > > > > if you described your usecases in more details we could > > > > > > > see if we could add/move something to libperf for that > > > > > > > > > > > > > > as Arnaldo said below it could be already in tools/perf/util/*.c > > > > > > > somewhere ;-) > > > > > > > > > > > > As Peter says, I understood that for rdpmc, no reset is needed. > > > > > > > > > > > > However, PAPI resets it explicitly, for example, at PAPI_reset. > > > > > > In other, PAPI also has the ability to call PERF_EVENT_IOC_REFLESH on overflow to call a user-registered handler, using SIGIO. > > > > > > > > > > > > I think it is desirable to be able to achieve similar functionality. > > > > > > > > > > Does anyone have any comments? > > > > > > > > I'll try to add that functionality soon, > > > > I'll cc you on patch > > > > > > Thank you. > > > I look forward to your patch. > > > > Do you have a specific plan? > > I would like to know the rough period until your patch is made. > > I will also try to implement these interfaces. sorry for late reply, please do thanks, jirka ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-12-07 17:04 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-01 9:45 libperf: lack of interface nakamura.shun 2021-09-01 9:57 ` Peter Zijlstra 2021-09-01 13:36 ` Arnaldo Carvalho de Melo 2021-09-02 8:41 ` Jiri Olsa 2021-09-21 9:46 ` nakamura.shun 2021-10-18 8:57 ` nakamura.shun 2021-10-20 12:20 ` Jiri Olsa 2021-10-22 6:17 ` nakamura.shun 2021-12-03 9:00 ` nakamura.shun 2021-12-07 5:49 ` nakamura.shun 2021-12-07 17:04 ` Jiri Olsa
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.