From: Keir Fraser Subject: Re: lazy context switching Date: Fri, 26 Aug 2005 19:06:26 +0100 Message-ID: <3fb9863201507e36104caad99818d462@cl.cam.ac.uk> References: <200508251655.09988.hollisb@us.ibm.com> <7e83ab2167ab0a728f9ac47a6085cbc0@cl.cam.ac.uk> <32738a7d711e6cf6815ae0ef6f2994f9@us.ibm.com> <3e02d9e0d129595066ee4a6e47e08862@us.ibm.com> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <3e02d9e0d129595066ee4a6e47e08862@us.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Hollis Blanchard Cc: Jimi Xenidis , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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. -- Keir