[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [Very RFC PATCH 3/3] livepatch: Initial ARM32/64 support.



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?

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.

Regards,

--
Julien Grall

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.