RE: [patch 3/5] x86, ftrace, hw-branch-tracer: dump on oops

From: Metzger, Markus T
Date: Fri Jan 16 2009 - 10:04:16 EST


>-----Original Message-----
>From: Steven Rostedt [mailto:srostedt@xxxxxxxxxx]
>Sent: Friday, January 16, 2009 3:55 PM
>To: Metzger, Markus T
>Cc: linux-kernel@xxxxxxxxxxxxxxx; mingo@xxxxxxx; tglx@xxxxxxxxxxxxx; hpa@xxxxxxxxx;
>markus.t.metzger@xxxxxxxxx
>Subject: Re: [patch 3/5] x86, ftrace, hw-branch-tracer: dump on oops
>
>BTW, you have two 1/5 patches but no 2/5 patch.
>
>On Fri, 2009-01-16 at 11:58 +0100, Markus Metzger wrote:
>> Dump the branch trace on an oops (based on ftrace_dump_on_oops).
>
>Does the ftrace_dump_on_oops not work? We may want to change
>ftrace_dump to see if a tracer has been registered, and use its format
>for output.

It does work and I am using it.
It only works one time, though. Ftrace kills itself before dumping its buffer.

The trace is collected in a separate buffer. trace_hw_branch_oops() reads that buffer and adds the trace to the ftrace buffer, so ftrace can then dump it.


>> bts_trace_stop(tr);
>> unregister_hotcpu_notifier(&bts_hotcpu_notifier);
>> +
>> + hw_branch_trace = NULL;
>
>unless you test hw_branch_trace for content, I usually never NULL the
>local tracer variable. This prevents races. The worst that can happen
>without nulling it, is that your tracer will write into another tracer's
>buffer. No real harm done. But if you have it as null and a race
>happens, you can crash the kernel.

Sounds reasonable. I'll change it.

regards,
markus.

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

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