aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/events/ring_buffer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 367e9c56ec0b..0ed4555309bd 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -252,6 +252,10 @@ ring_buffer_init(struct ring_buffer *rb, long watermark, int flags)
252 * The ordering is similar to that of perf_output_{begin,end}, with 252 * The ordering is similar to that of perf_output_{begin,end}, with
253 * the exception of (B), which should be taken care of by the pmu 253 * the exception of (B), which should be taken care of by the pmu
254 * driver, since ordering rules will differ depending on hardware. 254 * driver, since ordering rules will differ depending on hardware.
255 *
256 * Call this from pmu::start(); see the comment in perf_aux_output_end()
257 * about its use in pmu callbacks. Both can also be called from the PMI
258 * handler if needed.
255 */ 259 */
256void *perf_aux_output_begin(struct perf_output_handle *handle, 260void *perf_aux_output_begin(struct perf_output_handle *handle,
257 struct perf_event *event) 261 struct perf_event *event)
@@ -323,6 +327,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
323 return handle->rb->aux_priv; 327 return handle->rb->aux_priv;
324 328
325err_put: 329err_put:
330 /* can't be last */
326 rb_free_aux(rb); 331 rb_free_aux(rb);
327 332
328err: 333err:
@@ -337,6 +342,10 @@ err:
337 * aux_head and posting a PERF_RECORD_AUX into the perf buffer. It is the 342 * aux_head and posting a PERF_RECORD_AUX into the perf buffer. It is the
338 * pmu driver's responsibility to observe ordering rules of the hardware, 343 * pmu driver's responsibility to observe ordering rules of the hardware,
339 * so that all the data is externally visible before this is called. 344 * so that all the data is externally visible before this is called.
345 *
346 * Note: this has to be called from pmu::stop() callback, as the assumption
347 * of the AUX buffer management code is that after pmu::stop(), the AUX
348 * transaction must be stopped and therefore drop the AUX reference count.
340 */ 349 */
341void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size, 350void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
342 bool truncated) 351 bool truncated)
@@ -376,6 +385,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
376 handle->event = NULL; 385 handle->event = NULL;
377 386
378 local_set(&rb->aux_nest, 0); 387 local_set(&rb->aux_nest, 0);
388 /* can't be last */
379 rb_free_aux(rb); 389 rb_free_aux(rb);
380 ring_buffer_put(rb); 390 ring_buffer_put(rb);
381} 391}