From patchwork Tue Sep 4 15:07:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Jinsong" X-Patchwork-Id: 1402691 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 81EDF4025E for ; Tue, 4 Sep 2012 15:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757180Ab2IDPHH (ORCPT ); Tue, 4 Sep 2012 11:07:07 -0400 Received: from mga03.intel.com ([143.182.124.21]:41867 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757152Ab2IDPHF (ORCPT ); Tue, 4 Sep 2012 11:07:05 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 04 Sep 2012 08:07:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,367,1344236400"; d="scan'208,223";a="188619432" Received: from fmsmsx105.amr.corp.intel.com ([10.19.9.36]) by azsmga001.ch.intel.com with ESMTP; 04 Sep 2012 08:07:03 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.19.17.220) by FMSMSX105.amr.corp.intel.com (10.19.9.36) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 4 Sep 2012 08:07:03 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX151.amr.corp.intel.com (10.19.17.220) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 4 Sep 2012 08:07:02 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.239]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.175]) with mapi id 14.01.0355.002; Tue, 4 Sep 2012 23:07:01 +0800 From: "Liu, Jinsong" To: Marcelo Tosatti , Avi Kivity , kvm , "linux-kernel@vger.kernel.org" Subject: [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured Thread-Topic: [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured Thread-Index: Ac2Kru6AEaLQ0dDCRmG5O7fBmMDyIw== Date: Tue, 4 Sep 2012 15:07:00 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From 728a17e2de591b557c3c8ba31076b4bf2ca5ab42 Mon Sep 17 00:00:00 2001 From: Liu, Jinsong Date: Wed, 5 Sep 2012 03:18:15 +0800 Subject: [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured This is for 2 reasons: 1. it's pointless to enable tsc deadline timer to guest when kernel hrtimer not configured as high resolution, since that would be un-precise based on wheel; 2. tsc deadline timer based on hrtimer, setting a leftmost node to rb tree and then do hrtimer reprogram. If hrtimer not configured as high resolution, hrtimer_enqueue_reprogram do nothing and would make tsc deadline timer fail. Signed-off-by: Liu, Jinsong --- arch/x86/kvm/x86.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 148ed66..0e64997 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2210,7 +2210,11 @@ int kvm_dev_ioctl_check_extension(long ext) r = kvm_has_tsc_control; break; case KVM_CAP_TSC_DEADLINE_TIMER: +#ifdef CONFIG_HIGH_RES_TIMERS r = boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER); +#else + r = 0; +#endif break; default: r = 0;