Skip to contentSkip to conversation

perf-trace: improving ioctl details

DISCUSSION David Ahern 3 participants 5 messages Feb 18 – Feb 26

lore
Share & tools
lore
#0 lore raw

Hi Arnaldo, Namhyung:

I have a couple of patches to perf-trace to improve the details on ioctl calls. The first one tracks stats by individual filenames, and for the summary output prints the ioctl stats per filename.

The second patch improves the output for the _IOC_NR element of the op argument. For flexibility across kernel versions and drivers, it adds the ability to read input files that contain the conversion from number to human readable name. The files (if the option is set) are parsed at start up. In addition to the summary, the cache is also used to improve the readability of each ioctl line.

Questions for you:
1. is such an open ended design acceptable for perf-trace?

2. if yes, is there any preference on file format (json, yaml, key-value, ...)?

Thanks,
David

#1 lore raw
Quoted 6 lines · David Ahern

Hi Arnaldo, Namhyung:

I have a couple of patches to perf-trace to improve the details on ioctl calls. The first one tracks stats by individual filenames, and for the summary output prints the ioctl stats per filename.

Looks interesting!

Quoted 9 lines

The second patch improves the output for the _IOC_NR element of the op argument. For flexibility across kernel versions and drivers, it adds the ability to read input files that contain the conversion from number to human readable name. The files (if the option is set) are parsed at start up. In addition to the summary, the cache is also used to improve the readability of each ioctl line.

Questions for you:
1. is such an open ended design acceptable for perf-trace?

Is it lazy, i.e. only when needed this cache/table gets loaded?

Quoted 3 lines

2. if yes, is there any preference on file format (json, yaml, key-value, ...)?

We already have JSON parsing infra, so probably that is better?

Great to see you contributing to perf again!

- Arnaldo

Quoted 3 lines

Thanks,
David

- Arnaldo

#2 lore raw

Hi David!

Quoted 11 lines · Arnaldo Melo
Quoted 6 lines · David Ahern

Hi Arnaldo, Namhyung:

I have a couple of patches to perf-trace to improve the details on ioctl calls. The first one tracks stats by individual filenames, and for the summary output prints the ioctl stats per filename.

Looks interesting!

Indeed.

Quoted 9 lines
Quoted 9 lines

The second patch improves the output for the _IOC_NR element of the op argument. For flexibility across kernel versions and drivers, it adds the ability to read input files that contain the conversion from number to human readable name. The files (if the option is set) are parsed at start up. In addition to the summary, the cache is also used to improve the readability of each ioctl line.

Quoted 4 lines
Quoted 2 lines

Questions for you:
1. is such an open ended design acceptable for perf-trace?

Is it lazy, i.e. only when needed this cache/table gets loaded?

I think it's ok. But I'm curious what's the actual usecases.. do you want it for testing kernels and drivers? I guess we can have a default table for regular users and provide the option for kernel developers.

Quoted 6 lines
Quoted 4 lines

2. if yes, is there any preference on file format (json, yaml, key-value, ...)?

We already have JSON parsing infra, so probably that is better?

JSON should be fine, although it's a bit verbose. I'm fine with plain KEY=VALUE format too if it's really a simple mapping.

Quoted 2 lines

Great to see you contributing to perf again!

+1

Thanks,
Namhyung

#3 lore raw

Sorry for the delayed response; my time seems to evaporate these days.

Quoted 8 lines · Namhyung Kim
Quoted 4 lines
Quoted 2 lines

Questions for you:
1. is such an open ended design acceptable for perf-trace?

Is it lazy, i.e. only when needed this cache/table gets loaded?

I think it's ok. But I'm curious what's the actual usecases.. do you want it for testing kernels and drivers? I guess we can have a default table for regular users and provide the option for kernel developers.

The idea is that ioctl is a very open ended and overloaded uapi, and I wanted better granularity on how that time was spent. The breakdown by filename and NR is one level; improving human readability of the NR is another.

For the latter, if you look at tools/perf/trace/beauty/ioctl.c, you can see how human readability for NRs has been improved for specific subsystems tty, drm, pcm, kvm, ... (the table in ioctl__scnprintf_cmd), but that design is not going to scale for all of the devices and drivers, especially those with dynamic major numbers. Allowing runtime loading of files seemed like an easy way to accommodate the range of ioctl users in a flexible way. (though it too has limitations given the multiplexing on specific NRs)

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

2. if yes, is there any preference on file format (json, yaml, key-value, ...)?

We already have JSON parsing infra, so probably that is better?

json is used for the PMU files, but it seems to be used only for code generation (pmu-events/pmu-events.c) at build time, not run time loading which I was targeting. Hence the question on format.

Quoted 3 lines

JSON should be fine, although it's a bit verbose. I'm fine with plain KEY=VALUE format too if it's really a simple mapping.

key=value format is what I have now. The only awkwardness is a header to declare the filename it corresponds to and then a further complication is the need for a wildcard format as there are examples that have multiple instances (e.g., /dev/infiniband/uverbs*).

Quoted 6 lines
Quoted 3 lines

Great to see you contributing to perf again!

+1

Thanks. perf-trace code has changed quite a bit over the past 10 years.

#4 lore raw
Quoted 1 line · David Ahern

Sorry for the delayed response; my time seems to evaporate these days.

:)

Quoted 16 lines · Namhyung Kim
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Questions for you:
1. is such an open ended design acceptable for perf-trace?

Is it lazy, i.e. only when needed this cache/table gets loaded?

I think it's ok. But I'm curious what's the actual usecases.. do you want it for testing kernels and drivers? I guess we can have a default table for regular users and provide the option for kernel developers.

The idea is that ioctl is a very open ended and overloaded uapi, and I wanted better granularity on how that time was spent. The breakdown by filename and NR is one level; improving human readability of the NR is another.

Quoted 8 lines

For the latter, if you look at tools/perf/trace/beauty/ioctl.c, you can see how human readability for NRs has been improved for specific subsystems tty, drm, pcm, kvm, ... (the table in ioctl__scnprintf_cmd), but that design is not going to scale for all of the devices and drivers, especially those with dynamic major numbers. Allowing runtime loading of files seemed like an easy way to accommodate the range of ioctl users in a flexible way. (though it too has limitations given the multiplexing on specific NRs)

I see. So would your patch match ioctl by name instead of number? I'm curious if we can do the same in the beautifier code to handle dynamic numbers.. maybe after checking static numbers.

Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

2. if yes, is there any preference on file format (json, yaml, key-value, ...)?

We already have JSON parsing infra, so probably that is better?

json is used for the PMU files, but it seems to be used only for code generation (pmu-events/pmu-events.c) at build time, not run time loading which I was targeting. Hence the question on format.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

JSON should be fine, although it's a bit verbose. I'm fine with plain KEY=VALUE format too if it's really a simple mapping.

key=value format is what I have now. The only awkwardness is a header to declare the filename it corresponds to and then a further complication is the need for a wildcard format as there are examples that have multiple instances (e.g., /dev/infiniband/uverbs*).

I think it's ok as we have config files with this format:

[section]

    # comment
    key = value
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Great to see you contributing to perf again!

+1

Thanks. perf-trace code has changed quite a bit over the past 10 years.

Yes, it does. :)

Thanks,
Namhyung