Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: TSC clock going backwards on suspend/resume



M.Drochner%fz-juelich.de@localhost said:
> With the "TSC" as timecounter source I see a step backwards always
> after a suspend/resume cycle.

The appended patch cures this for me. I'm not very happy with it
because it only makes the undocumented mess worse what the tsc
handling already is. But we know where to look at.
(DDB trap/continue seems to need similar treatment)

best regards
Matthias





-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
#
# old_revision [661381afb22bc79c016357336829373f25f408d4]
#
# patch "sys/arch/x86/acpi/acpi_wakeup.c"
#  from [97f738c5dafe9d0086a748c75430fdedebd2ea6b]
#    to [21604e4d6017869256a5e0492cbcf88b520ea922]
#
============================================================
--- sys/arch/x86/acpi/acpi_wakeup.c     97f738c5dafe9d0086a748c75430fdedebd2ea6b
+++ sys/arch/x86/acpi/acpi_wakeup.c     21604e4d6017869256a5e0492cbcf88b520ea922
@@ -101,6 +101,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.
 #include <machine/mtrr.h>
 
 #include <x86/cpuvar.h>
+#include <x86/x86/tsc.h>
 
 #include "acpi_wakecode.h"
 
@@ -307,6 +308,8 @@ acpi_cpu_sleep(struct cpu_info *ci)
 
        atomic_or_32(&ci->ci_flags, CPUF_RUNNING);
        atomic_or_32(&cpus_running, ci->ci_cpumask);
+       tsc_sync_ap(ci);
+       tsc_sync_ap(ci);
 
        x86_enable_intr();
 }
@@ -391,6 +394,9 @@ out:
 
                while ((ci->ci_flags & CPUF_RUNNING) == 0)
                        x86_pause();
+
+               tsc_sync_bp(ci);
+               tsc_sync_bp(ci);
        }
 #endif
 


Home | Main Index | Thread Index | Old Index