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] [day] [month] [year] [list]
Date:	Tue, 07 Feb 2012 14:55:43 -0700
From:	David Ahern <dsahern@...il.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
CC:	Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: perf: allow command to attach local data to thread/evsel structs

On 02/07/2012 02:33 PM, Arnaldo Carvalho de Melo wrote:
>>> I think we either use {thread_conf,evsel_conf} for global configuration
>>> options for these two core data structures or we just provide some
>>> optional, per perf_tool allocator.
>>
>> Meaning conf's that parallel symbol_conf -- allocated and 'owned' by the
>> perf library but exported for the user to set values. In this case
>> handlers are needed for allocation and free as instances come and go?
>> e.g., thread__new invokes thread_conf.allocator if defined and
>> thread__priv returns a pointer to private data.
> 
> Well, the symbol way of doing things is to just allocate as many bytes
> as the tool being used asks for and then at free time nothing special
> has to be done.

Consider the case of events and you want to track time last seen by cpu.
You need an array:

u64 last_seen[]

with CPU as an index, but do not want to assume some value of max_cpus.
So one option is:

struct priv {
    u64 *last_seen; /* time this event was last seen */
    u32 max_cpu;    /* highest cpu slot allocated */
};

last_seen is malloc'ed first time the event is processed and realloc'ed
as max_cpu increases. Attaching that struct to an event means an
embedded allocation that does not follow the static model of symbol_conf.

David
--
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