• Andreas Gerstmayr's avatar
    fix iteration over CPUs · 7e0784d3
    Andreas Gerstmayr authored
    Since kernel version 4.9.0 BPF stopped working in a KVM guest.
    The problem are calls to perf_event_open with CPU identifiers which do
    not exist (ENODEV). The root cause for this is that the current code
    assumes ascending numbered CPUs. However, this is not always the case
    (e.g. CPU hotplugging).
    
    This patch introduces the get_online_cpus() and get_possible_cpus()
    helper functions and uses the appropriate function for iterations over
    CPUs. The BPF_MAP_TYPE_PERF_EVENT_ARRAY map contains now an entry for
    each possible CPU instead of for each online CPU.
    
    Fixes: #893
    Signed-off-by: default avatarAndreas Gerstmayr <andreas.gerstmayr@catalysts.cc>
    7e0784d3
CMakeLists.txt 3.91 KB