linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Yang Zhang <yang.zhang.wz@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kvm@vger.kernel.org, Wanpeng Li <wanpeng.li@hotmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	rkrcmar@redhat.com, dmatlack@google.com, agraf@suse.de,
	Peter Zijlstra <peterz@infradead.org>,
	Len Brown <lenb@kernel.org>, Linux PM <linux-pm@vger.kernel.org>,
	jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH RFC hack dont apply] intel_idle: support running within a VM
Date: Wed, 4 Oct 2017 10:09:39 -0700	[thread overview]
Message-ID: <20171004100939.1893e4a7@jacob-builder> (raw)
In-Reply-To: <20171004050706-mutt-send-email-mst@kernel.org>

On Wed, 4 Oct 2017 05:09:09 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Oct 02, 2017 at 10:12:49AM -0700, Jacob Pan wrote:
> > On Sat, 30 Sep 2017 01:21:43 +0200
> > "Rafael J. Wysocki" <rafael@kernel.org> wrote:
> >   
> > > On Sat, Sep 30, 2017 at 12:01 AM, Michael S. Tsirkin
> > > <mst@redhat.com> wrote:  
> > > > intel idle driver does not DTRT when running within a VM:
> > > > when going into a deep power state, the right thing to
> > > > do is to exit to hypervisor rather than to keep polling
> > > > within guest using mwait.
> > > >
> > > > Currently the solution is just to exit to hypervisor each time
> > > > we go idle - this is why kvm does not expose the mwait leaf to
> > > > guests even when it allows guests to do mwait.
> > > >
> > > > But that's not ideal - it seems better to use the idle driver to
> > > > guess when will the next interrupt arrive.    
> > > 
> > > The idle driver alone is not sufficient for that, though.
> > >   
> > I second that. Why try to solve this problem at vendor specific
> > driver level?  
> 
> Well we still want to e.g. mwait if possible - saves power.
> 
> > perhaps just a pv idle driver that decide whether to vmexit
> > based on something like local per vCPU timer expiration? I guess we
> > can't predict other wake events such as interrupts.
> > e.g.
> > if (get_next_timer_interrupt() > kvm_halt_target_residency)
> > 	vmexit
> > else
> > 	poll
> > 
> > Jacob  
> 
> It's not always a poll, on x86 putting the CPU in a low power state
> is possible within a VM.
> 
Are you talking about using mwait/monitor in the user space which are
available on some Intel CPUs, such as Xeon Phi? I guess if the guest
can identify host CPU id, it is doable.

> Does not seem possible on other CPUs that's why it's vendor specific.
> 

[Jacob Pan]

  reply	other threads:[~2017-10-04 17:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 22:01 [PATCH RFC hack dont apply] intel_idle: support running within a VM Michael S. Tsirkin
2017-09-29 23:21 ` Rafael J. Wysocki
2017-10-02 17:12   ` Jacob Pan
2017-10-03 21:02     ` Thomas Gleixner
2017-10-04  2:11       ` Michael S. Tsirkin
2017-10-04  7:56         ` Thomas Gleixner
2017-10-04 20:18           ` Rafael J. Wysocki
2017-10-04  2:09     ` Michael S. Tsirkin
2017-10-04 17:09       ` Jacob Pan [this message]
2017-10-04 17:12         ` Michael S. Tsirkin
2017-10-04 18:31           ` Jacob Pan
2017-10-05 10:44             ` Paolo Bonzini
2017-10-06  3:37             ` Michael S. Tsirkin

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=20171004100939.1893e4a7@jacob-builder \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=agraf@suse.de \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wanpeng.li@hotmail.com \
    --cc=yang.zhang.wz@gmail.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).