Skip to content

Commit

Permalink
x86/vmware: Enable steal time accounting
Browse files Browse the repository at this point in the history
Set paravirt_steal_rq_enabled if steal clock present.
paravirt_steal_rq_enabled is used in sched/core.c to adjust task
progress by offsetting stolen time. Use 'no-steal-acc' off switch (share
same name with KVM) to disable steal time accounting.

Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200323195707.31242-5-amakhalov@vmware.com
  • Loading branch information
Alexey Makhalov authored and Borislav Petkov committed Mar 24, 2020
1 parent ab02bb3 commit e73a8f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3174,7 +3174,7 @@
[X86,PV_OPS] Disable paravirtualized VMware scheduler
clock and use the default one.

no-steal-acc [X86,KVM,ARM64] Disable paravirtualized steal time
no-steal-acc [X86,PV_OPS,ARM64] Disable paravirtualized steal time
accounting. steal time is computed, but won't
influence scheduler behaviour

Expand Down
13 changes: 12 additions & 1 deletion arch/x86/kernel/cpu/vmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static struct cyc2ns_data vmware_cyc2ns __ro_after_init;
static int vmw_sched_clock __initdata = 1;
static DEFINE_PER_CPU_DECRYPTED(struct vmware_steal_time, vmw_steal_time) __aligned(64);
static bool has_steal_clock;
static bool steal_acc __initdata = true; /* steal time accounting */

static __init int setup_vmw_sched_clock(char *s)
{
Expand All @@ -133,6 +134,13 @@ static __init int setup_vmw_sched_clock(char *s)
}
early_param("no-vmw-sched-clock", setup_vmw_sched_clock);

static __init int parse_no_stealacc(char *arg)
{
steal_acc = false;
return 0;
}
early_param("no-steal-acc", parse_no_stealacc);

static unsigned long long notrace vmware_sched_clock(void)
{
unsigned long long ns;
Expand Down Expand Up @@ -306,8 +314,11 @@ static int vmware_cpu_down_prepare(unsigned int cpu)

static __init int activate_jump_labels(void)
{
if (has_steal_clock)
if (has_steal_clock) {
static_key_slow_inc(&paravirt_steal_enabled);
if (steal_acc)
static_key_slow_inc(&paravirt_steal_rq_enabled);
}

return 0;
}
Expand Down

0 comments on commit e73a8f3

Please sign in to comment.