WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH] xen: use iret directly where possible

To: Andi Kleen <ak@xxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH] xen: use iret directly where possible
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Mon, 04 Jun 2007 14:28:58 -0700
Cc: Virtualization Mailing List <virtualization@xxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>
Delivery-date: Mon, 04 Jun 2007 14:27:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200706042305.05340.ak@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <46646662.9020707@xxxxxxxx> <200706042145.30339.ak@xxxxxxx> <4664772A.20602@xxxxxxxx> <200706042305.05340.ak@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070302)
Andi Kleen wrote:
> If you stay cli you don't need that. Why is it that it has to enable 
> interrupts?
>   

Bear in mind we're talking about running paravirt under Xen in ring 1.

The cli/sti instructions don't control the event mask, so they're
effectively expensive no-ops (they trap into the hypervisor, are
emulated as no-ops). But if you mean cli as a general term for
"events/interrupts masked", then they can't remain masked when you
return to usermode.   iret normally sets the current eflags IF state
from the on-stack IF, but that's irrelevent to Xen; we need to extract
eflags.IF from the on-stack eflags, and put that into the vcpu's event
mask.  That's inherently non-atomic with respect to iret.

>> In your sequence, the event may become pending after "check again", even
>> though it won't be delivered. 
>>     
>
> sti only takes affect one instruction after it. So if you can make 
> it that small it would also work. But that might not help you.

No, it doesn't.  sti can't be run directly in ring1, and trapping into
Xen is exactly what this patch is trying to avoid.  Even if it did, Xen
treats it as a no-op, and it has no effect on the event mask state. 
Even if Xen did use it to control the event mask state, it would lose
the 1-instruction shadow because it trapped into the hypervisor, and a
new event may be pending as it comes out.


    J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel