All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Fritsch <sf@sfritsch.de>, kvm@vger.kernel.org
Cc: Gleb Natapov <gleb@kernel.org>
Subject: Re: Hypercall for sleeping for some amount of time?
Date: Fri, 23 Jan 2015 10:53:00 +0100	[thread overview]
Message-ID: <54C219FC.7050203@redhat.com> (raw)
In-Reply-To: <1592884.UZW4Xi8OkR@k>



On 23/01/2015 10:40, Stefan Fritsch wrote:
> Hi,
> 
> there are situations where a guest needs to wait, but has interrupts 
> disabled.  Usually this is done by polling in a tight loop, which is a 
> waste of CPU cycles on a virtualized system. Therefore I propose to 
> add a hypercall to KVM that allows the guest to yield the CPU for a 
> specified amount of time.
> 
> One significant use case is the guest sitting in a kernel debugger and 
> polling for user input. But I expect that there are other situations 
> where such a hypercall could be useful, for example during hardware 
> detection at startup.
> 
> What do you think about this idea?
> 
> What would be the preferred interface for such a hypercall? Using 
> vmcall like KVM_HC_*, or MSR write, or even a simple IO port write? Is 
> there a way to make this architecture independent?
> 
> For detection, at least a new bit in KVM_CPUID_FEATURES would be 
> necessary.  Does one also need more information, like the minimum 
> supported delay and the expected granularity of the delay? Also, 
> should the call be simply "best effort" or should it guarantee that it 
> sleeps for at least the requested time? I think keeping it simple at 
> first would be best.

I think a platform device similar to drivers/platform/x86/pvpanic.c
would be best.  That would be a simple IO port write (milliseconds?),
with the port described in ACPI.

Paolo

  reply	other threads:[~2015-01-23  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  9:40 Hypercall for sleeping for some amount of time? Stefan Fritsch
2015-01-23  9:53 ` Paolo Bonzini [this message]
2015-01-23 11:18   ` Stefan Fritsch
2015-01-23 11:58     ` Paolo Bonzini
2015-01-23 20:36       ` Stefan Fritsch

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=54C219FC.7050203@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sf@sfritsch.de \
    /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.