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]
Message-ID: <19112.57690.867979.462172@cargo.ozlabs.ibm.com>
Date:	Thu, 10 Sep 2009 21:22:02 +1000
From:	Paul Mackerras <paulus@...ba.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>,
	Prasad <prasad@...ux.vnet.ibm.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Peter Zijlstra <peterz@...radead.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Jan Kiszka <jan.kiszka@...mens.com>,
	Jiri Slaby <jirislaby@...il.com>,
	Li Zefan <lizf@...fujitsu.com>, Avi Kivity <avi@...hat.com>,
	Mike Galbraith <efault@....de>,
	Masami Hiramatsu <mhiramat@...hat.com>
Subject: Re: [PATCH 1/5] perf_counter: Add open/close pmu callbacks

Frederic Weisbecker writes:

> Add the open() and close() callback to the pmu structure.
> Open is called when a counter is initialized just after it's allocation
> and close is called when the counter is about to be released.
> 
> These callbacks are useful for example when a pmu has to deal with
> several registers and needs to maintain an internal list of counters
> using them. Given such list, the pmu is able to check if the the number
> of physical registers are still sufficient for the new created counter
> and then accept or refuse this counter.

We already do that sort of thing on powerpc for hardware counters.

It looks to me that you can easily do that stuff in the appropriate
xxx_perf_counter_init function, since pmu->open() is only called
immediately on return from one the various xxx_perf_counter_init
functions, and xxx_perf_counter_init is what says what pmu struct to
use.

As for ->close(), that's what counter->destroy is there for.  On
powerpc, hw_perf_counter_init sets counter->destroy to an appropriate
destructor function, as does tp_perf_counter_init.  So if you need a
destructor for breakpoint counters, just make bp_perf_counter_init set
counter->destroy appropriately.

Paul.
--
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