RE: [tip:tracing/hw-branch-tracing] tracing/hw-branch-tracing:convert bts-tracer mutex to a spinlock

From: Metzger, Markus T
Date: Wed Feb 25 2009 - 06:49:43 EST


>-----Original Message-----
>From: Ingo Molnar [mailto:mingo@xxxxxxx]
>Sent: Wednesday, February 25, 2009 12:46 PM
>To: Metzger, Markus T


>> I suggested to use get/put_online_cpus() instead of the lock.
>>
>> The hotplug code waits until the cpu_hotplug.refcount is zero
>> and it holds the cpu_hotplug.lock during hotplug operations
>> (see cpu_hotplug_begin/done()).
>>
>> In turn, get_online_cpus() needs to grab the cpu_hotplug.lock
>> to increment the cpu_hotplug.refcount.
>>
>> Thus, we will use the cpu_hotplug.lock instead of our own lock.
>
>... which, if you use it in the exact same spots as now still
>does a potential sleep with irqs disabled => bad.

We don't need to get_online_cpus() in the hotplug handler;
actually, we must not.


>We might be able to not take the hotplug lock in the affected
>codepath, but we should really not expand on the use of that
>lock and should make this code self-sufficient.

You're right. An own spinlock is definitely safer and much
easier to understand.


thanks and 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/