Re: [crash, bisected] Re: clocksource: Resolve cpu hotplug deadlock with TSC unstable

From: Martin Schwidefsky
Date: Mon Sep 14 2009 - 14:00:20 EST


On Mon, 14 Sep 2009 17:19:58 +0200
Ingo Molnar <mingo@xxxxxxx> wrote:

> Now another box crashes during bootup. Reverting these two:
>
> f79e025: clocksource: Resolve cpu hotplug dead lock with TSC unstable, fix crash
> 7285dd7: clocksource: Resolve cpu hotplug dead lock with TSC unstable
>
> allows me to boot it.
>
> plain 32-bit defconfig.

Ok, I forced the situation where the bad thing happens. With the patch below
the crash goes away.

[ 0.152056] checking TSC synchronization [CPU#0 -> CPU#1]:
[ 0.156001] Measured 0 cycles TSC warp between CPUs, turning off TSC clock.
[ 0.156001] Marking TSC unstable due to check_tsc_sync_source failed

Is there a reason why we need the TSC as a clocksource early in the boot
process?

--
Subject: clocksource: delay tsc clocksource registration

From: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>

Until the tsc clocksource has been registered it can be
downgraded by setting the CLOCK_SOURCE_UNSTABLE bit and the
rating to zero. Once the tsc clocksource is registered a
work queue is needed to change the rating.

Delay the registration of the tsc clocksource to a point in
the boot process after the work queues have been initialized.

This hopefully finally resolves the boot crash due to the
tsc downgrade.

Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
Cc: John Stultz <johnstul@xxxxxxxxxx>
---

Index: linux-2.6-tip/arch/x86/kernel/tsc.c
===================================================================
--- linux-2.6-tip.orig/arch/x86/kernel/tsc.c 2009-09-14 19:25:02.000000000 +0200
+++ linux-2.6-tip/arch/x86/kernel/tsc.c 2009-09-14 19:30:13.000000000 +0200
@@ -853,9 +853,16 @@
clocksource_tsc.rating = 0;
clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
}
+}
+
+static int __init register_tsc_clocksource(void)
+{
clocksource_register(&clocksource_tsc);
+ return 0;
}

+core_initcall(register_tsc_clocksource);
+
#ifdef CONFIG_X86_64
/*
* calibrate_cpu is used on systems with fixed rate TSCs to determine
--
blue skies,
Martin.

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

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