lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 20 Oct 2015 14:37:58 +0300
From:	Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To:	Mathieu Poirier <mathieu.poirier@...aro.org>,
	gregkh@...uxfoundation.org, a.p.zijlstra@...llo.nl,
	acme@...nel.org, mingo@...hat.com, corbet@....net,
	nicolas.pitre@...aro.org
Cc:	adrian.hunter@...el.com, zhang.chunyan@...aro.org,
	mike.leach@....com, tor@...com, al.grant@....com,
	pawel.moll@....com, linux-arm-kernel@...ts.infradead.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	mathieu.poirier@...aro.org
Subject: Re: [PATCH V2 19/30] coresight: etb10: implementing the setup_aux() API

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

>  /**
> + * struct cs_buffer - keep track of a recording session' specifics
> + * @cur:	index of the current buffer
> + * @nr_pages:	max number of pages granted to us
> + * @nr_bufs:	number of clustered pages
> + * @offset:	offset within the current buffer
> + * @size:	how much space we have for this run
> + * @data_size:	how much we collected in this run
> + * @head:	head of the ring buffer
> + * @lost:	other than zero if we had a HW buffer wrap around
> + * @snapshot:	is this run in snapshot mode
> + * @addr:	virtual address this buffer starts at
> + */
> +struct cs_buffers {
> +	unsigned int		cur;
> +	unsigned int		nr_pages;
> +	unsigned int		nr_bufs;

This one is not really used.

> +	unsigned long		offset;
> +	unsigned long		size;

And this one seems to be only set in one place.

> +	local_t			data_size;
> +	local_t			head;

And so is this one.

> +	local_t			lost;
> +	bool			snapshot;
> +	void			*addr[0];

And this one seems to be a copy of what perf's ring buffer gives us.

> +static void *etb_setup_aux(struct coresight_device *csdev, int cpu,
> +			   void **pages, int nr_pages, bool overwrite)
> +{
> +	int node, pg;
> +	struct cs_buffers *buf;
> +
> +	if (cpu == -1)
> +		cpu = smp_processor_id();
> +	node = cpu_to_node(cpu);
> +
> +	buf = kzalloc_node(offsetof(struct cs_buffers, addr[nr_pages]),
> +			   GFP_KERNEL, node);
> +	if (!buf)
> +		return NULL;
> +
> +	buf->snapshot = overwrite;
> +	buf->nr_pages = nr_pages;
> +
> +	/* Record information about buffers */
> +	for (pg = 0; pg < buf->nr_pages; pg++)
> +		buf->addr[pg] = pages[pg];

Yes, buf::addr is a copy of @pages. You could save some space by just
saving @pages, it's going to be around until pmu::free_aux().

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ