Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757746AbcC2RR2 (ORCPT ); Tue, 29 Mar 2016 13:17:28 -0400 Received: from mail-oi0-f52.google.com ([209.85.218.52]:33681 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753226AbcC2RR0 (ORCPT ); Tue, 29 Mar 2016 13:17:26 -0400 MIME-Version: 1.0 In-Reply-To: <1459267075-44359-1-git-send-email-pbonzini@redhat.com> References: <1459267075-44359-1-git-send-email-pbonzini@redhat.com> From: David Matlack Date: Tue, 29 Mar 2016 10:16:20 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86: reduce default value of halt_poll_ns parameter To: Paolo Bonzini Cc: "linux-kernel@vger.kernel.org" , kvm list Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1975 Lines: 53 On Tue, Mar 29, 2016 at 8:57 AM, Paolo Bonzini wrote: > > Windows lets applications choose the frequency of the timer tick, > and in Windows 10 the maximum rate was changed from 1024 Hz to > 2048 Hz. Unfortunately, because of the way the Windows API > works, most applications who need a higher rate than the default > 64 Hz will just do > > timeGetDevCaps(&tc, sizeof(tc)); > timeBeginPeriod(tc.wPeriodMin); > > and pick the maximum rate. This causes very high CPU usage when > playing media or games on Windows 10, even if the guest does not > actually use the CPU very much, because the frequent timer tick > causes halt_poll_ns to kick in. > > There is no really good solution, especially because Microsoft > could sooner or later bump the limit to 4096 Hz, but for now > the best we can do is lower a bit the upper limit for > halt_poll_ns. :-( This is a good solution for now. I don't think we lose noticeable performance by lowering the max to 400 us. Do you think it's ever useful to poll for a timer interrupt? It seems like it wouldn't be. We don't need polling to deliver accurate timer interrupts, KVM already delivers the TSC deadline timer slightly early to account for injection delay. Maybe we can shrink polling anytime a timer interrupt wakes up a VCPU. > > Reported-by: Jon Panozzo > Signed-off-by: Paolo Bonzini > --- > arch/x86/include/asm/kvm_host.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index f62a9f37f79f..b7e394485a5f 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -43,7 +43,7 @@ > > #define KVM_PIO_PAGE_OFFSET 1 > #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 > -#define KVM_HALT_POLL_NS_DEFAULT 500000 > +#define KVM_HALT_POLL_NS_DEFAULT 400000 > > #define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS > > -- > 1.8.3.1 >