public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>,
	Chris Wright <chrisw@sous-sol.org>,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Subject: Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2)
Date: Fri, 3 Dec 2010 14:40:15 +0200	[thread overview]
Message-ID: <20101203124015.GJ2924@redhat.com> (raw)
In-Reply-To: <4CF806E7.1090404@codemonkey.ws>

On Thu, Dec 02, 2010 at 02:51:51PM -0600, Anthony Liguori wrote:
> On 12/02/2010 02:12 PM, Marcelo Tosatti wrote:
> >>>>  	opt = CPU_BASED_TPR_SHADOW |
> >>>>  	      CPU_BASED_USE_MSR_BITMAPS |
> >>>>  	      CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
> >>>>-- 
> >>>>1.7.0.4
> >>>Breaks async PF (see "checks on guest state"),
> >>Sorry, I don't follow what you mean here.  Can you elaborate?
> >VCPU in HLT state only allows injection of certain events that
> >would be delivered on HLT. #PF is not one of them.
> 
> But you can't inject an exception into a guest while the VMCS is
> active, can you?  So the guest takes an exit while in the hlt
> instruction but that's no different than if the guest has been
> interrupted because of hlt exiting.
> 
Async PF completion do not kick vcpu out of a guest mode. It wakes vcpu
only if it is waiting on waitqueue. It was done to not generate
unnecessary overhead.

> >You'd have to handle this situation on event injection, vmentry fails
> >otherwise. Or perhaps clear HLT state on vmexit and vmentry.
> 
> So this works today because on a hlt exit, emulate_halt() will clear
> the the HLT state which then puts the the vcpu into a state where it
> can receive an exception injection?
> 
> Regards,
> 
> Anthony Liguori
> 
> >>>  timer reinjection
> >>>probably.
> >>Timer reinjection will continue to work as expected.  If a guest is
> >>halting an external interrupt is delivered (by a timer), the guest
> >>will still exit as expected.
> >>
> >>I can think of anything that would be functionally correct and still
> >>depend on getting hlt exits because ultimately, a guest never
> >>actually has to do a hlt (and certainly there are guests that
> >>won't).
> >LAPIC pending timer events will be reinjected on entry path, if
> >accumulated. So they depend on any exit. If you disable HLT-exiting,
> >delay will increase. OK, maybe thats irrelevant.
> >
> >>>  It should be possible to achieve determinism with
> >>>a scheduler policy?
> >>If the desire is the ultimate desire is to have the guests be
> >>scheduled in a non-work conserving fashion, I can't see a more
> >>direct approach that to simply not have the guests yield (which is
> >>ultimately what hlt trapping does).
> >>
> >>Anything the scheduler would do is after the fact and probably based
> >>on inference about why the yield.
> >Another issue is you ignore the hosts idea of the best way to sleep
> >(ACPI, or whatever).
> >
> >And handling inactive HLT state (which was never enabled) can be painful.
> >
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

  parent reply	other threads:[~2010-12-03 12:40 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 13:59 [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2) Anthony Liguori
2010-12-02 14:39 ` lidong chen
2010-12-02 15:23   ` Anthony Liguori
2010-12-02 15:23   ` Anthony Liguori
2010-12-03  9:38     ` Avi Kivity
2010-12-03 11:12       ` Srivatsa Vaddagiri
2010-12-03 23:28       ` Anthony Liguori
2010-12-02 17:37 ` Marcelo Tosatti
2010-12-02 19:07   ` Anthony Liguori
2010-12-02 20:12     ` Marcelo Tosatti
2010-12-02 20:51       ` Anthony Liguori
2010-12-03  9:36         ` Avi Kivity
2010-12-03 22:45           ` Anthony Liguori
2010-12-04  8:13             ` Avi Kivity
2010-12-04 13:30               ` Anthony Liguori
2010-12-06  8:28                 ` Avi Kivity
2010-12-06  8:35                   ` Avi Kivity
2010-12-06 13:58                     ` Anthony Liguori
2010-12-06 14:01                       ` Avi Kivity
2010-12-06 14:02                         ` Avi Kivity
2010-12-06 14:08                           ` Anthony Liguori
2010-12-06 14:14                             ` Gleb Natapov
2010-12-06 14:03                         ` Anthony Liguori
2010-12-06 14:33                           ` Avi Kivity
2010-12-06 15:07                             ` Anthony Liguori
2010-12-06 15:16                               ` Avi Kivity
2010-12-06 16:21                                 ` Anthony Liguori
2010-12-06 16:30                                   ` Avi Kivity
2010-12-06 16:33                                     ` Anthony Liguori
2010-12-03 12:40         ` Gleb Natapov [this message]
2010-12-03 23:31       ` Anthony Liguori
2010-12-03 22:42   ` Anthony Liguori
2010-12-04  8:16     ` Avi Kivity
2010-12-04 13:48       ` Anthony Liguori
2010-12-06  8:32         ` Avi Kivity
2010-12-02 19:14 ` Chris Wright
2010-12-02 20:25   ` Anthony Liguori
2010-12-02 20:40     ` Chris Wright
2010-12-02 20:40   ` Marcelo Tosatti
2010-12-02 21:07     ` Chris Wright
2010-12-02 22:37       ` Anthony Liguori
2010-12-03  2:42         ` Chris Wright
2010-12-03  3:21           ` Anthony Liguori
2010-12-03  3:44             ` Chris Wright
2010-12-03 14:25               ` Anthony Liguori
2010-12-02 22:27     ` Anthony Liguori
2010-12-03 22:49     ` Anthony Liguori
2010-12-04  5:43       ` Srivatsa Vaddagiri
2010-12-03  9:40   ` Avi Kivity
2010-12-03 11:21     ` Srivatsa Vaddagiri
2010-12-03 11:57   ` Srivatsa Vaddagiri
2010-12-03 16:27     ` Srivatsa Vaddagiri
2010-12-03 17:29       ` Chris Wright
2010-12-03 17:33         ` Srivatsa Vaddagiri
2010-12-04  8:18           ` Avi Kivity
2010-12-03 17:57         ` Srivatsa Vaddagiri
2010-12-03 17:58           ` Chris Wright
2010-12-03 18:07             ` Anthony Liguori
2010-12-03 18:12               ` Srivatsa Vaddagiri
2010-12-04  8:19                 ` Avi Kivity
2010-12-03 18:20               ` Chris Wright
2010-12-03 18:55                 ` Anthony Liguori
2010-12-03 18:10             ` Marcelo Tosatti
2010-12-03 18:24               ` Marcelo Tosatti
2010-12-03 17:28     ` Chris Wright
2010-12-03 17:36       ` Srivatsa Vaddagiri
2010-12-03 17:38         ` Chris Wright
2010-12-03 17:43           ` Srivatsa Vaddagiri
2010-12-03 17:47           ` Anthony Liguori

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=20101203124015.GJ2924@redhat.com \
    --to=gleb@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=vatsa@linux.vnet.ibm.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