Re: [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown

Martin Schwidefsky
2009-08-22T21:15:05Z

On Sat, 22 Aug 2009 12:35:41 +0200
Ingo Molnar <mingo@elte.hu> wrote:

> even after this fix, -tip testing found yet another circular locking
> bug, on a 32-bit Core2 laptop:

You got to love lockdep .. another ugly one:
clocksource_register: has clocksource_mutex, get cpu_add_remove_lock
native_cpu_up: has cpu_add_remove_lock, get clocksource_mutex

To register a clocksource the clocksource_mutex is acquired and if
necessary timekeeping_notify is called to install the clocksource as
the timekeeper clock. timekeeping_notify uses stop_machine which needs
to take cpu_add_remove_lock mutex.
Starting a new cpu is done with the cpu_add_remove_lock mutex held.
native_cpu_up checks the tsc of the new cpu and if the tsc is no good
clocksource_change_rating is called. Which needs the clocksource_mutex
and the deadlock is complete.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.