x86: dovetail: Harden __send_ipi_mask[_ex] for KVM and Hyper-V guests
PATCH 1/1 x86: dovetail: Harden __send_ipi_mask[_ex] for KVM and Hyper-V guests
From: Jan Kiszka <[email protected]>
These functions are called in case paravirtual IPIs are used. Just like for hard submission handlers, we need to harden the path to avoid splashes like these:
IRQ pipeline: some code running in oob context 'Xenomai'
called an in-band only routine
CPU: 0 PID: 410 Comm: (udev-worker) Not tainted 5.10.229-cip54+ #265 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014 IRQ stage: Xenomai Call Trace: dump_stack+0x84/0x9c inband_irq_save+0xa/0x30 __send_ipi_mask+0x81/0x260 ? preempt_count_sub+0x96/0xe0 ? _raw_spin_unlock_irq+0x33/0x50 ? xnsched_pick_next+0xe0/0xe0 ? ___xnsched_run+0x491/0x5b0 ? ktime_get_mono_fast_ns+0x50/0xb0 ___xnsched_run+0x491/0x5b0 run_oob_call+0x97/0x170 xnthread_start+0x23f/0x330 ? rt_stack_deliver+0x340/0x340 [rtnet] rtdm_task_init.part.14+0x7e/0xc0
Signed-off-by Jan Kiszka <[email protected]>
--- arch/x86/hyperv/hv_apic.c | 4 ++-- arch/x86/kernel/kvm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/hyperv/hv_apic.c +2 -2
@@ -111,7 +111,7 @@ static bool __send_ipi_mask_ex(const struct cpumask *mask, int vector,if (!(ms_hyperv.hints &HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED ))return false; -local_irq_save (flags); + flags =hard_local_irq_save (); arg = (struct hv_send_ipi_ex **)this_cpu_ptr (hyperv_pcpu_input_arg); ipi_arg = *arg;
@@ -148,7 +148,7 @@ static bool __send_ipi_mask_ex(const struct cpumask *mask, int vector, ipi_arg, NULL); ipi_mask_ex_done: -local_irq_restore (flags); +hard_local_irq_restore (flags);return hv_result_success (status); }
arch/x86/kernel/kvm.c +2 -2
@@ -522,7 +522,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector)if (cpumask_empty (mask))return ; -local_irq_save (flags); + flags =hard_local_irq_save ();switch (vector) {default :
@@ -560,7 +560,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) ret); } -local_irq_restore (flags); +hard_local_irq_restore (flags); }static void kvm_send_ipi_mask (const struct cpumask *mask,int vector)
Signature · 1 line
2.43.0