]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[S390] pm: ignore time spend in suspended state
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 6 Oct 2009 08:34:11 +0000 (10:34 +0200)
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>
Tue, 6 Oct 2009 08:35:09 +0000 (10:35 +0200)
The time a system has been suspended should not show up in any
of the cputime accounting fields. The time of inactivity is definitly
not any form of real cputime nor is it idle time.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/swsusp_asm64.S

index fe927d0bc20b73b6bf1a8a0c5355de6f440404e1..008e35af339fbe6040479a15a94cd6e602763fbb 100644 (file)
@@ -69,8 +69,21 @@ swsusp_arch_suspend:
        stmg    %r0,%r15,0x280(%r1)             /* store general registers */
 
        stpt    0x328(%r1)                      /* store timer */
+       stck    __SF_EMPTY(%r15)                /* store clock */
        stckc   0x330(%r1)                      /* store clock comparator */
 
+       /* Update cputime accounting before going to sleep */
+       lg      %r0,__LC_LAST_UPDATE_TIMER
+       slg     %r0,0x328(%r1)
+       alg     %r0,__LC_SYSTEM_TIMER
+       stg     %r0,__LC_SYSTEM_TIMER
+       mvc     __LC_LAST_UPDATE_TIMER(8),0x328(%r1)
+       lg      %r0,__LC_LAST_UPDATE_CLOCK
+       slg     %r0,__SF_EMPTY(%r15)
+       alg     %r0,__LC_STEAL_TIMER
+       stg     %r0,__LC_STEAL_TIMER
+       mvc     __LC_LAST_UPDATE_CLOCK(8),__SF_EMPTY(%r15)
+
        /* Activate DAT */
        stosm   __SF_EMPTY(%r15),0x04
 
@@ -200,8 +213,11 @@ restart_suspend:
 
 restore_registers:
        /* Restore registers */
-       lghi    %r13,0x1000             /* %r1 = pointer to save arae */
+       lghi    %r13,0x1000             /* %r1 = pointer to save area */
 
+       /* Ignore time spent in suspended state. */
+       llgf    %r1,0x318(%r13)
+       stck    __LC_LAST_UPDATE_CLOCK(%r1)
        spt     0x328(%r13)             /* reprogram timer */
        //sckc  0x330(%r13)             /* set clock comparator */
 
@@ -229,9 +245,6 @@ restore_registers:
        /* Load old stack */
        lg      %r15,0x2f8(%r13)
 
-       /* Pointer to save area */
-       lghi    %r13,0x1000
-
        /* Restore prefix register */
        spx     0x318(%r13)