Skip to contentSkip to conversation

Perf tests for hw events

DISCUSSION Matt Fleming 3 participants 5 messages Jan 22, 2015

lore
Share & tools
lore
#0 lore raw

Folks,

In the process of writing perf support for Intel's Cache QoS Monitoring feature [0] I've had to write my own userland tests to drive tools/perf and indirectly the kernel internals. I'm now getting requests for these tests from various people and it occurs to me that they should probably live in the kernel tree.

The tests I've got do a couple of things like setting up a perf_event cgroup and assigning enough tasks to trigger the RMID recycling code in the CQM driver, ensuring that we can run multiple events simultaneously (that the event scheduling/rotation code works), etc.

Does anything like this already exist for hw events? I couldn't find anything specific to hw events from snooping around in tools/perf/tests.

I propose we add some hw event tests to the kernel tree. These will provide,

- regression tests
- a source of documentation for how to use the events

We should only test those hw events that are present on a user's machine; there's no sense in emulating things.

Thoughts?

[0] - https://lkml.kernel.org/r/[email protected]

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#1 lore raw
Quoted 8 lines · Matt Fleming

Folks,

In the process of writing perf support for Intel's Cache QoS Monitoring feature [0] I've had to write my own userland tests to drive tools/perf and indirectly the kernel internals. I'm now getting requests for these tests from various people and it occurs to me that they should probably live in the kernel tree.

Quoted 7 lines

The tests I've got do a couple of things like setting up a perf_event cgroup and assigning enough tasks to trigger the RMID recycling code in the CQM driver, ensuring that we can run multiple events simultaneously (that the event scheduling/rotation code works), etc.

Does anything like this already exist for hw events? I couldn't find anything specific to hw events from snooping around in tools/perf/tests.

that's the only place for this kind of stuff.. and AFAIK we use just some basic HW events like cycles, or software events

Quoted 6 lines

I propose we add some hw event tests to the kernel tree. These will provide,

- regression tests
- a source of documentation for how to use the events

yes, yes and yes ;-)

Quoted 2 lines

We should only test those hw events that are present on a user's machine; there's no sense in emulating things.

agreed.. I remember we were discussing with Arnaldo the strengthening of the test framework.. so it would detect what tests are runable under current machine and priviledge

IIRC we already have some CPU detection support:
int __attribute__ ((weak)) get_cpuid(char *buffer, size_t sz);

jirka

Quoted 7 lines

Thoughts?

[0] - https://lkml.kernel.org/r/[email protected]

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#3 lore raw
In reply to Matt Fleming

Em Thu, Jan 22, 2015 at 12:40:14PM +0000, Matt Fleming escreveu:

Quoted 13 lines

Folks,

In the process of writing perf support for Intel's Cache QoS Monitoring feature [0] I've had to write my own userland tests to drive tools/perf and indirectly the kernel internals. I'm now getting requests for these tests from various people and it occurs to me that they should probably live in the kernel tree.

The tests I've got do a couple of things like setting up a perf_event cgroup and assigning enough tasks to trigger the RMID recycling code in the CQM driver, ensuring that we can run multiple events simultaneously (that the event scheduling/rotation code works), etc.

Quoted 8 lines

Does anything like this already exist for hw events? I couldn't find anything specific to hw events from snooping around in tools/perf/tests.

I propose we add some hw event tests to the kernel tree. These will provide,

- regression tests
- a source of documentation for how to use the events

That is the description for tools/perf/tests/ please send your patches for adding new entries there.

Quoted 2 lines

We should only test those hw events that are present on a user's machine; there's no sense in emulating things.

At some point 'perf test' should grow infrastructure to specify what is required for a test so that it auto-skips those, possibly not even bothering the user telling something can't be tested. Right now for things like tests that requires finding a vmlinux, if it doesn't find it, it will just print "Skipped", etc.

Quoted 3 lines

Thoughts?

[0] - https://lkml.kernel.org/r/[email protected]

- Arnaldo

#2 lore raw
In reply to Jiri Olsa
Quoted 14 lines · Jiri Olsa
Quoted 13 lines · Matt Fleming

Folks,

In the process of writing perf support for Intel's Cache QoS Monitoring feature [0] I've had to write my own userland tests to drive tools/perf and indirectly the kernel internals. I'm now getting requests for these tests from various people and it occurs to me that they should probably live in the kernel tree.

The tests I've got do a couple of things like setting up a perf_event cgroup and assigning enough tasks to trigger the RMID recycling code in the CQM driver, ensuring that we can run multiple events simultaneously (that the event scheduling/rotation code works), etc.

Quoted 5 lines
Quoted 2 lines

Does anything like this already exist for hw events? I couldn't find anything specific to hw events from snooping around in tools/perf/tests.

that's the only place for this kind of stuff.. and AFAIK we use just some basic HW events like cycles, or software events

OK cool. I just wanted confirmation that tools/perf/tests was the best place for these tests.

Quoted 9 lines
Quoted 2 lines

We should only test those hw events that are present on a user's machine; there's no sense in emulating things.

agreed.. I remember we were discussing with Arnaldo the strengthening of the test framework.. so it would detect what tests are runable under current machine and priviledge

IIRC we already have some CPU detection support:
int __attribute__ ((weak)) get_cpuid(char *buffer, size_t sz);

Aha, excellent. I hadn't noticed this. It should be possible to build something on top of this.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#4 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 6 lines · Arnaldo Carvalho de Melo

At some point 'perf test' should grow infrastructure to specify what is required for a test so that it auto-skips those, possibly not even bothering the user telling something can't be tested. Right now for things like tests that requires finding a vmlinux, if it doesn't find it, it will just print "Skipped", etc.

Yeah, that makes sense. I'll take a look at that.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center