On Oct 10, 2006, at 1:12 PM, Amos Waterland wrote:

Just as a sanity check, is the intention is to put the processor in the
NAP state when .sleep() is invoked?  If so, is the following behavior
expected?
Yes!
Sleep turns the EE bit on and you have enabled HDEC so they are both firing waking you from sleep at different times Also if you take 0x7fffffff/timebase_freq you'll find it is about 9 seconds :)

To demonstrate let modify the patch a little:
diff -r 294577be7c02 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Tue Oct 10 12:02:56 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Tue Oct 10 13:46:30 2006 -0400
@@ -403,6 +403,16 @@ static void __init __start_xen(multiboot
     console_endboot();
+    printk("tbf: %d\n", timebase_freq);
+    while (1) {
+        long before, after;
+        printk(">>dec %d hdec %d\n", mfdec(), mfhdec());
+        before = mftb(); sleep(); after = mftb();
+        printk("<<dec %d hdec %d\n", mfdec(), mfhdec());
+ printk("hid0 = %lx: slept for %ld timebase ticks (%ld seconds)\n", + mfhid0(), after - before, (after - before) / timebase_freq);
+    }
+
     /* Hide UART from DOM0 if we're using it */
     serial_endboot();


output is (comments with >>):

(XEN) tbf: 175000000
>> 0x7fffffff/175000000 = 9

(XEN) >>dec 13921793 hdec 2112442338
>>>         ^^^^^^^^
(XEN) <<dec 2147418095 hdec 2098520480
(XEN) hid0 = 51010180000000: slept for 13369891 timebase ticks (0 seconds)
>>> matches                            ^^^^^^^^
(XEN) >>dec 2145746886 hdec 2096849271
>>>>                        ^^^^^^^^^^
(XEN) <<dec 48897109 hdec 2147483491
(XEN) hid0 = 51010180000000: slept for 2096268461 timebase ticks (11 seconds)
>>>> matches                           ^^^^^^^^^^


I am however surprised that HDEC will wake from any kind of sleep, Cell and P5+ processors do not do this.
-JX


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to