x86, hw-branch-tracer: allocate selftest iterator on heap
Allocate the trace_iterator for the hw-branch-tracer selftest on the heap. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> Cc: roland@redhat.com Cc: eranian@googlemail.com Cc: oleg@redhat.com Cc: juan.villacis@intel.com Cc: ak@linux.jf.intel.com LKML-Reference: <20090403144556.578777000@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
de79f54f53
commit
4d657e51df
1 changed files with 12 additions and 8 deletions
|
@ -757,7 +757,7 @@ int
|
||||||
trace_selftest_startup_hw_branches(struct tracer *trace,
|
trace_selftest_startup_hw_branches(struct tracer *trace,
|
||||||
struct trace_array *tr)
|
struct trace_array *tr)
|
||||||
{
|
{
|
||||||
struct trace_iterator iter;
|
struct trace_iterator *iter;
|
||||||
struct tracer tracer;
|
struct tracer tracer;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -777,17 +777,21 @@ trace_selftest_startup_hw_branches(struct tracer *trace,
|
||||||
* The hw-branch tracer needs to collect the trace from the various
|
* The hw-branch tracer needs to collect the trace from the various
|
||||||
* cpu trace buffers - before tracing is stopped.
|
* 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));
|
memcpy(&tracer, trace, sizeof(tracer));
|
||||||
|
|
||||||
iter.trace = &tracer;
|
iter->trace = &tracer;
|
||||||
iter.tr = tr;
|
iter->tr = tr;
|
||||||
iter.pos = -1;
|
iter->pos = -1;
|
||||||
mutex_init(&iter.mutex);
|
mutex_init(&iter->mutex);
|
||||||
|
|
||||||
trace->open(&iter);
|
trace->open(iter);
|
||||||
|
|
||||||
mutex_destroy(&iter.mutex);
|
mutex_destroy(&iter->mutex);
|
||||||
|
kfree(iter);
|
||||||
|
|
||||||
tracing_stop();
|
tracing_stop();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue