Commit 90e2105e authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Update uptime after suspend

Update uptime after suspend

Derived from i386

Adjust jiffies after suspend to keep uptime. 
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2601ad70
...@@ -955,7 +955,7 @@ void __init time_init_smp(void) ...@@ -955,7 +955,7 @@ void __init time_init_smp(void)
__setup("report_lost_ticks", time_setup); __setup("report_lost_ticks", time_setup);
static long clock_cmos_diff; static long clock_cmos_diff, sleep_start;
static int timer_suspend(struct sys_device *dev, u32 state) static int timer_suspend(struct sys_device *dev, u32 state)
{ {
...@@ -964,6 +964,7 @@ static int timer_suspend(struct sys_device *dev, u32 state) ...@@ -964,6 +964,7 @@ static int timer_suspend(struct sys_device *dev, u32 state)
*/ */
clock_cmos_diff = -get_cmos_time(); clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds(); clock_cmos_diff += get_seconds();
sleep_start = jiffies;
return 0; return 0;
} }
...@@ -971,15 +972,18 @@ static int timer_resume(struct sys_device *dev) ...@@ -971,15 +972,18 @@ static int timer_resume(struct sys_device *dev)
{ {
unsigned long flags; unsigned long flags;
unsigned long sec; unsigned long sec;
unsigned long ctime = get_cmos_time();
unsigned long sleep_length = ctime - sleep_start;
if (vxtime.hpet_address) if (vxtime.hpet_address)
hpet_reenable(); hpet_reenable();
sec = get_cmos_time() + clock_cmos_diff; sec = ctime + clock_cmos_diff;
write_seqlock_irqsave(&xtime_lock,flags); write_seqlock_irqsave(&xtime_lock,flags);
xtime.tv_sec = sec; xtime.tv_sec = sec;
xtime.tv_nsec = 0; xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock,flags); write_sequnlock_irqrestore(&xtime_lock,flags);
jiffies += sleep_length * HZ;
return 0; return 0;
} }
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/numa.h> #include <asm/numa.h>
static DECLARE_BITMAP(nodes_parsed, MAXNODE) __initdata; static DECLARE_BITMAP(nodes_parsed, MAX_NUMNODES) __initdata;
static struct node nodes[MAXNODE] __initdata; static struct node nodes[MAX_NUMNODES] __initdata;
static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff }; static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff };
static __init int setup_node(int pxm) static __init int setup_node(int pxm)
{ {
if (pxm2node[pxm] == 0xff) { if (pxm2node[pxm] == 0xff) {
if (numnodes > MAXNODE) if (numnodes > MAX_NUMNODES)
return -1; return -1;
pxm2node[pxm] = numnodes - 1; pxm2node[pxm] = numnodes - 1;
numnodes++; numnodes++;
...@@ -169,7 +169,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) ...@@ -169,7 +169,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
bad_srat(); bad_srat();
return -1; return -1;
} }
for (i = 0; i < MAXNODE; i++) { for (i = 0; i < MAX_NUMNODES; i++) {
if (!test_bit(i, &nodes_parsed)) if (!test_bit(i, &nodes_parsed))
continue; continue;
cutoff_node(i, start, end); cutoff_node(i, start, end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment