x86/PV: avoid double stack reset during schedule tail handling
authorJan Beulich <jbeulich@suse.com>
Wed, 16 Dec 2020 15:42:50 +0000 (16:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 16 Dec 2020 15:42:50 +0000 (16:42 +0100)
Invoking check_wakeup_from_wait() from assembly allows the new
continue_pv_domain() to replace the prior continue_nonidle_domain() as
the tail hook, eliminating an extra reset_stack_and_jump().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
xen/arch/x86/pv/domain.c
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/asm_defns.h

index 1a607f856e3af7162c19a3647dd1bdd6b3968c9d..23d60091435d400b009e9f97918f80b9c1b33301 100644 (file)
@@ -110,12 +110,6 @@ static int parse_pcid(const char *s)
     return rc;
 }
 
-static void noreturn continue_nonidle_domain(void)
-{
-    check_wakeup_from_wait();
-    reset_stack_and_jump(ret_from_intr);
-}
-
 static int setup_compat_l4(struct vcpu *v)
 {
     struct page_info *pg;
@@ -341,13 +335,14 @@ void pv_domain_destroy(struct domain *d)
     FREE_XENHEAP_PAGE(d->arch.pv.gdt_ldt_l1tab);
 }
 
+void noreturn continue_pv_domain(void);
 
 int pv_domain_initialise(struct domain *d)
 {
     static const struct arch_csw pv_csw = {
         .from = paravirt_ctxt_switch_from,
         .to   = paravirt_ctxt_switch_to,
-        .tail = continue_nonidle_domain,
+        .tail = continue_pv_domain,
     };
     int rc = -ENOMEM;
 
index 000eb9722b037af195a79958ddb2537b7704f0ee..526c388458e209299d3260ae063dfd08f36acaa1 100644 (file)
@@ -557,8 +557,10 @@ ENTRY(dom_crash_sync_extable)
         .text
 
 /* No special register assumptions. */
-ENTRY(ret_from_intr)
 #ifdef CONFIG_PV
+ENTRY(continue_pv_domain)
+        call  check_wakeup_from_wait
+ret_from_intr:
         GET_CURRENT(bx)
         testb $3, UREGS_cs(%rsp)
         jz    restore_all_xen
@@ -567,6 +569,7 @@ ENTRY(ret_from_intr)
         je    test_all_events
         jmp   compat_test_all_events
 #else
+ret_from_intr:
         ASSERT_CONTEXT_IS_XEN
         jmp   restore_all_xen
 #endif
index b42a19b6546bf12f5d62a0e9b33164972f7d57e3..774a294d1541d8a1b5c351ed2e3f87bd7670c5c5 100644 (file)
@@ -23,7 +23,6 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
 #include <asm/indirect_thunk_asm.h>
 
 #ifndef __ASSEMBLY__
-void ret_from_intr(void);
 
 /*
  * This output constraint should be used for any inline asm which has a "call"