Jaroslav Kysela
aba51cd094
selftests: alsa - add PCM test
...
This initial code does a simple sample transfer tests. By default,
all PCM devices are detected and tested with short and long
buffering parameters for 4 seconds. If the sample transfer timing
is not in a +-100ms boundary, the test fails. Only the interleaved
buffering scheme is supported in this version.
The configuration may be modified with the configuration files.
A specific hardware configuration is detected and activated
using the sysfs regex matching. This allows to use the DMI string
(/sys/class/dmi/id/* tree) or any other system parameters
exposed in sysfs for the matching for the CI automation.
The configuration file may also specify the PCM device list to detect
the missing PCM devices.
v1..v2:
- added missing alsa-local.h header file
Cc: Mark Brown <broonie@kernel.org >
Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com >
Cc: Liam Girdwood <liam.r.girdwood@intel.com >
Cc: Jesse Barnes <jsbarnes@google.com >
Cc: Jimmy Cheng-Yi Chiang <cychiang@google.com >
Cc: Curtis Malainey <cujomalainey@google.com >
Cc: Brian Norris <briannorris@chromium.org >
Signed-off-by: Jaroslav Kysela <perex@perex.cz >
Reviewed-by: Mark Brown <broonie@kernel.org >
Link: https://lore.kernel.org/r/20221108115914.3751090-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de >
2022-11-16 15:02:17 +01:00
Namhyung Kim
4dd7ff4a03
perf stat: Add print_aggr_cgroup() for --for-each-cgroup and --topdown
...
Normally, --for-each-cgroup only works with AGGR_GLOBAL. However
the --topdown on some cpu (e.g. Intel Skylake) converts it to the
AGGR_CORE internally.
To support those machines, add print_aggr_cgroup and handle the events
like in print_cgroup_events().
$ perf stat -a --for-each-cgroup system.slice,user.slice --topdown sleep 1
nmi_watchdog enabled with topdown. May give wrong results.
Disable with echo 0 > /proc/sys/kernel/nmi_watchdog
Performance counter stats for 'system wide':
retiring bad speculation frontend bound backend bound
S0-D0-C0 2 system.slice 49.0% -46.6% 31.4%
S0-D0-C1 2 system.slice 55.5% 8.0% 45.5% -9.0%
S0-D0-C2 2 system.slice 87.8% 22.1% 30.3% -40.3%
S0-D0-C3 2 system.slice 53.3% -11.9% 45.2% 13.4%
S0-D0-C0 2 user.slice 123.5% 4.0% 48.5% -75.9%
S0-D0-C1 2 user.slice 19.9% 6.5% 89.9% -16.3%
S0-D0-C2 2 user.slice 29.9% 7.9% 71.3% -9.1
S0-D0-C3 2 user.slice 28.0% 7.2% 43.3% 21.5%
1.004136937 seconds time elapsed
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-20-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
67f8b7eb4e
perf stat: Support --for-each-cgroup and --metric-only
...
When we have events for each cgroup, the metric should be printed for
each cgroup separately. Add print_cgroup_counter() to handle that
situation properly.
Also change print_metric_headers() not to print duplicate headers
by checking cgroups.
$ perf stat -a --for-each-cgroup system.slice,user.slice --metric-only sleep 1
Performance counter stats for 'system wide':
GHz insn per cycle branch-misses of all branches
system.slice 3.792 0.61 3.24%
user.slice 3.661 2.32 0.37%
1.016111516 seconds time elapsed
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-19-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
78670daefd
perf stat: Factor out print_metric_{begin,end}()
...
For the metric-only case, add new functions to handle the start and the
end of each metric display.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-18-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
2cf38236d9
perf stat: Factor out prefix display
...
The prefix is needed for interval mode to print timestamp at the
beginning of each line. But the it's tricky for the metric only
mode since it doesn't print every evsel and combines the metrics
into a single line.
So it needed to pass 'first' argument to print_counter_aggrdata()
to determine if the current event is being printed at first. This
makes the code hard to read.
Let's move the logic out of the function and do it in the outer
print loop. This would enable further cleanups later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-17-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
453279d573
perf stat: Move condition to print_footer()
...
Likewise, I think it'd better to have the control inside the function, and keep
the higher level function clearer.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-16-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
4c86b664f4
perf stat: Rework header display
...
There are print_header() and print_interval() to print header lines before
actual counter values. Also print_metric_headers() needs to be called for
the metric-only case.
Let's move all these logics to a single place including num_print_iv to
refresh the headers for interval mode.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-15-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
6108712c07
perf stat: Remove impossible condition
...
The print would run only if metric_only is not set, but it's already in a
block that says it's in metric_only case. And there's no place to change
the setting.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-14-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:23 -03:00
Namhyung Kim
33c4ed4799
perf stat: Cleanup interval print alignment
...
Instead of using magic values, define symbolic constants and use them.
Also add aggr_header_std[] array to simplify aggr_mode handling.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-13-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
208cbcd21b
perf stat: Factor out prepare_interval()
...
This logic does not print the time directly, but it just puts the
timestamp in the buffer as a prefix. To reduce the confusion, factor
out the code into a separate function.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-12-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
b2d9832e00
perf stat: Split print_metric_headers() function
...
The print_metric_headers() shows metric headers a little bit for each
mode. Split it out to make the code clearer.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-11-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
8d500292bd
perf stat: Align cgroup names
...
We don't know how long cgroup name is, but at least we can align short
ones like below.
$ perf stat -a --for-each-cgroup system.slice,user.slice true
Performance counter stats for 'system wide':
0.13 msec cpu-clock system.slice # 0.010 CPUs utilized
4 context-switches system.slice # 31.989 K/sec
1 cpu-migrations system.slice # 7.997 K/sec
0 page-faults system.slice # 0.000 /sec
450,673 cycles system.slice # 3.604 GHz (92.41%)
161,216 instructions system.slice # 0.36 insn per cycle (92.41%)
32,678 branches system.slice # 261.332 M/sec (92.41%)
2,628 branch-misses system.slice # 8.04% of all branches (92.41%)
14.29 msec cpu-clock user.slice # 1.163 CPUs utilized
35 context-switches user.slice # 2.449 K/sec
12 cpu-migrations user.slice # 839.691 /sec
57 page-faults user.slice # 3.989 K/sec
49,683,026 cycles user.slice # 3.477 GHz (99.38%)
110,790,266 instructions user.slice # 2.23 insn per cycle (99.38%)
24,552,255 branches user.slice # 1.718 G/sec (99.38%)
127,779 branch-misses user.slice # 0.52% of all branches (99.38%)
0.012289431 seconds time elapsed
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-10-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
df46a3c92b
perf stat: Add before_metric argument
...
Unfortunately, event running time, percentage and noise data are printed
in different positions in normal output than CSV/JSON. I think it's
better to put such details in where it actually prints.
So add before_metric argument to print_noise() and print_running() and
call them twice before and after the metric.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-9-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
d6aeb861b1
perf stat: Handle bad events in abs_printout()
...
In the printout() function, it checks if the event is bad (i.e. not
counted or not supported) and print the result. But it does the same
what abs_printout() is doing. So add an argument to indicate the value
is ok or not and use the same function in both cases.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
c2019f844e
perf stat: Factor out print_counter_value() function
...
And split it for each output mode like others. I believe it makes the
code simpler and more intuitive. Now abs_printout() becomes just to
call sub-functions.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
33b2e2c2ad
perf stat: Split aggr_printout() function
...
The aggr_printout() function is to print aggr_id and count (nr).
Split it for each output mode to simplify the code.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
41cb875242
perf stat: Split print_cgroup() function
...
Likewise, split print_cgroup() for each output mode.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
def99d60df
perf stat: Split print_noise_pct() function
...
Likewise, split print_noise_pct() for each output mode. Although it's
a tiny function, more logic will be added soon so it'd be better split
it and treat it in the same way.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
31bf6aea99
perf stat: Split print_running() function
...
To make the code more obvious and hopefully simpler, factor out the
code for each output mode - stdio, CSV, JSON.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Namhyung Kim
f5bc4428cc
perf stat: Clear screen only if output file is a tty
...
The --interval-clear option makes perf stat to clear the terminal at
each interval. But it doesn't need to clear the screen when it saves
to a file. Make it fail when it's enabled with the output options.
$ perf stat -I 1 --interval-clear -o myfile true
--interval-clear does not work with output
Usage: perf stat [<options>] [<command>]
-o, --output <file> output file name
--log-fd <n> log output to fd, instead of stderr
--interval-clear clear screen in between new interval
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221114230227.1255976-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-16 09:51:22 -03:00
Eduard Zingerman
5b1d640800
selftests/bpf: allow unpriv bpf for selftests by default
...
Enable unprivileged bpf for selftests kernel by default.
This forces CI to run test_verifier tests in both privileged
and unprivileged modes.
The test_verifier.c:do_test uses sysctl kernel.unprivileged_bpf_disabled
to decide whether to run or to skip test cases in unprivileged mode.
The CONFIG_BPF_UNPRIV_DEFAULT_OFF controls the default value of the
kernel.unprivileged_bpf_disabled.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com >
Link: https://lore.kernel.org/r/20221116015456.2461135-1-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-11-15 21:38:04 -08:00
Tiezhu Yang
df9c41e9db
bpftool: Check argc first before "file" in do_batch()
...
If the parameters for batch are more than 2, check argc first can
return immediately, no need to use is_prefix() to check "file" with
a little overhead and then check argc, it is better to check "file"
only when the parameters for batch are 2.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn >
Acked-by: Stanislav Fomichev <sdf@google.com >
Reviewed-by: Quentin Monnet <quentin@isovalent.com >
Link: https://lore.kernel.org/r/1668517207-11822-1-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-11-15 21:36:24 -08:00
Eduard Zingerman
4741c371aa
selftests/bpf: check nullness propagation for reg to reg comparisons
...
Verify that nullness information is porpagated in the branches of
register to register JEQ and JNE operations.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com >
Acked-by: Yonghong Song <yhs@fb.com >
Link: https://lore.kernel.org/r/20221115224859.2452988-3-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-11-15 17:38:36 -08:00
Alexandre Belloni
35eee9a363
selftests: rtc: skip when RTC is not present
...
There is no point in failing the tests when RTC is not present.
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Tested-by: Daniel Diaz <daniel.diaz@linaro.org >
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org >
2022-11-15 13:30:51 -07:00
Borislav Petkov
2632daebaf
x86/cpu: Restore AMD's DE_CFG MSR after resume
...
DE_CFG contains the LFENCE serializing bit, restore it on resume too.
This is relevant to older families due to the way how they do S3.
Unify and correct naming while at it.
Fixes: e4d0e84e49 ("x86/cpu/AMD: Make LFENCE a serializing instruction")
Reported-by: Andrew Cooper <Andrew.Cooper3@citrix.com >
Reported-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: <stable@kernel.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-11-15 10:15:58 -08:00
Benjamin Tissoires
80e189f2af
selftests/hid: Add a test for BPF_F_INSERT_HEAD
...
Insert 3 programs to check that we are doing the correct thing:
'2', '1', '3' are inserted, but '1' is supposed to be executed first.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
2022-11-15 16:28:39 +01:00
Benjamin Tissoires
e8445737c0
selftests/hid: add report descriptor fixup tests
...
Simple report descriptor override in HID: replace part of the report
descriptor from a static definition in the bpf kernel program.
Note that this test should be run last because we disconnect/reconnect
the device, meaning that it changes the overall uhid device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
2022-11-15 16:28:39 +01:00
Benjamin Tissoires
4f7153cf46
selftests/hid: add tests for bpf_hid_hw_request
...
Add tests for the newly implemented function.
We test here only the GET_REPORT part because the other calls are pure
HID protocol and won't infer the result of the test of the bpf hook.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
2022-11-15 16:28:31 +01:00
Benjamin Tissoires
0330f725cc
selftests/hid: add test to change the report size
...
Use a different report with a bigger size and ensures we are doing
things properly.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
2022-11-15 16:28:30 +01:00
Benjamin Tissoires
dbb60c8a26
selftests: add tests for the HID-bpf initial implementation
...
The tests are pretty basic:
- create a virtual uhid device that no userspace will like (to not mess
up the running system)
- attach a BPF prog to it
- open the matching hidraw node
- inject one event and check:
* that the BPF program can do something on the event stream
* can modify the event stream
- add another test where we attach/detach BPF programs to see if we get
errors
Note: the Makefile is extracted from selftests/bpf so we can rebuild
the libbpf and bpftool components from the current kernel tree without
relying on system installed components.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
2022-11-15 16:28:29 +01:00
Ian Rogers
eb2d4514a5
perf pmu: Restructure print_pmu_events() to avoid memory allocations
...
Previously print_pmu_events() would compute the values to be printed,
place them in struct sevent, sort them and then print them.
Modify the code so that struct sevent holds just the PMU and event, sort
these and then in the main print loop calculate aliases for names, etc.
This avoids memory allocations for copied values as they are computed
then printed.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-9-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:34:32 -03:00
Ian Rogers
de3752a7d6
perf list: Simplify symbol event printing
...
The current code computes an array of symbol names then sorts and prints
them. Use a strlist to create a list of names that is sorted and then
print it.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-8-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:33:25 -03:00
Ian Rogers
3301b3fe9b
perf list: Simplify cache event printing
...
The current code computes an array of cache names then sorts and prints
them. Use a strlist to create a list of names that is sorted. Keep the
hybrid names, it is unclear how to generalize it, but drop the
computation of evt_pmus that is never used.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kang Minchul <tegongkang@gmail.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-7-irogers@google.com
[ Fixed up clash with cf9f67b363 ("perf print-events: Remove redundant comparison with zero")]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:31:12 -03:00
Ian Rogers
ca0fe62413
perf list: Generalize limiting to a PMU name
...
Deprecate the --cputype option and add a --unit option where '--unit
cpu_atom' behaves like '--cputype atom'. The --unit option can be used
with arbitrary PMUs, for example:
```
$ perf list --unit msr pmu
List of pre-defined events (to be used in -e or -M):
msr/aperf/ [Kernel PMU event]
msr/cpu_thermal_margin/ [Kernel PMU event]
msr/mperf/ [Kernel PMU event]
msr/pperf/ [Kernel PMU event]
msr/smi/ [Kernel PMU event]
msr/tsc/ [Kernel PMU event]
```
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:25:48 -03:00
Ian Rogers
d74060c033
perf tracepoint: Sort events in iterator
...
In print_tracepoint_events() use tracing_events__scandir_alphasort() and
scandir alphasort so that the subsystem and events are sorted and don't
need a secondary qsort. Locally this results in the following change:
...
ext4:ext4_zero_range [Tracepoint event]
- fib6:fib6_table_lookup [Tracepoint event]
fib:fib_table_lookup [Tracepoint event]
+ fib6:fib6_table_lookup [Tracepoint event]
filelock:break_lease_block [Tracepoint event]
...
ie fib6 now is after fib and not before it. This is more consistent
with how numbers are more generally sorted, such as:
...
syscalls:sys_enter_renameat [Tracepoint event]
syscalls:sys_enter_renameat2 [Tracepoint event]
...
and so an improvement over the qsort approach.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:25:15 -03:00
Ian Rogers
1504b6f97b
tools lib api fs tracing_path: Add scandir alphasort
...
tracing_events__opendir() allows iteration over files in
<debugfs>/tracing/events but with an arbitrary sort order.
Add a scandir alternative where the results are alphabetically sorted.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:24:09 -03:00
Ian Rogers
fe13d43d07
perf pmu: Add data structure documentation
...
Add documentation to 'struct perf_pmu' and the associated structs of
'perf_pmu_alias' and 'perf_pmu_format'.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:23:12 -03:00
Ian Rogers
e5f4afbe39
perf pmu: Remove mostly unused 'struct perf_pmu' 'is_hybrid' member
...
Replace usage with perf_pmu__is_hybrid().
Suggested-by: Kan Liang <kan.liang@linux.intel.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Rob Herring <robh@kernel.org >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Weilin Wang <weilin.wang@intel.com >
Cc: Xin Gao <gaoxin@cdjrlc.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: http://lore.kernel.org/lkml/20221114210723.2749751-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-15 10:15:24 -03:00
Kumar Kartikeya Dwivedi
894f2a8b16
bpf: Rename MEM_ALLOC to MEM_RINGBUF
...
Currently, verifier uses MEM_ALLOC type tag to specially tag memory
returned from bpf_ringbuf_reserve helper. However, this is currently
only used for this purpose and there is an implicit assumption that it
only refers to ringbuf memory (e.g. the check for ARG_PTR_TO_ALLOC_MEM
in check_func_arg_reg_off).
Hence, rename MEM_ALLOC to MEM_RINGBUF to indicate this special
relationship and instead open the use of MEM_ALLOC for more generic
allocations made for user types.
Also, since ARG_PTR_TO_ALLOC_MEM_OR_NULL is unused, simply drop it.
Finally, update selftests using 'alloc_' verifier string to 'ringbuf_'.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com >
Link: https://lore.kernel.org/r/20221114191547.1694267-7-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-11-14 21:52:45 -08:00
Kumar Kartikeya Dwivedi
f0c5941ff5
bpf: Support bpf_list_head in map values
...
Add the support on the map side to parse, recognize, verify, and build
metadata table for a new special field of the type struct bpf_list_head.
To parameterize the bpf_list_head for a certain value type and the
list_node member it will accept in that value type, we use BTF
declaration tags.
The definition of bpf_list_head in a map value will be done as follows:
struct foo {
struct bpf_list_node node;
int data;
};
struct map_value {
struct bpf_list_head head __contains(foo, node);
};
Then, the bpf_list_head only allows adding to the list 'head' using the
bpf_list_node 'node' for the type struct foo.
The 'contains' annotation is a BTF declaration tag composed of four
parts, "contains:name:node" where the name is then used to look up the
type in the map BTF, with its kind hardcoded to BTF_KIND_STRUCT during
the lookup. The node defines name of the member in this type that has
the type struct bpf_list_node, which is actually used for linking into
the linked list. For now, 'kind' part is hardcoded as struct.
This allows building intrusive linked lists in BPF, using container_of
to obtain pointer to entry, while being completely type safe from the
perspective of the verifier. The verifier knows exactly the type of the
nodes, and knows that list helpers return that type at some fixed offset
where the bpf_list_node member used for this list exists. The verifier
also uses this information to disallow adding types that are not
accepted by a certain list.
For now, no elements can be added to such lists. Support for that is
coming in future patches, hence draining and freeing items is done with
a TODO that will be resolved in a future patch.
Note that the bpf_list_head_free function moves the list out to a local
variable under the lock and releases it, doing the actual draining of
the list items outside the lock. While this helps with not holding the
lock for too long pessimizing other concurrent list operations, it is
also necessary for deadlock prevention: unless every function called in
the critical section would be notrace, a fentry/fexit program could
attach and call bpf_map_update_elem again on the map, leading to the
same lock being acquired if the key matches and lead to a deadlock.
While this requires some special effort on part of the BPF programmer to
trigger and is highly unlikely to occur in practice, it is always better
if we can avoid such a condition.
While notrace would prevent this, doing the draining outside the lock
has advantages of its own, hence it is used to also fix the deadlock
related problem.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com >
Link: https://lore.kernel.org/r/20221114191547.1694267-5-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2022-11-14 21:52:45 -08:00
Breno Leitao
35b7fa4ed1
kselftest/cgroup: Fix gathering number of CPUs
...
test_cpuset_prs.sh is failing with the following error:
test_cpuset_prs.sh: line 29: [[: 8
57%: syntax error in expression (error token is "57%")
This is happening because `lscpu | grep "^CPU(s)"` returns two lines in
some systems (such as Debian unstable):
# lscpu | grep "^CPU(s)"
CPU(s): 8
CPU(s) scaling MHz: 55%
This is a simple fix that discard the second line.
Signed-off-by: Breno Leitao <leitao@debian.org >
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com >
Signed-off-by: Tejun Heo <tj@kernel.org >
2022-11-14 11:37:56 -10:00
Kang Minchul
b486d19a0a
libbpf: checkpatch: Fixed code alignments in ringbuf.c
...
Fixed some checkpatch issues in ringbuf.c
Signed-off-by: Kang Minchul <tegongkang@gmail.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Stanislav Fomichev <sdf@google.com >
Link: https://lore.kernel.org/bpf/20221113190648.38556-4-tegongkang@gmail.com
2022-11-14 11:43:17 -08:00
Kang Minchul
e3ba8e4e8c
libbpf: Fixed various checkpatch issues in libbpf.c
...
Fixed following checkpatch issues:
WARNING: Block comments use a trailing */ on a separate line
+ * other BPF program's BTF object */
WARNING: Possible repeated word: 'be'
+ * name. This is important to be be able to find corresponding BTF
ERROR: switch and case should be at the same indent
+ switch (ext->kcfg.sz) {
+ case 1: *(__u8 *)ext_val = value; break;
+ case 2: *(__u16 *)ext_val = value; break;
+ case 4: *(__u32 *)ext_val = value; break;
+ case 8: *(__u64 *)ext_val = value; break;
+ default:
ERROR: trailing statements should be on next line
+ case 1: *(__u8 *)ext_val = value; break;
ERROR: trailing statements should be on next line
+ case 2: *(__u16 *)ext_val = value; break;
ERROR: trailing statements should be on next line
+ case 4: *(__u32 *)ext_val = value; break;
ERROR: trailing statements should be on next line
+ case 8: *(__u64 *)ext_val = value; break;
ERROR: code indent should use tabs where possible
+ }$
WARNING: please, no spaces at the start of a line
+ }$
WARNING: Block comments use a trailing */ on a separate line
+ * for faster search */
ERROR: code indent should use tabs where possible
+^I^I^I^I^I^I &ext->kcfg.is_signed);$
WARNING: braces {} are not necessary for single statement blocks
+ if (err) {
+ return err;
+ }
ERROR: code indent should use tabs where possible
+^I^I^I^I sizeof(*obj->btf_modules), obj->btf_module_cnt + 1);$
Signed-off-by: Kang Minchul <tegongkang@gmail.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Stanislav Fomichev <sdf@google.com >
Link: https://lore.kernel.org/bpf/20221113190648.38556-3-tegongkang@gmail.com
2022-11-14 11:43:06 -08:00
Kang Minchul
c7694ac340
libbpf: checkpatch: Fixed code alignments in btf.c
...
Fixed some checkpatch issues in btf.c
Signed-off-by: Kang Minchul <tegongkang@gmail.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Stanislav Fomichev <sdf@google.com >
Link: https://lore.kernel.org/bpf/20221113190648.38556-2-tegongkang@gmail.com
2022-11-14 11:42:53 -08:00
Jiri Olsa
5fd2a60aec
libbpf: Use correct return pointer in attach_raw_tp
...
We need to pass '*link' to final libbpf_get_error,
because that one holds the return value, not 'link'.
Fixes: 4fa5bcfe07 ("libbpf: Allow BPF program auto-attach handlers to bail out")
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Link: https://lore.kernel.org/bpf/20221114145257.882322-1-jolsa@kernel.org
2022-11-14 11:36:55 -08:00
Namhyung Kim
7565f9617e
perf stat: Add missing separator in the CSV header
...
It should have a comma after 'cpus' for socket and die aggregation mode.
The output of the following command shows the issue.
$ sudo perf stat -a --per-socket -x, --metric-only -I1 true
Before:
+--- here
V
time,socket,cpusGhz,insn per cycle,branch-misses of all branches,
0.000908461,S0,8,0.950,1.65,1.21,
After:
time,socket,cpus,GHz,insn per cycle,branch-misses of all branches,
0.000683094,S0,8,0.593,2.00,0.60,
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221112032244.1077370-12-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-14 16:18:52 -03:00
Namhyung Kim
a80e0e156c
perf stat: Fix summary output in CSV with --metric-only
...
It should not print "summary" for each event when --metric-only is set.
Before:
$ sudo perf stat -a --per-socket --summary -x, --metric-only true
time,socket,cpusGhz,insn per cycle,branch-misses of all branches,
0.000709079,S0,8,0.893,2.40,0.45,
S0,8, summary, summary, summary, summary, summary,0.893, summary,2.40, summary, summary,0.45,
After:
$ sudo perf stat -a --per-socket --summary -x, --metric-only true
time,socket,cpusGHz,insn per cycle,branch-misses of all branches,
0.000882297,S0,8,0.598,1.64,0.64,
summary,S0,8,0.598,1.64,0.64,
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20221112032244.1077370-11-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-14 16:18:34 -03:00
Arnaldo Carvalho de Melo
638c335a47
Merge remote-tracking branch 'torvalds/master' into perf/core
...
To pick up fixes that went thru perf/urgent.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-11-14 16:12:23 -03:00
Dan Williams
76f1911084
tools/testing/cxl: Add bridge mocking support
...
In preparation for cxl_acpi walking pci_root->bus->bridge, add that
association to the mock pci_root instances.
Note that the missing 3rd entry in mock_pci_root[] was not noticed until
now given that the test version of to_cxl_host_bridge()
(tools/testing/cxl/mock_acpi.c), obviated the need for that entry.
However, "cxl/acpi: Improve debug messages in cxl_acpi_probe()" [1]
needs pci_root->bus->bridge to be populated.
Link: https://lore.kernel.org/r/20221018132341.76259-6-rrichter@amd.com [1]
Cc: Robert Richter <rrichter@amd.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
2022-11-14 10:39:10 -08:00
Robert Richter
58eef878fc
cxl: Unify debug messages when calling devm_cxl_add_dport()
...
CXL dports are added in a couple of code paths using
devm_cxl_add_dport(). Debug messages are individually generated, but are
incomplete and inconsistent. Change this by moving its generation to
devm_cxl_add_dport(). This unifies the messages and reduces code
duplication. Also, generate messages on failure. Use a
__devm_cxl_add_dport() wrapper to keep the readability of the error
exits.
Signed-off-by: Robert Richter <rrichter@amd.com >
Link: https://lore.kernel.org/r/20221018132341.76259-5-rrichter@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
2022-11-14 10:37:08 -08:00