tong@ wrote: > From: Tonghao Zhang <tong@xxxxxxxxxxxxx> > > The number of online cpu may be not equal to possible cpu. > "bpftool prog profile" can not create pmu event on possible > but on online cpu. > > $ dmidecode -s system-product-name > PowerEdge R620 > $ cat /sys/devices/system/cpu/possible > 0-47 > $ cat /sys/devices/system/cpu/online > 0-31 > > Disable cpu dynamically: > $ echo 0 > /sys/devices/system/cpu/cpuX/online > > If one cpu is offline, perf_event_open will return ENODEV. > To fix this issue: > * check value returned and skip offline cpu. > * close pmu_fd immediately on error path, avoid fd leaking. > > Fixes: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command") > Signed-off-by: Tonghao Zhang <tong@xxxxxxxxxxxxx> Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>