x86_64: Add pauses in the TSC mpsync testing loop.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 28 Oct 2017 06:46:31 +0000 (14:46 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 28 Oct 2017 06:53:42 +0000 (14:53 +0800)
This fixes Intel N3450 deadlock in the tight rdtsc/IPI loop.

Suggested-by: dillon@
Tested-by: mneumann@
Dragonfly-bug: http://bugs.dragonflybsd.org/issues/3087

sys/platform/pc64/isa/clock.c

index 3b9508e..2368c4e 100644 (file)
@@ -1277,10 +1277,12 @@ tsc_mpsync_test_loop(struct tsc_mpsync_arg *arg)
                lwkt_cpusync_init(&cs, gd->gd_other_cpus,
                    tsc_mpsync_test_remote, arg);
                lwkt_cpusync_interlock(&cs);
+               cpu_pause();
                arg->tsc_target = rdtsc_ordered();
                cpu_mfence();
                lwkt_cpusync_deinterlock(&cs);
                crit_exit();
+               cpu_pause();
 
                if (!arg->tsc_mpsync) {
                        kprintf("cpu%d: TSC is not MP synchronized @%u\n",