public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Joerg Roedel" <joerg.roedel-5C7GfCeVMHo@public.gmane.org>
To: "Avi Kivity" <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] SVM: forbid guest to execute monitor/mwait
Date: Thu, 22 Mar 2007 13:22:49 +0100	[thread overview]
Message-ID: <20070322122249.GG20139@amd.com> (raw)
In-Reply-To: <4602700E.1030500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

On Thu, Mar 22, 2007 at 02:01:18PM +0200, Avi Kivity wrote:
> Joerg Roedel wrote:
> >On Thu, Mar 22, 2007 at 01:40:26PM +0200, Avi Kivity wrote:
> >  
> >>Joerg Roedel wrote:
> >>    
> >>>Right. But it is possible for userspace to enable monitor bit for the
> >>>guest. Without virtualization of these 2 instructions the guest would
> >>>idle in the guest state after calling mwait and prevent other processes
> >>>and guests from running in that time.       
> >>Won't an interrupt during mwait cause a vmexit?
> >>    
> >
> >Yes, an interrupt would cause an vmexit. But depending on the HZ value
> >of the host it may be a lot of time until the next interrupt. And over
> >time this will sum up and slow down other tasks.
> >  
> 
> Well, a guest can cause exactly the same effect with
> 
>    cli
> spin:
>    jmp spin
> 
> without executing any instructions that are not reported by cpuid.

Intentionally, yes. In this case the guest knows what it is doing and we
have no way to prevent such things anyway. If it executes mwait this
delay loop is not intended by the guest.

To summarize my point:

We agree that we should hide the monitor cpuid bit to the guest from the
kernel level. Allowing the guest to use mwait if its available on the
processor without proper virtualization would cause the processor to
idle in the guest mode.
I would additionally forbid the guest to execute these instructions.
Likely the guest won't use them anyway when the cpuid bit is not set,
but if this bit is not set, the execution of these instructions should
cause an #UD as in any real processor, imho.

Joerg

-- 
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  parent reply	other threads:[~2007-03-22 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21 18:47 [PATCH] SVM: forbid guest to execute monitor/mwait Joerg Roedel
     [not found] ` <20070321184700.GA20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22  7:38   ` Avi Kivity
     [not found]     ` <46023264.4010105-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22  9:56       ` Joerg Roedel
     [not found]         ` <20070322095605.GB20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22 10:06           ` Avi Kivity
     [not found]             ` <46025528.5010707-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 10:17               ` Joerg Roedel
     [not found]                 ` <20070322101729.GC20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22 10:42                   ` Avi Kivity
     [not found]                     ` <46025D94.8050606-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 11:07                       ` Joerg Roedel
     [not found]                         ` <20070322110733.GE20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22 11:40                           ` Avi Kivity
     [not found]                             ` <46026B2A.2080501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 11:56                               ` Joerg Roedel
     [not found]                                 ` <20070322115602.GF20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22 12:01                                   ` Avi Kivity
     [not found]                                     ` <4602700E.1030500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 12:22                                       ` Joerg Roedel [this message]
     [not found]                                         ` <20070322122249.GG20139-5C7GfCeVMHo@public.gmane.org>
2007-03-22 12:33                                           ` Avi Kivity
     [not found]                                             ` <460277AE.9040403-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 12:46                                               ` Joerg Roedel

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=20070322122249.GG20139@amd.com \
    --to=joerg.roedel-5c7gfcevmho@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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