linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liu, Jinsong" <jinsong.liu@intel.com>
To: Marcelo Tosatti <mtosatti@redhat.com>,
	Avi Kivity <avi@redhat.com>, kvm <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured
Date: Tue, 4 Sep 2012 15:07:00 +0000	[thread overview]
Message-ID: <DE8DF0795D48FD4CA783C40EC829233531F0E4@SHSMSX101.ccr.corp.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

>From 728a17e2de591b557c3c8ba31076b4bf2ca5ab42 Mon Sep 17 00:00:00 2001
From: Liu, Jinsong <jinsong.liu@intel.com>
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 <jinsong.liu@intel.com>
---
 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;
-- 
1.7.1

[-- Attachment #2: 0001-KVM-tsc-deadline-timer-works-only-when-hrtimer-high-.patch --]
[-- Type: application/octet-stream, Size: 1218 bytes --]

From 728a17e2de591b557c3c8ba31076b4bf2ca5ab42 Mon Sep 17 00:00:00 2001
From: Liu, Jinsong <jinsong.liu@intel.com>
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 <jinsong.liu@intel.com>
---
 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;
-- 
1.7.1


             reply	other threads:[~2012-09-04 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 15:07 Liu, Jinsong [this message]
2012-09-06 13:58 ` [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured Avi Kivity
2012-09-07 12:07   ` Liu, Jinsong
2012-09-09 14:28     ` Avi Kivity
2012-09-09 14:54       ` Liu, Jinsong
2012-09-09 14:59         ` Avi Kivity
2012-09-09 15:10           ` Liu, Jinsong
2012-09-10  8:10             ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DE8DF0795D48FD4CA783C40EC829233531F0E4@SHSMSX101.ccr.corp.intel.com \
    --to=jinsong.liu@intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).