[patch 08/18] x86, hw-branch-tracer: allocate selftest iterator on heap

From: markus . t . metzger
Date: Thu Apr 02 2009 - 10:59:42 EST


Allocate the trace_iterator for the hw-branch-tracer selftest on the heap.


Signed-off-by: Markus Metzger <markus.t.metzger@xxxxxxxxx>
---
kernel/trace/trace_selftest.c | 20 12 + 8 - 0 !
1 file changed, 12 insertions(+), 8 deletions(-)

Index: b/kernel/trace/trace_selftest.c
===================================================================
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -699,7 +699,7 @@ int
trace_selftest_startup_hw_branches(struct tracer *trace,
struct trace_array *tr)
{
- struct trace_iterator iter;
+ struct trace_iterator *iter;
struct tracer tracer;
unsigned long count;
int ret;
@@ -719,17 +719,21 @@ trace_selftest_startup_hw_branches(struc
* The hw-branch tracer needs to collect the trace from the various
* cpu trace buffers - before tracing is stopped.
*/
- memset(&iter, 0, sizeof(iter));
+ iter = kzalloc(sizeof(*iter), GFP_KERNEL);
+ if (!iter)
+ return -ENOMEM;
+
memcpy(&tracer, trace, sizeof(tracer));

- iter.trace = &tracer;
- iter.tr = tr;
- iter.pos = -1;
- mutex_init(&iter.mutex);
+ iter->trace = &tracer;
+ iter->tr = tr;
+ iter->pos = -1;
+ mutex_init(&iter->mutex);

- trace->open(&iter);
+ trace->open(iter);

- mutex_destroy(&iter.mutex);
+ mutex_destroy(&iter->mutex);
+ kfree(iter);

tracing_stop();


--
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.