Re: [patch 1/5] x86, bts: detect size of DS fields

From: Ingo Molnar
Date: Tue Mar 17 2009 - 08:35:30 EST



* Metzger, Markus T <markus.t.metzger@xxxxxxxxx> wrote:

> >-----Original Message-----
> >From: Ingo Molnar [mailto:mingo@xxxxxxx]
> >Sent: Tuesday, March 17, 2009 11:56 AM
> >To: Metzger, Markus T
>
>
> >the bigger problem is the runtime failure (boot warning) that i
> >reported. Hence i cannot apply any new patches yet until that is
> >resolved.
>
> I found your email at lkml.org.

(i sent it to your intel.com address - perhaps it got dropped
there somehow?)

> I think I found the problem:
> ds_request_bts() needs to allocate a small amount of memory.
> It uses GFP_KERNEL.
>
> Hw-branch-tracer essentially does on_each_cpu(ds_request_bts()).
>
> Since ds_request_bts() is meant to be called on the cpu that
> should be traced, it should use GFP_ATOMIC to allow calls from
> smp_call_function() and friends.
>
> Would that be acceptable?

That's not really a good solution - GFP_ATOMIC is not a reliable
form of allocation.

the other callsites are buggy too:

smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1);

done under the bts_tracer_lock in addition to an atomic IPI
context.

for_each_online_cpu() done under the mutex would be better i
guess, plus you can allocate any memory before you do the SMP
cross-call, and pass it to the IPI handler via the data
parameter. (NULL in the sequence above)

Ingo
--
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/