mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-18 03:29:57 +02:00
selftests/bpf: Skip the second half of get_branch_snapshot in vm
VMs running on upstream 5.12+ kernel support LBR. However,
bpf_get_branch_snapshot couldn't stop the LBR before too many entries
are flushed. Skip the hit/waste test for VMs before we find a proper fix
for LBR in VM.
Fixes: 025bd7c753
("selftests/bpf: Add test for bpf_get_branch_snapshot")
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211007050231.728496-1-songliubraving@fb.com
This commit is contained in:
parent
0eb4ef88c5
commit
aa67fdb464
|
@ -6,6 +6,30 @@
|
||||||
static int *pfd_array;
|
static int *pfd_array;
|
||||||
static int cpu_cnt;
|
static int cpu_cnt;
|
||||||
|
|
||||||
|
static bool is_hypervisor(void)
|
||||||
|
{
|
||||||
|
char *line = NULL;
|
||||||
|
bool ret = false;
|
||||||
|
size_t len;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fp = fopen("/proc/cpuinfo", "r");
|
||||||
|
if (!fp)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
while (getline(&line, &len, fp) != -1) {
|
||||||
|
if (!strncmp(line, "flags", 5)) {
|
||||||
|
if (strstr(line, "hypervisor") != NULL)
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(line);
|
||||||
|
fclose(fp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int create_perf_events(void)
|
static int create_perf_events(void)
|
||||||
{
|
{
|
||||||
struct perf_event_attr attr = {0};
|
struct perf_event_attr attr = {0};
|
||||||
|
@ -83,6 +107,16 @@ void test_get_branch_snapshot(void)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_hypervisor()) {
|
||||||
|
/* As of today, LBR in hypervisor cannot be stopped before
|
||||||
|
* too many entries are flushed. Skip the hit/waste test
|
||||||
|
* for now in hypervisor until we optimize the LBR in
|
||||||
|
* hypervisor.
|
||||||
|
*/
|
||||||
|
test__skip();
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_GT(skel->bss->test1_hits, 6, "find_looptest_in_lbr");
|
ASSERT_GT(skel->bss->test1_hits, 6, "find_looptest_in_lbr");
|
||||||
|
|
||||||
/* Given we stop LBR in software, we will waste a few entries.
|
/* Given we stop LBR in software, we will waste a few entries.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user