mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'perf-tools-fixes-2021-01-17' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix 'CPU too large' error in Intel PT - Correct event attribute sizes in 'perf inject' - Sync build_bug.h and kvm.h kernel copies - Fix bpf.h header include directive in 5sec.c 'perf trace' bpf example - libbpf tests fixes - Fix shadow stat 'perf test' for non-bash shells - Take cgroups into account for shadow stats in 'perf stat' * tag 'perf-tools-fixes-2021-01-17' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf inject: Correct event attribute sizes perf intel-pt: Fix 'CPU too large' error perf stat: Take cgroups into account for shadow stats perf stat: Introduce struct runtime_stat_data libperf tests: Fail when failing to get a tracepoint id libperf tests: If a test fails return non-zero libperf tests: Avoid uninitialized variable warning perf test: Fix shadow stat test for non-bash shells tools headers: Syncronize linux/build_bug.h with the kernel sources tools headers UAPI: Sync kvm.h headers with the kernel sources perf bpf examples: Fix bpf.h header include directive in 5sec.c example
This commit is contained in:
@@ -79,9 +79,4 @@
|
||||
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
|
||||
#endif // static_assert
|
||||
|
||||
#ifdef __GENKSYMS__
|
||||
/* genksyms gets confused by _Static_assert */
|
||||
#define _Static_assert(expr, ...)
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_BUILD_BUG_H */
|
||||
|
||||
@@ -251,6 +251,7 @@ struct kvm_hyperv_exit {
|
||||
#define KVM_EXIT_X86_RDMSR 29
|
||||
#define KVM_EXIT_X86_WRMSR 30
|
||||
#define KVM_EXIT_DIRTY_RING_FULL 31
|
||||
#define KVM_EXIT_AP_RESET_HOLD 32
|
||||
|
||||
/* For KVM_EXIT_INTERNAL_ERROR */
|
||||
/* Emulate instruction failed. */
|
||||
@@ -573,6 +574,7 @@ struct kvm_vapic_addr {
|
||||
#define KVM_MP_STATE_CHECK_STOP 6
|
||||
#define KVM_MP_STATE_OPERATING 7
|
||||
#define KVM_MP_STATE_LOAD 8
|
||||
#define KVM_MP_STATE_AP_RESET_HOLD 9
|
||||
|
||||
struct kvm_mp_state {
|
||||
__u32 mp_state;
|
||||
|
||||
@@ -27,5 +27,5 @@ int main(int argc, char **argv)
|
||||
perf_cpu_map__put(cpus);
|
||||
|
||||
__T_END;
|
||||
return 0;
|
||||
return tests_failed == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -208,13 +208,13 @@ static int test_mmap_thread(void)
|
||||
char path[PATH_MAX];
|
||||
int id, err, pid, go_pipe[2];
|
||||
union perf_event *event;
|
||||
char bf;
|
||||
int count = 0;
|
||||
|
||||
snprintf(path, PATH_MAX, "%s/kernel/debug/tracing/events/syscalls/sys_enter_prctl/id",
|
||||
sysfs__mountpoint());
|
||||
|
||||
if (filename__read_int(path, &id)) {
|
||||
tests_failed++;
|
||||
fprintf(stderr, "error: failed to get tracepoint id: %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
@@ -229,6 +229,7 @@ static int test_mmap_thread(void)
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
int i;
|
||||
char bf;
|
||||
|
||||
read(go_pipe[0], &bf, 1);
|
||||
|
||||
@@ -266,7 +267,7 @@ static int test_mmap_thread(void)
|
||||
perf_evlist__enable(evlist);
|
||||
|
||||
/* kick the child and wait for it to finish */
|
||||
write(go_pipe[1], &bf, 1);
|
||||
write(go_pipe[1], "A", 1);
|
||||
waitpid(pid, NULL, 0);
|
||||
|
||||
/*
|
||||
@@ -409,5 +410,5 @@ int main(int argc, char **argv)
|
||||
test_mmap_cpus();
|
||||
|
||||
__T_END;
|
||||
return 0;
|
||||
return tests_failed == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -131,5 +131,5 @@ int main(int argc, char **argv)
|
||||
test_stat_thread_enable();
|
||||
|
||||
__T_END;
|
||||
return 0;
|
||||
return tests_failed == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ int main(int argc, char **argv)
|
||||
perf_thread_map__put(threads);
|
||||
|
||||
__T_END;
|
||||
return 0;
|
||||
return tests_failed == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
Copyright (C) 2018 Red Hat, Inc., Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
*/
|
||||
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf.h>
|
||||
|
||||
#define NSEC_PER_SEC 1000000000L
|
||||
|
||||
|
||||
@@ -9,31 +9,29 @@ perf stat -a true > /dev/null 2>&1 || exit 2
|
||||
|
||||
test_global_aggr()
|
||||
{
|
||||
local cyc
|
||||
|
||||
perf stat -a --no-big-num -e cycles,instructions sleep 1 2>&1 | \
|
||||
grep -e cycles -e instructions | \
|
||||
while read num evt hash ipc rest
|
||||
do
|
||||
# skip not counted events
|
||||
if [[ $num == "<not" ]]; then
|
||||
if [ "$num" = "<not" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# save cycles count
|
||||
if [[ $evt == "cycles" ]]; then
|
||||
if [ "$evt" = "cycles" ]; then
|
||||
cyc=$num
|
||||
continue
|
||||
fi
|
||||
|
||||
# skip if no cycles
|
||||
if [[ -z $cyc ]]; then
|
||||
if [ -z "$cyc" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# use printf for rounding and a leading zero
|
||||
local res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)`
|
||||
if [[ $ipc != $res ]]; then
|
||||
res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)`
|
||||
if [ "$ipc" != "$res" ]; then
|
||||
echo "IPC is different: $res != $ipc ($num / $cyc)"
|
||||
exit 1
|
||||
fi
|
||||
@@ -42,32 +40,32 @@ test_global_aggr()
|
||||
|
||||
test_no_aggr()
|
||||
{
|
||||
declare -A results
|
||||
|
||||
perf stat -a -A --no-big-num -e cycles,instructions sleep 1 2>&1 | \
|
||||
grep ^CPU | \
|
||||
while read cpu num evt hash ipc rest
|
||||
do
|
||||
# skip not counted events
|
||||
if [[ $num == "<not" ]]; then
|
||||
if [ "$num" = "<not" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# save cycles count
|
||||
if [[ $evt == "cycles" ]]; then
|
||||
results[$cpu]=$num
|
||||
if [ "$evt" = "cycles" ]; then
|
||||
results="$results $cpu:$num"
|
||||
continue
|
||||
fi
|
||||
|
||||
cyc=${results##* $cpu:}
|
||||
cyc=${cyc%% *}
|
||||
|
||||
# skip if no cycles
|
||||
local cyc=${results[$cpu]}
|
||||
if [[ -z $cyc ]]; then
|
||||
if [ -z "$cyc" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# use printf for rounding and a leading zero
|
||||
local res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)`
|
||||
if [[ $ipc != $res ]]; then
|
||||
res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)`
|
||||
if [ "$ipc" != "$res" ]; then
|
||||
echo "IPC is different for $cpu: $res != $ipc ($num / $cyc)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -3323,6 +3323,14 @@ int perf_session__write_header(struct perf_session *session,
|
||||
attr_offset = lseek(ff.fd, 0, SEEK_CUR);
|
||||
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
if (evsel->core.attr.size < sizeof(evsel->core.attr)) {
|
||||
/*
|
||||
* We are likely in "perf inject" and have read
|
||||
* from an older file. Update attr size so that
|
||||
* reader gets the right offset to the ids.
|
||||
*/
|
||||
evsel->core.attr.size = sizeof(evsel->core.attr);
|
||||
}
|
||||
f_attr = (struct perf_file_attr){
|
||||
.attr = evsel->core.attr,
|
||||
.ids = {
|
||||
|
||||
@@ -2980,7 +2980,7 @@ int machines__for_each_thread(struct machines *machines,
|
||||
|
||||
pid_t machine__get_current_tid(struct machine *machine, int cpu)
|
||||
{
|
||||
int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
|
||||
int nr_cpus = min(machine->env->nr_cpus_avail, MAX_NR_CPUS);
|
||||
|
||||
if (cpu < 0 || cpu >= nr_cpus || !machine->current_tid)
|
||||
return -1;
|
||||
@@ -2992,7 +2992,7 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
|
||||
pid_t tid)
|
||||
{
|
||||
struct thread *thread;
|
||||
int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
|
||||
int nr_cpus = min(machine->env->nr_cpus_avail, MAX_NR_CPUS);
|
||||
|
||||
if (cpu < 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -2404,7 +2404,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
|
||||
{
|
||||
int i, err = -1;
|
||||
struct perf_cpu_map *map;
|
||||
int nr_cpus = min(session->header.env.nr_cpus_online, MAX_NR_CPUS);
|
||||
int nr_cpus = min(session->header.env.nr_cpus_avail, MAX_NR_CPUS);
|
||||
|
||||
for (i = 0; i < PERF_TYPE_MAX; ++i) {
|
||||
struct evsel *evsel;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user