Re: [PATCH v5 bpf-next 2/2] selftests/bpf: add bpf_read_branch_records() selftest

From: Alexei Starovoitov
Date: Sat Jan 25 2020 - 21:53:45 EST


On Sat, Jan 25, 2020 at 2:32 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
> + attr.type = PERF_TYPE_HARDWARE;
> + attr.config = PERF_COUNT_HW_CPU_CYCLES;
> + attr.freq = 1;
> + attr.sample_freq = 4000;
> + attr.sample_type = PERF_SAMPLE_BRANCH_STACK;
> + attr.branch_sample_type = PERF_SAMPLE_BRANCH_USER | PERF_SAMPLE_BRANCH_ANY;
> + pfd = syscall(__NR_perf_event_open, &attr, -1, 0, -1, PERF_FLAG_FD_CLOEXEC);
> + if (CHECK(pfd < 0, "perf_event_open", "err %d\n", pfd))
> + goto out_destroy;

It's failing for me in kvm. Is there way to make it work?
CIs will be vm based too. If this test requires physical host
such test will keep failing in all such environments.
Folks will be annoyed and eventually will disable the test.
Can we figure out how to test in the vm from the start?