On Mon, Aug 15, 2016 at 03:27:08PM +0200, Julien Grall wrote:
> Hi Konrad,
> 
> On 12/08/2016 22:50, Konrad Rzeszutek Wilk wrote:
> > On Fri, Aug 12, 2016 at 05:00:47PM +0200, Julien Grall wrote:
> > > > diff --git a/xen/include/asm-arm/current.h 
> > > > b/xen/include/asm-arm/current.h
> > > > index 65c0cdf..f4fcfd6 100644
> > > > --- a/xen/include/asm-arm/current.h
> > > > +++ b/xen/include/asm-arm/current.h
> > > > @@ -33,8 +33,15 @@ static inline struct cpu_info *get_cpu_info(void)
> > > > 
> > > >  #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
> > > > 
> > > > +#ifdef CONFIG_LIVEPATCH
> > > > +#define switch_stack_and_jump(stack, fn)                               
> > > >  \
> > > > +    asm volatile ("mov sp,%0;"                                         
> > > >  \
> > > > +                  "bl check_for_livepatch_work;"                       
> > > >  \
> > > 
> > > May I ask why check_for_livepatch_work is called in switch_stack_and_jump?
> > 
> > From 29f4ab0b0a4ff62589af35b7cbc2334e1d9acdcd:
> >     To perform and action on a payload, the hypercall sets up a data
> >     structure to schedule the work.  A hook is added in the 
> > reset_stack_and_jump
> >     to check for work and execute it if needed (specifically we check an
> >     per-cpu flag to make this as quick as possible).
> > 
> >     In this way, patches can be applied with all CPUs idle and without
> >     stacks.  The first CPU to run check_for_xsplice_work() becomes the
> >     master and triggers a reschedule softirq to trigger all the other CPUs
> >     to enter check_for_xsplice_work() with no stack.  Once all CPUs
> >     have rendezvoused, all CPUs disable their IRQs and NMIs are ignored.
> >     The system is then quiscient and the master performs the action.
> >     After this, all CPUs enable IRQs and NMIs are re-enabled.
> 
> 
> I am a bit confused, switch_stack_and_jump will only be called on ARM when a
> vCPU is created. So why do you want to check livepatch at that time?
> 
> After looking at the x86 version, I noticed that reset_stack_and_jump is
> called every time Xen returns to the guest, correct?

Yes. I assumed ARM was the same.
> 
> If so, you may want to call check_for_livepatch_work in
> leave_hypervisor_tail instead. The latter will be call every time Xen
> returns to the guest.

Oooh. Thanks!
> 
> Regards,
> 
> -- 
> Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to