Re: [PATCH] perf core: Introduce new ioctl options to pause and resume ring buffer

From: Wangnan (F)
Date: Mon Jan 18 2016 - 21:55:45 EST




On 2016/1/18 20:02, Peter Zijlstra wrote:
On Mon, Jan 18, 2016 at 11:52:01AM +0000, Wang Nan wrote:

+#define PERF_EVENT_IOC_PAUSE_OUTPUT _IO ('$', 9)
+#define PERF_EVENT_IOC_RESUME_OUTPUT _IO ('$', 10)
Would not a single IOCTL with a 'boolean' parameter make more sense?

Good suggestion.

+++ b/kernel/events/ring_buffer.c
@@ -125,7 +125,7 @@ int perf_output_begin(struct perf_output_handle *handle,
if (unlikely(!rb))
goto out;
- if (unlikely(!rb->nr_pages))
+ if (unlikely(rb->paused))
goto out;
Should we increment rb->lost in this case?

Not sure about this. The ring buffer is paused deliberately, shall we consider the
events we miss as losted events? However I'll try it in next version.

Thank you.