2018-04-30 02:39:59

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH] KVM: X86: Limit timer frequency with more smaller interval

From: Wanpeng Li <[email protected]>

Anthoine reported:
The period used by Windows change over time but it can be 1 milliseconds
or less. I saw the limit_periodic_timer_frequency print so 500
microseconds is sometimes reached.

This patchs limits timer frequency with more smaller interval 200ms(5000Hz)
to leave some headroom as Paolo suggested since Windows 10 changed the
scheduler tick limit from 1024 Hz to 2048 Hz.

Reported-by: Anthoine Bourgeois <[email protected]>
Suggested-by: Paolo Bonzini <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Radim Krčmář <[email protected]>
Cc: Anthoine Bourgeois <[email protected]>
Signed-off-by: Wanpeng Li <[email protected]>
---
arch/x86/kvm/x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 51ecd38..dc47073 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -114,7 +114,7 @@ module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
static bool __read_mostly report_ignored_msrs = true;
module_param(report_ignored_msrs, bool, S_IRUGO | S_IWUSR);

-unsigned int min_timer_period_us = 500;
+unsigned int min_timer_period_us = 200;
module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);

static bool __read_mostly kvmclock_periodic_sync = true;
--
2.7.4



2018-04-30 12:33:47

by Darren Kenny

[permalink] [raw]
Subject: Re: [PATCH] KVM: X86: Limit timer frequency with more smaller interval

Hi Wanpeng Li,

On Sun, Apr 29, 2018 at 07:38:20PM -0700, Wanpeng Li wrote:
>From: Wanpeng Li <[email protected]>
>
>Anthoine reported:
> The period used by Windows change over time but it can be 1 milliseconds
> or less. I saw the limit_periodic_timer_frequency print so 500
> microseconds is sometimes reached.
>
>This patchs limits timer frequency with more smaller interval 200ms(5000Hz)
>to leave some headroom as Paolo suggested since Windows 10 changed the
>scheduler tick limit from 1024 Hz to 2048 Hz.

I would suggest re-writing this slightly, removing the 'this patch'
as some people suggested in other threads, and maybe some other
small re-wording, e.g.:

As suggested by Paolo, lower the timer frequency limit to a
smaller interval of 200 ms (5000 Hz) to leave some headroom. This
is required due to Windows 10 changing the scheduler tick limit
from 1024 Hz to 2048 Hz.

Also, in the subject line, maybe write it as 'Lower timer frequency
limit to 200ms'?

>
>Reported-by: Anthoine Bourgeois <[email protected]>
>Suggested-by: Paolo Bonzini <[email protected]>
>Cc: Paolo Bonzini <[email protected]>
>Cc: Radim Krčmář <[email protected]>
>Cc: Anthoine Bourgeois <[email protected]>
>Signed-off-by: Wanpeng Li <[email protected]>

With those changes (or similar):

Reviewed-by: Darren Kenny <[email protected]>

>---
> arch/x86/kvm/x86.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>index 51ecd38..dc47073 100644
>--- a/arch/x86/kvm/x86.c
>+++ b/arch/x86/kvm/x86.c
>@@ -114,7 +114,7 @@ module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
> static bool __read_mostly report_ignored_msrs = true;
> module_param(report_ignored_msrs, bool, S_IRUGO | S_IWUSR);
>
>-unsigned int min_timer_period_us = 500;
>+unsigned int min_timer_period_us = 200;
> module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
>
> static bool __read_mostly kvmclock_periodic_sync = true;
>--
>2.7.4
>

2018-05-04 12:29:07

by Wanpeng Li

[permalink] [raw]
Subject: Re: [PATCH] KVM: X86: Limit timer frequency with more smaller interval

ping,
2018-04-30 10:38 GMT+08:00 Wanpeng Li <[email protected]>:
> From: Wanpeng Li <[email protected]>
>
> Anthoine reported:
> The period used by Windows change over time but it can be 1 milliseconds
> or less. I saw the limit_periodic_timer_frequency print so 500
> microseconds is sometimes reached.
>
> This patchs limits timer frequency with more smaller interval 200ms(5000Hz)
> to leave some headroom as Paolo suggested since Windows 10 changed the
> scheduler tick limit from 1024 Hz to 2048 Hz.
>
> Reported-by: Anthoine Bourgeois <[email protected]>
> Suggested-by: Paolo Bonzini <[email protected]>
> Cc: Paolo Bonzini <[email protected]>
> Cc: Radim Krčmář <[email protected]>
> Cc: Anthoine Bourgeois <[email protected]>
> Signed-off-by: Wanpeng Li <[email protected]>
> ---
> arch/x86/kvm/x86.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 51ecd38..dc47073 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -114,7 +114,7 @@ module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
> static bool __read_mostly report_ignored_msrs = true;
> module_param(report_ignored_msrs, bool, S_IRUGO | S_IWUSR);
>
> -unsigned int min_timer_period_us = 500;
> +unsigned int min_timer_period_us = 200;
> module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
>
> static bool __read_mostly kvmclock_periodic_sync = true;
> --
> 2.7.4
>