Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1585200

Re: [PATCH 2/4] perf: Keep AUX flags in the output handle

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] perf: Keep AUX flags in the output handle
Date 2017-02-21 11:50 +0100
Message-ID <tdgb7-1jD-3@gated-at.bofh.it> (permalink)
References <tcWm6-5gN-23@gated-at.bofh.it> <tcWvM-5kr-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Alexander,

Thanks for picking this up/adapting it. Just one comment below

On Mon, Feb 20, 2017 at 03:33:50PM +0200, Alexander Shishkin wrote:
> From: Will Deacon <will.deacon@arm.com>
> 
> In preparation for adding more flags to perf AUX records, introduce a
> separate API for setting the flags for a session, rather than appending
> more bool arguments to perf_aux_output_end. This allows to set each
> flag at the time a corresponding condition is detected, instead of
> tracking it in each driver's private state.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---

--->8

> +void perf_aux_output_flag(struct perf_output_handle *handle, u64 flags)
> +{
> +	/*
> +	 * OVERWRITE is determined by perf_aux_output_end() and can't
> +	 * be passed in directly.
> +	 */
> +	if (WARN_ON_ONCE(flags & PERF_AUX_FLAG_OVERWRITE))
> +		return;

Now that you've added this check...

> +	handle->aux_flags |= flags;
> +}
> +EXPORT_SYMBOL_GPL(perf_aux_output_flag);
> +
>  /*
>   * This is called before hardware starts writing to the AUX area to
>   * obtain an output handle and make sure there's room in the buffer.
> @@ -360,6 +373,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
>  	handle->event = event;
>  	handle->head = aux_head;
>  	handle->size = 0;
> +	handle->aux_flags = 0;
>  
>  	/*
>  	 * In overwrite mode, AUX data stores do not depend on aux_tail,
> @@ -409,34 +423,32 @@ EXPORT_SYMBOL_GPL(perf_aux_output_begin);
>   * of the AUX buffer management code is that after pmu::stop(), the AUX
>   * transaction must be stopped and therefore drop the AUX reference count.
>   */
> -void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
> -			 bool truncated)
> +void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
>  {
>  	struct ring_buffer *rb = handle->rb;
> -	bool wakeup = truncated;
> +	bool wakeup = !!handle->aux_flags;
>  	unsigned long aux_head;
> -	u64 flags = 0;
> -
> -	if (truncated)
> -		flags |= PERF_AUX_FLAG_TRUNCATED;
>  
>  	/* in overwrite mode, driver provides aux_head via handle */
>  	if (rb->aux_overwrite) {
> -		flags |= PERF_AUX_FLAG_OVERWRITE;
> +		handle->aux_flags |= PERF_AUX_FLAG_OVERWRITE;
>  
>  		aux_head = handle->head;
>  		local_set(&rb->aux_head, aux_head);
>  	} else {
> +		handle->aux_flags &= ~PERF_AUX_FLAG_OVERWRITE;
> +

... I don't think you need this addition anymore. It's harmless, though.

Will

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] perf, pt, coresight: AUX flags and VMX update Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 14:40 +0100
  [PATCH 2/4] perf: Keep AUX flags in the output handle Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 14:50 +0100
    Re: [PATCH 2/4] perf: Keep AUX flags in the output handle Mathieu Poirier <mathieu.poirier@linaro.org> - 2017-02-20 21:50 +0100
    Re: [PATCH 2/4] perf: Keep AUX flags in the output handle Will Deacon <will.deacon@arm.com> - 2017-02-21 11:50 +0100
      Re: [PATCH 2/4] perf: Keep AUX flags in the output handle Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-21 12:00 +0100
  [PATCH 1/4] perf: Export AUX buffer helpers to modules Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 14:50 +0100
  [PATCH 3/4] perf: Add a flag for partial AUX records Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 14:50 +0100
  [PATCH 4/4] perf/x86/intel/pt: Handle VMX better Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 15:00 +0100
  Re: [PATCH 0/4] perf, pt, coresight: AUX flags and VMX update Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 16:30 +0100
    Re: [PATCH 0/4] perf, pt, coresight: AUX flags and VMX update Adrian Hunter <adrian.hunter@intel.com> - 2017-02-20 16:50 +0100
      Re: [PATCH 0/4] perf, pt, coresight: AUX flags and VMX update Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-20 17:20 +0100
        Re: [PATCH 0/4] perf, pt, coresight: AUX flags and VMX update Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-20 17:40 +0100

csiph-web