Perf buffer submission failing with -EOPNOTSUPP after system suspended
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
I'm getting a strange issue with submitting events in one of my perf buffers. Edit: I have a minimal example, posting now as a comment.
Relevant system details:
- kernel 5.3.5-arch1-1-ARCH
- bcc version "bcc-git v0.10.0.r98.ba64f031-1" from the AUR
- llvm version 9.0.0-3
For example, with the following code:
```c
TRACEPOINT_PROBE(raw_syscalls, sys_enter)
{
....
int ret = events.perf_submit(ctx, &event, sizeof(event));
bpf_trace_printk("%d\n", ret);
return 0;
}
```
Everything is fine until I run `systemctl suspend`, wait a few minutes, then wake my computer up again. Now, the call to `perf_submit` fails with `-95` which corresponds to `EOPNOTSUPP`.
From looking at the relevant kernel code, the following check is responsible:
```c
....
if (unlikely(event->oncpu != smp_processor_id()))
return -EOPNOTSUPP;
....
```
Does anyone have any idea what's going on? Am I missing some strange bug in my code? Is this just something we have to live with?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the minimal example mentioned in the issue comment and reproduce the failure across systemctl suspend and resume. Trace raw_syscalls/sys_enter through events.perf_submit and the kernel check for event->oncpu versus smp_processor_id(); done means identifying whether the fix belongs in BCC or the kernel and documenting or resolving the post-resume behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100