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


Groups > linux.kernel > #1251549

Re: [PATCH V2 20/30] coresight: etb10: implementing buffer set/reset() API

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 20/30] coresight: etb10: implementing buffer set/reset() API
Date 2015-10-20 12:00 +0200
Message-ID <qlBS2-8v7-11@gated-at.bofh.it> (permalink)
References <ql0St-4NE-3@gated-at.bofh.it> <ql0St-4NE-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Mathieu Poirier <mathieu.poirier@linaro.org> writes:

> Implementing perf related APIs to activate and terminate
> a trace session.  More specifically dealing with the sink
> buffer's internal mechanic along with perf's API to start
> and stop interactions with the ring buffers.

A matter of preference, but I'd say that it would be easier to review
this part if you merged all the buffer related patches together.

> +static void etb_reset_buffer(struct coresight_device *csdev,
> +			     struct perf_output_handle *handle,
> +			     void *sink_config)
> +{
> +	struct cs_buffers *buf = sink_config;
> +	struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
> +
> +	if (buf) {
> +		/*
> +		 * In snapshot mode ->data_size holds the new address of the
> +		 * ring buffer's head.  The size itself is the whole address
> +		 * range since we want the latest information.
> +		 */
> +		if (buf->snapshot)
> +			handle->head = local_xchg(&buf->data_size,
> +						  buf->nr_pages << PAGE_SHIFT);

Does it make sense to do this in etb_update_buffer() instead?

> +		perf_aux_output_end(handle, local_xchg(&buf->data_size, 0),
> +				    local_xchg(&buf->lost, 0));

The corresponding perf_aux_output_begin() is done in etm_event_add(),
I'd suggest that you do this in etm_event_del(),
unconditionally. Otherwise you're risking ending up with a refcount leak
and all sorts of horror.

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH V2 20/30] coresight: etb10: implementing buffer set/reset() API Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-10-18 20:30 +0200
  Re: [PATCH V2 20/30] coresight: etb10: implementing buffer set/reset() API Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-10-20 12:00 +0200
    Re: [PATCH V2 20/30] coresight: etb10: implementing buffer  set/reset() API Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-10-20 19:40 +0200

csiph-web