From: "Simon Martin" Subject: Re: Stack switching in a PV guest Date: Fri, 20 Dec 2013 14:12:55 +0000 Message-ID: References: <1351251014.20131216115608@gmail.com> Reply-To: Simon Martin Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7051275862919681598==" Return-path: In-Reply-To: <1351251014.20131216115608@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Ian Campbell , xen-devel List-Id: xen-devel@lists.xenproject.org --===============7051275862919681598== Content-Type: multipart/alternative; boundary="------=_MB6DF6C69A-DA74-4947-B23E-504CE22E1E92" --------=_MB6DF6C69A-DA74-4947-B23E-504CE22E1E92 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; format=flowed; charset=utf-8 Hi Jan >> Furthermore, the guest's kernel stack wants to be switched via >> __HYPERVISOR_stack_switch, or else the next interrupt/exception >> would end up still using the old stack. I think I've finally got my head round using HYPERVISOR_stack_switch. It= =20 seems to replace all my stack magic, and at least it's not crashing now. However, I now have a different problem. I am running my context switch=20 off of a single shot timer. When the timer fires Xen transfers control=20 to my PV guest via the hypercall_callback. The hypercall_callback handler stores the current CPU register file,=20 however the stored rsp always points to the hypercall stack, not the=20 stack that was active in my PV at the moment the timer event fired. I need to store the PV stack pointer so I can recover it later when my=20 scheduler activates it. I have looked back up the stack and I don't=20 really see where my active stack pointer is. Any idea where I can get=20 it? Regards. --------=_MB6DF6C69A-DA74-4947-B23E-504CE22E1E92 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hi Jan 
 
 
 Furthermore, the guest's kernel stack wants to be switched via=
 __HYPERVISOR_stack_switch, or else the next interrupt/exception=
 would end up still using the old stack.
I think I've finally got my head round using HYPERVISOR_stack_switch.= It seems to replace all my stack magic, and at least it's not crashing = now.
 
However, I now have a different problem. I am running my context switc= h off of a single shot timer. When the timer fires Xen transfers control= to my PV guest via the hypercall_callback.
 
The hypercall_callback handler stores the current CPU register= file, however the stored rsp always points to the hypercall stack, not = the stack that was active in my PV at the moment the timer event fired.
 
I need to store the PV stack pointer so I can recover it later when= my scheduler activates it. I have looked back up the stack and I don't = really see where my active stack pointer is. Any idea where I can get it?
 
Regards.
 
--------=_MB6DF6C69A-DA74-4947-B23E-504CE22E1E92-- --===============7051275862919681598== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============7051275862919681598==--