hi, Alexei
What about using similar
implementation
like PERF_EVENT_IOC_SET_OUTPUT, creating a new ioctl like
PERF_EVENT_IOC_SET_ENABLER,
then let perf to select an event as 'enabler', then BPF can still
control one atomic
variable to enable/disable a set of events.
you lost me on that last sentence. How this 'enabler' will work?
Also I'm still missing what's wrong with perf doing ioctl() on
events on all cpus manually when bpf program tells it to do so.
Is it speed you concerned about or extra work in perf ?
For not having too much wakeups, perf ringbuffer has a watermark
limit to cache events and reduce the wakeups, which causes perf
userspace tool can not receive perf events immediately.
Here's a simple demo expamle to prove it, 'sleep_exec' does some
writes and prints a timestamp every second, and an lable is
printed when perf poll gets events.
$ perf record -m 2 -e syscalls:sys_enter_write sleep_exec 1000
userspace sleep time: 0 seconds
userspace sleep time: 1 seconds
userspace sleep time: 2 seconds
userspace sleep time: 3 seconds
perf record wakeup onetime 0
userspace sleep time: 4 seconds
userspace sleep time: 5 seconds
userspace sleep time: 6 seconds
userspace sleep time: 7 seconds
perf record wakeup onetime 1
userspace sleep time: 8 seconds
perf record wakeup onetime 2
..
$ perf record -m 1 -e syscalls:sys_enter_write sleep_exec 1000
userspace sleep time: 0 seconds
userspace sleep time: 1 seconds
perf record wakeup onetime 0
userspace sleep time: 2 seconds
userspace sleep time: 3 seconds
perf record wakeup onetime 1
userspace sleep time: 4 seconds
userspace sleep time: 5 seconds
..
By default, if no mmap_pages is specified, perf tools wakeup only
when the target executalbe finished:
$ perf record -e syscalls:sys_enter_write sleep_exec 5
userspace sleep time: 0 seconds
userspace sleep time: 1 seconds
userspace sleep time: 2 seconds
userspace sleep time: 3 seconds
userspace sleep time: 4 seconds
perf record wakeup onetime 0
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.006 MB perf.data (54 samples) ]
If we want perf to reflect as soon as our sample event be generated,
--no-buffering should be used, but this option has a greater
impact on performance.
$ perf record --no-buffering -e syscalls:sys_enter_write sleep_exec 1000
userspace sleep time: 0 seconds
perf record wakeup onetime 0
perf record wakeup onetime 1
perf record wakeup onetime 2
perf record wakeup onetime 3
perf record wakeup onetime 4
perf record wakeup onetime 5
perf record wakeup onetime 6
..
Thank you
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/