[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.13] x86: replace reset_stack_and_jump_nolp()
commit d39eb6fbb3ef0ef72f2fa88c9710e1416bc3a878 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Dec 15 14:22:22 2020 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Dec 15 14:22:22 2020 +0100 x86: replace reset_stack_and_jump_nolp() Move the necessary check into check_for_livepatch_work(), rather than mostly duplicating reset_stack_and_jump() for this purpose. This is to prevent an inflation of reset_stack_and_jump() flavors. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> master commit: e3df3fbc448b9ae401332ba7d71c190d2efe3ae8 master date: 2020-12-15 13:40:27 +0100 --- xen/arch/x86/domain.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/pv/domain.c | 2 +- xen/arch/x86/setup.c | 2 +- xen/common/livepatch.c | 5 +++++ xen/include/asm-x86/current.h | 10 ++-------- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 135c6d5b82..f4f55d0d84 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -192,7 +192,7 @@ static void noreturn continue_idle_domain(struct vcpu *v) { /* Idle vcpus might be attached to non-idle units! */ if ( !is_idle_domain(v->sched_unit->domain) ) - reset_stack_and_jump_nolp(guest_idle_loop); + reset_stack_and_jump(guest_idle_loop); reset_stack_and_jump(idle_loop); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index fb73319cae..1f7b26151b 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1032,7 +1032,7 @@ static void noreturn svm_do_resume(struct vcpu *v) hvm_do_resume(v); - reset_stack_and_jump_nolp(svm_asm_do_resume); + reset_stack_and_jump(svm_asm_do_resume); } void svm_vmenter_helper(const struct cpu_user_regs *regs) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index d53eceb23a..f10f6b78ec 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1889,7 +1889,7 @@ void vmx_do_resume(struct vcpu *v) if ( host_cr4 != read_cr4() ) __vmwrite(HOST_CR4, read_cr4()); - reset_stack_and_jump_nolp(vmx_asm_do_vmentry); + reset_stack_and_jump(vmx_asm_do_vmentry); } static inline unsigned long vmr(unsigned long field) diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index aea8d6b2b9..efaa2e7abf 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -61,7 +61,7 @@ custom_runtime_param("pcid", parse_pcid); static void noreturn continue_nonidle_domain(struct vcpu *v) { check_wakeup_from_wait(); - reset_stack_and_jump_nolp(ret_from_intr); + reset_stack_and_jump(ret_from_intr); } static int setup_compat_l4(struct vcpu *v) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ae61e93024..cc7274eae6 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -631,7 +631,7 @@ static void __init noreturn reinit_bsp_stack(void) stack_base[0] = stack; memguard_guard_stack(stack); - reset_stack_and_jump_nolp(init_done); + reset_stack_and_jump(init_done); } /* diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 1f89984c9a..bace2da70c 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -1300,6 +1300,11 @@ void check_for_livepatch_work(void) s_time_t timeout; unsigned long flags; + /* Only do any work when invoked in truly idle state. */ + if ( system_state != SYS_STATE_active || + !is_idle_domain(current->sched_unit->domain) ) + return; + /* Fast path: no work to do. */ if ( !per_cpu(work_to_do, cpu ) ) return; diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index 0b47485337..d930b79404 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -129,22 +129,16 @@ unsigned long get_stack_dump_bottom (unsigned long sp); # define CHECK_FOR_LIVEPATCH_WORK "" #endif -#define switch_stack_and_jump(fn, instr) \ +#define reset_stack_and_jump(fn) \ ({ \ __asm__ __volatile__ ( \ "mov %0,%%"__OP"sp;" \ - instr \ + CHECK_FOR_LIVEPATCH_WORK \ "jmp %c1" \ : : "r" (guest_cpu_user_regs()), "i" (fn) : "memory" ); \ unreachable(); \ }) -#define reset_stack_and_jump(fn) \ - switch_stack_and_jump(fn, CHECK_FOR_LIVEPATCH_WORK) - -#define reset_stack_and_jump_nolp(fn) \ - switch_stack_and_jump(fn, "") - /* * Which VCPU's state is currently running on each CPU? * This is not necesasrily the same as 'current' as a CPU may be -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.13
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |