Skip to content

Commit 00d21d8

Browse files
Isaku Yamahataaegl
authored andcommitted
[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>
1 parent 85cbc50 commit 00d21d8

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

‎arch/ia64/kernel/paravirt.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,18 @@ struct pv_irq_ops pv_irq_ops = {
352352

353353
.resend_irq = ia64_native_resend_irq,
354354
};
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+
};

‎arch/ia64/kernel/time.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <asm/machvec.h>
2525
#include <asm/delay.h>
2626
#include <asm/hw_irq.h>
27+
#include <asm/paravirt.h>
2728
#include <asm/ptrace.h>
2829
#include <asm/sal.h>
2930
#include <asm/sections.h>
@@ -48,6 +49,15 @@ EXPORT_SYMBOL(last_cli_ip);
4849

4950
#endif
5051

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+
5161
static struct clocksource clocksource_itc = {
5262
.name = "itc",
5363
.rating = 350,
@@ -56,6 +66,9 @@ static struct clocksource clocksource_itc = {
5666
.mult = 0, /*to be calculated*/
5767
.shift = 16,
5868
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
69+
#ifdef CONFIG_PARAVIRT
70+
.resume = paravirt_clocksource_resume,
71+
#endif
5972
};
6073
static struct clocksource *itc_clocksource;
6174

@@ -156,6 +169,9 @@ timer_interrupt (int irq, void *dev_id)
156169

157170
profile_tick(CPU_PROFILING);
158171

172+
if (paravirt_do_steal_accounting(&new_itm))
173+
goto skip_process_time_accounting;
174+
159175
while (1) {
160176
update_process_times(user_mode(get_irq_regs()));
161177

@@ -185,6 +201,8 @@ timer_interrupt (int irq, void *dev_id)
185201
local_irq_disable();
186202
}
187203

204+
skip_process_time_accounting:
205+
188206
do {
189207
/*
190208
* If we're too close to the next clock tick for
@@ -334,6 +352,11 @@ ia64_init_itm (void)
334352
*/
335353
clocksource_itc.rating = 50;
336354

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+
337360
/* Setup the CPU local timer tick */
338361
ia64_cpu_local_tick();
339362

‎include/asm-ia64/paravirt.h‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,35 @@ ia64_resend_irq(unsigned int vector)
200200
pv_irq_ops.resend_irq(vector);
201201
}
202202

203+
/******************************************************************************
204+
* replacement of time operations.
205+
*/
206+
207+
extern struct itc_jitter_data_t itc_jitter_data;
208+
extern volatile int time_keeper_id;
209+
210+
struct pv_time_ops {
211+
void (*init_missing_ticks_accounting)(int cpu);
212+
int (*do_steal_accounting)(unsigned long *new_itm);
213+
214+
void (*clocksource_resume)(void);
215+
};
216+
217+
extern struct pv_time_ops pv_time_ops;
218+
219+
static inline void
220+
paravirt_init_missing_ticks_accounting(int cpu)
221+
{
222+
if (pv_time_ops.init_missing_ticks_accounting)
223+
pv_time_ops.init_missing_ticks_accounting(cpu);
224+
}
225+
226+
static inline int
227+
paravirt_do_steal_accounting(unsigned long *new_itm)
228+
{
229+
return pv_time_ops.do_steal_accounting(new_itm);
230+
}
231+
203232
#endif /* !__ASSEMBLY__ */
204233

205234
#else
@@ -215,6 +244,9 @@ ia64_resend_irq(unsigned int vector)
215244
#define paravirt_arch_setup_nomca() 0
216245
#define paravirt_post_smp_prepare_boot_cpu() do { } while (0)
217246

247+
#define paravirt_init_missing_ticks_accounting(cpu) do { } while (0)
248+
#define paravirt_do_steal_accounting(new_itm) 0
249+
218250
#endif /* __ASSEMBLY__ */
219251

220252

0 commit comments

Comments
 (0)