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/
Home Products Support Community News


[Xen-devel] Re: lazy context switching

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] Re: lazy context switching
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Fri, 26 Aug 2005 14:24:36 -0500
Cc: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 26 Aug 2005 19:25:12 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <3fb9863201507e36104caad99818d462@xxxxxxxxxxxx>
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>
Organization: IBM Linux Technology Center
References: <200508251655.09988.hollisb@xxxxxxxxxx> <3e02d9e0d129595066ee4a6e47e08862@xxxxxxxxxx> <3fb9863201507e36104caad99818d462@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.8.2
On Friday 26 August 2005 13:06, Keir Fraser wrote:
> On 26 Aug 2005, at 18:40, Hollis Blanchard wrote:
> > context_switch() will be called from somewhere beneath c_handler(). At
> > that point, the original nonvolatiles will have been saved across many
> > stack frames (starting with c_handler()'s), so we really are unable to
> > access them at this point. However, we trust that by the time we get
> > back to the exception handler, the original nonvolatiles will have
> > been restored off all those stack frames.
> Hmmmm... Anyone interested in the state of a paused vcpu will call
> sync_vcpu_execstate() after descheduling the vcpu. That is an entirely
> arch-specific function that you can define to wait until the
> non-volatile registers are safely saved to memory.
> Maybe you could add a flag to the arch-specific portion of the vcpu
> structure that gets set after the non-volatile registers are saved to
> memory and cleared when they are restored to active use. Then
> sync_vcpu_execstate() can spin on that flag waiting for it to be
> non-zero.

I think this could work, in conjunction with using the HDEC timer solely as a 
context-switch interrupt (so saving all nonvolatiles on HDEC).

However, if we ever want to context switch for other reasons (e.g. a "yield" 
hypercall), we're back to the same problem: the hcall exception handler won't 
save the nonvolatiles...

Hollis Blanchard
IBM Linux Technology Center

Xen-devel mailing list