From patchwork Mon Apr 30 02:38:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 10370713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90F0560383 for ; Mon, 30 Apr 2018 02:39:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83AB128928 for ; Mon, 30 Apr 2018 02:39:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7837F28936; Mon, 30 Apr 2018 02:39:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FCB628928 for ; Mon, 30 Apr 2018 02:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbeD3CjW (ORCPT ); Sun, 29 Apr 2018 22:39:22 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:42075 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbeD3CjV (ORCPT ); Sun, 29 Apr 2018 22:39:21 -0400 Received: by mail-pg0-f68.google.com with SMTP id p9-v6so2440835pgc.9; Sun, 29 Apr 2018 19:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bN/n/cazfFGYaIZWJxgXVhkVbNZwEh0lhdMAyfqDgzI=; b=b/ZbqodqZCdnvKcffPwb8nvEOGu/y6wYaZrg1JYC68uKipKs6wqGZ/aF/5++vqC6c0 q/8ztHYL9k2SFu02Xr5wq8XHW1TJbBz0s6HS1vykNfMNqt/LfLTbGv0mUlUyjmIde/3U WLSIbzek6TSHq2tnyttT3wV1kQMYrG9FLEyOzNe4JHx/l1AiKRKB3X5YwswYCDZTxaee UBAZNJdtrU/ITTU5vk5gBMpq12CGdakEkwIW3FkVcl98esyZVKiZueaUu7+5SIpUJCqJ AkA3oxQgRimy2CWYVv2MXqwDtwyDTPaVQKisLW7UfsrdQIQoDjDYUMk0sM0Wm1wXJfD6 xYGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bN/n/cazfFGYaIZWJxgXVhkVbNZwEh0lhdMAyfqDgzI=; b=OsRN9DxIND78LJMMZKH/wOGlbRbwpepnHZqkLTOXjqoQaOz3d7G6iaZrgKeC6MdAa+ t46qyCjWe1o312/eCjCXYmbUiAKUEqwmjm01e85zBnt2t6OpfBFhIi9C8UG6hIZriunL aNlaTXAKKUGAJ1k2o2nzIg6RocFOkCUHC0d7CkxdfgrPFl4lJN4H/rqXmR54PwRTPg3I Lgbg6gHJPQj5/KJNXYXr7efAvX3sGXMLEs/2dyB0SfkYXSZ/YBxFgc2lkfLZVhcXSPaW 18WoebfFV6N4nQLY8GY2o29NUO8xh6lYRqV7g1s6zDeWJcUXOA9r9RQhjFl+XbyNuRgF PvEQ== X-Gm-Message-State: ALQs6tA5RtRQ3opFJL63c7FWApth93PKf1E52oTb9uUfCYe5qZyCG+IZ oLd+yZHObhQjgkAJQVaP8cVNpg== X-Google-Smtp-Source: AB8JxZqXnHV7cUlvakBeBuGEfjJowwoiKRzLju31qnM5izAOA82ruRBlAHfOznnq68MtTMfCLdZ0og== X-Received: by 2002:a17:902:33a5:: with SMTP id b34-v6mr10905078plc.232.1525055961173; Sun, 29 Apr 2018 19:39:21 -0700 (PDT) Received: from localhost.localdomain ([45.248.77.205]) by smtp.googlemail.com with ESMTPSA id c28sm14311349pfe.27.2018.04.29.19.39.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Apr 2018 19:39:20 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Anthoine Bourgeois Subject: [PATCH] KVM: X86: Limit timer frequency with more smaller interval Date: Sun, 29 Apr 2018 19:38:20 -0700 Message-Id: <1525055900-20729-1-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li 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 Suggested-by: Paolo Bonzini Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Anthoine Bourgeois Signed-off-by: Wanpeng Li Reviewed-by: Darren Kenny --- 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;