On Thu, Sep 23, 2021 at 12:16 PM Ondrej Mosnacek <omosnace@xxxxxxxxxx> wrote: > The perf_event test currently uses hard-coded 0 as the CPU index. > Howver, if CPU#0 happens to be offline, the test then fails because > perf_event_open(2) returns -ENODEV. > > To fix this, try to find the index of the first online CPU and use that > instead of the hard-coded value. > > Verified to work well on a machine with the first 8 CPU cores offline. > > Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx> > --- > tests/perf_event/perf_event.c | 23 ++++++++++++++--------- > tests/perf_event/test | 32 +++++++++++++++++++++++--------- > 2 files changed, 37 insertions(+), 18 deletions(-) Now applied [1], along with a small workaround for module metadata issue on F33 [2]. [1] https://github.com/SELinuxProject/selinux-testsuite/commit/7d737e1605f62ccce5ff36e8d1643afd66fc9abf [2] https://github.com/SELinuxProject/selinux-testsuite/commit/29c42c865a9f43a15ae72ebd19642c3d88a7d5ce -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.