* [PATCH] x86: dovetail: Harden __send_ipi_mask for KVM guests
@ 2025-02-24 16:44 Jan Kiszka
2025-02-24 17:15 ` Philippe Gerum
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2025-02-24 16:44 UTC (permalink / raw)
To: Philippe Gerum, Xenomai, Florian Bezdeka
From: Jan Kiszka <jan.kiszka@siemens.com>
This function is called in case paravirtual IPIs of a KVM host 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 <jan.kiszka@siemens.com>
---
arch/x86/kernel/kvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 5df1061fc6ee1..b183caf41aa44 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -525,7 +525,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:
@@ -563,7 +563,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)
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: dovetail: Harden __send_ipi_mask for KVM guests
2025-02-24 16:44 [PATCH] x86: dovetail: Harden __send_ipi_mask for KVM guests Jan Kiszka
@ 2025-02-24 17:15 ` Philippe Gerum
2025-02-24 17:23 ` Florian Bezdeka
0 siblings, 1 reply; 3+ messages in thread
From: Philippe Gerum @ 2025-02-24 17:15 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xenomai, Florian Bezdeka
Jan Kiszka <jan.kiszka@siemens.com> writes:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This function is called in case paravirtual IPIs of a KVM host 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 <jan.kiszka@siemens.com>
> ---
> arch/x86/kernel/kvm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 5df1061fc6ee1..b183caf41aa44 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -525,7 +525,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:
> @@ -563,7 +563,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)
Ack.
--
Philippe.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: dovetail: Harden __send_ipi_mask for KVM guests
2025-02-24 17:15 ` Philippe Gerum
@ 2025-02-24 17:23 ` Florian Bezdeka
0 siblings, 0 replies; 3+ messages in thread
From: Florian Bezdeka @ 2025-02-24 17:23 UTC (permalink / raw)
To: Philippe Gerum, Jan Kiszka; +Cc: Xenomai
On Mon, 2025-02-24 at 18:15 +0100, Philippe Gerum wrote:
> Jan Kiszka <jan.kiszka@siemens.com> writes:
>
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> >
> > This function is called in case paravirtual IPIs of a KVM host 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 <jan.kiszka@siemens.com>
> > ---
> > arch/x86/kernel/kvm.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> > index 5df1061fc6ee1..b183caf41aa44 100644
> > --- a/arch/x86/kernel/kvm.c
> > +++ b/arch/x86/kernel/kvm.c
> > @@ -525,7 +525,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:
> > @@ -563,7 +563,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)
>
> Ack.
Ack. The hyperv PV code is also affected (__send_ipi_mask_ex).
>
> --
> Philippe.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-24 17:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 16:44 [PATCH] x86: dovetail: Harden __send_ipi_mask for KVM guests Jan Kiszka
2025-02-24 17:15 ` Philippe Gerum
2025-02-24 17:23 ` Florian Bezdeka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.