From: Hollis Blanchard Subject: Re: lazy context switching Date: Fri, 26 Aug 2005 14:24:36 -0500 Message-ID: <200508261424.36611.hollisb@us.ibm.com> References: <200508251655.09988.hollisb@us.ibm.com> <3e02d9e0d129595066ee4a6e47e08862@us.ibm.com> <3fb9863201507e36104caad99818d462@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <3fb9863201507e36104caad99818d462@cl.cam.ac.uk> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Jimi Xenidis , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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