RE: [patch] x86, bts: use atomic memory allocation

From: Metzger, Markus T
Date: Wed Mar 25 2009 - 05:07:57 EST


>-----Original Message-----
>From: Ingo Molnar [mailto:mingo@xxxxxxx]
>Sent: Friday, March 20, 2009 7:56 PM
>To: Metzger, Markus T


>> >> Ds_request_bts() needs to allocate memory. It uses GFP_KERNEL.
>> >>
>> >> Hw-branch-tracer calls ds_request_bts() within on_each_cpu().
>> >>
>> >> Use atomic memory allocation to allow it to be used in that context.
>> >
>> >the hw-branch-tracer still crashes during bootup. Have you tried the
>> >config i sent to you, and have you tried to reproduce it? I've
>> >attached another config that crashes.
>>
>> The first config boots OK.
>
>> The second config boots OK with the additional changes to keep the
>> GFP_KERNEL and move the ds_request_bts() calls out of the
>> on_each_cpu() in the hw-branch-tracer.
>>
>> I don't know yet what exactly causes the crash and if there is a
>> simpler fix.
>
>hm, this was an AMD box - so perhaps they dont have a compatible DS
>implementation?

If no trace hardware is detected, the hw-branch tracer returns -EOPNOTSUPP.
I doubt that there is an incompatible DS implementation.


I found a bug that leads to a kernel crash.

If the tracing task exits, it disables bts tracing for all its children and then
frees the trace buffer. If the children are currently executing, the buffer
may be freed while the hardware is still tracing. This might cause the hardware to
overwrite memory.

I would need to wait until the traced task is rescheduled, trigger a rescheduling,
or actively disable tracing on the traced task's cpu.

Unfortunately, most of the ptrace exit code is executed with irq's disabled and
tasklist_lock write-held.
I am currently trying to find a way to do this at a time when irq's are enabled.

This affects the ptrace bts extension for .29 and tip/tracing/hw-branch-tracing.
The hw-branch-tracer is not affected.


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/