diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2008-05-19 09:13:44 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-05-27 18:11:42 -0400 |
commit | 00d21d82b8a9e290286e09d8eedc20bfc33b0eee (patch) | |
tree | ed5b32a197ab4f7c8df059cb451b299c40a69ee9 /arch/ia64 | |
parent | 85cbc503787d577c215f9540c57294e1ec799144 (diff) |
[IA64] pvops: add to hooks, pv_time_ops, for steal time accounting.
Introduce pv_time_ops which adds hook to steal time accounting.
On virtualized environment, cpus are shared by many guests and
steal time is the time which is used for other guests.
On virtualized environtment, streal time should be accounted.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/kernel/paravirt.c | 15 | ||||
-rw-r--r-- | arch/ia64/kernel/time.c | 23 |
2 files changed, 38 insertions, 0 deletions
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c index ba5383be03cb..afaf5b9a2cf0 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c | |||
@@ -352,3 +352,18 @@ struct pv_irq_ops pv_irq_ops = { | |||
352 | 352 | ||
353 | .resend_irq = ia64_native_resend_irq, | 353 | .resend_irq = ia64_native_resend_irq, |
354 | }; | 354 | }; |
355 | |||
356 | /*************************************************************************** | ||
357 | * pv_time_ops | ||
358 | * time operations | ||
359 | */ | ||
360 | |||
361 | static int | ||
362 | ia64_native_do_steal_accounting(unsigned long *new_itm) | ||
363 | { | ||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | struct pv_time_ops pv_time_ops = { | ||
368 | .do_steal_accounting = ia64_native_do_steal_accounting, | ||
369 | }; | ||
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 8c73643f2d66..046ca89efc05 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/machvec.h> | 24 | #include <asm/machvec.h> |
25 | #include <asm/delay.h> | 25 | #include <asm/delay.h> |
26 | #include <asm/hw_irq.h> | 26 | #include <asm/hw_irq.h> |
27 | #include <asm/paravirt.h> | ||
27 | #include <asm/ptrace.h> | 28 | #include <asm/ptrace.h> |
28 | #include <asm/sal.h> | 29 | #include <asm/sal.h> |
29 | #include <asm/sections.h> | 30 | #include <asm/sections.h> |
@@ -48,6 +49,15 @@ EXPORT_SYMBOL(last_cli_ip); | |||
48 | 49 | ||
49 | #endif | 50 | #endif |
50 | 51 | ||
52 | #ifdef CONFIG_PARAVIRT | ||
53 | static void | ||
54 | paravirt_clocksource_resume(void) | ||
55 | { | ||
56 | if (pv_time_ops.clocksource_resume) | ||
57 | pv_time_ops.clocksource_resume(); | ||
58 | } | ||
59 | #endif | ||
60 | |||
51 | static struct clocksource clocksource_itc = { | 61 | static struct clocksource clocksource_itc = { |
52 | .name = "itc", | 62 | .name = "itc", |
53 | .rating = 350, | 63 | .rating = 350, |
@@ -56,6 +66,9 @@ static struct clocksource clocksource_itc = { | |||
56 | .mult = 0, /*to be calculated*/ | 66 | .mult = 0, /*to be calculated*/ |
57 | .shift = 16, | 67 | .shift = 16, |
58 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 68 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
69 | #ifdef CONFIG_PARAVIRT | ||
70 | .resume = paravirt_clocksource_resume, | ||
71 | #endif | ||
59 | }; | 72 | }; |
60 | static struct clocksource *itc_clocksource; | 73 | static struct clocksource *itc_clocksource; |
61 | 74 | ||
@@ -156,6 +169,9 @@ timer_interrupt (int irq, void *dev_id) | |||
156 | 169 | ||
157 | profile_tick(CPU_PROFILING); | 170 | profile_tick(CPU_PROFILING); |
158 | 171 | ||
172 | if (paravirt_do_steal_accounting(&new_itm)) | ||
173 | goto skip_process_time_accounting; | ||
174 | |||
159 | while (1) { | 175 | while (1) { |
160 | update_process_times(user_mode(get_irq_regs())); | 176 | update_process_times(user_mode(get_irq_regs())); |
161 | 177 | ||
@@ -185,6 +201,8 @@ timer_interrupt (int irq, void *dev_id) | |||
185 | local_irq_disable(); | 201 | local_irq_disable(); |
186 | } | 202 | } |
187 | 203 | ||
204 | skip_process_time_accounting: | ||
205 | |||
188 | do { | 206 | do { |
189 | /* | 207 | /* |
190 | * If we're too close to the next clock tick for | 208 | * If we're too close to the next clock tick for |
@@ -334,6 +352,11 @@ ia64_init_itm (void) | |||
334 | */ | 352 | */ |
335 | clocksource_itc.rating = 50; | 353 | clocksource_itc.rating = 50; |
336 | 354 | ||
355 | paravirt_init_missing_ticks_accounting(smp_processor_id()); | ||
356 | |||
357 | /* avoid softlock up message when cpu is unplug and plugged again. */ | ||
358 | touch_softlockup_watchdog(); | ||
359 | |||
337 | /* Setup the CPU local timer tick */ | 360 | /* Setup the CPU local timer tick */ |
338 | ia64_cpu_local_tick(); | 361 | ia64_cpu_local_tick(); |
339 | 362 | ||