All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured
Date: Sun, 09 Sep 2012 17:28:23 +0300	[thread overview]
Message-ID: <504CA787.2000905@redhat.com> (raw)
In-Reply-To: <DE8DF0795D48FD4CA783C40EC8292335322311@SHSMSX101.ccr.corp.intel.com>

On 09/07/2012 03:07 PM, Liu, Jinsong wrote:
> Avi Kivity wrote:
>>> 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;
>> 
>> I prefer a patch making kvm for x86 depend on hrtimers.  kvm already
>> provides a high resolution timer to the guest in the local apic,
>> backing it with the jiffies event source will likely cause some
>> guests to malfunction.
> 
> Yep, I did a draft test for kvm lapic timer, it also worked fail when CONFIG_HIGH_RES_TIMERS disabled.
> 
> Attached is the udpated patch.
> 
> Thanks,
> Jinsong
> 
> ====================
> From 64d0458ec50a7d6917adf1e9735ba6e6ae6024ad Mon Sep 17 00:00:00 2001
> From: Liu, Jinsong <jinsong.liu@intel.com>
> Date: Sat, 8 Sep 2012 03:32:31 +0800
> Subject: [PATCH] KVM: select HIGH_RES_TIMERS when KVM enabled
> 
> This is for 2 reasons:
> 1. it's pointless for kvm lapic timer and tsc deadline timer
> when kernel hrtimer not configured as high resolution, since
> that would be not accurate based on wheel;
> 2. kvm lapic timer and 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 then make kvm lapic timer and tsc deadline timer fail.
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
> ---
>  arch/x86/kvm/Kconfig |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index a28f338..5f861ca 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -24,6 +24,8 @@ config KVM
>  	depends on PCI
>  	# for TASKSTATS/TASK_DELAY_ACCT:
>  	depends on NET
> +	# for HIGH_RES_TIMERS
> +	depends on !ARCH_USES_GETTIMEOFFSET
>  	select PREEMPT_NOTIFIERS
>  	select MMU_NOTIFIER
>  	select ANON_INODES
> @@ -37,6 +39,8 @@ config KVM
>  	select TASK_DELAY_ACCT
>  	select PERF_EVENTS
>  	select HAVE_KVM_MSI
> +	select GENERIC_CLOCKEVENTS
> +	select HIGH_RES_TIMERS

hrtimers is an intrusive feature, I don't think we should force-enable
it.  Please change it to a depends on.


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-09-09 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 15:07 [PATCH] KVM: tsc deadline timer works only when hrtimer high resolution configured Liu, Jinsong
2012-09-06 13:58 ` Avi Kivity
2012-09-07 12:07   ` Liu, Jinsong
2012-09-09 14:28     ` Avi Kivity [this message]
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=504CA787.2000905@redhat.com \
    --to=avi@redhat.com \
    --cc=jinsong.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.