Re: [PATCH 1/3] arm64: entry: sdei: always set VBAR_EL1 on SDEI entry
From: Kiryl Shutsemau (Meta)
Date: Thu Nov 19 2026 - 11:57:33 EST
On Tue, Nov 17, 2026 at 05:48:12PM +0000, Ada Couprie Diaz wrote:
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index beb56891fc4f..cb122163a68d 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -1079,19 +1079,22 @@ __sdei_handler(struct pt_regs *regs, struct sdei_registered_event *arg)
> far = read_sysreg(far_el1);
>
> /*
> - * With KPTI, VBAR_EL1 holds the trampoline vectors from the return to
> - * EL0 until the next exception from EL0 maps the kernel. They only
> - * handle exceptions from EL0: an exception taken here would run their
> - * empty current-EL half and never come back. Switch to the kernel
> - * vectors. The IRQ-like resume keeps using the interrupted VBAR, so it
> - * still goes through the trampoline.
> + * As an SDEI event can take over at any point, VBAR_EL1 might not allow
> + * us to take an exception safely :
> + * - With KPTI, VBAR_EL1 holds the trampoline vectors from the return to
> + * EL0 until the next exception from EL0 maps the kernel. They only
> + * handle exceptions from EL0: an exception taken here would run their
> + * empty current-EL half and never come back ;
> + * - With VHE, the kernel runs at EL2 and VBAR_EL1 accesses VBAR_EL2.
> + * KVM might be running a guest and switched VBAR_EL2 to the
> + * hypervisor vectors.
> + *
> + * Switch to the kernel vectors unconditionally and restore
> + * the interrupted VBAR_EL1 before returning.
> */
> vbar = read_sysreg(vbar_el1);
> - if (arm64_kernel_unmapped_at_el0() &&
> - vbar == (unsigned long)raw_cpu_read(this_cpu_vector)) {
> - write_sysreg((unsigned long)vectors, vbar_el1);
> - isb();
> - }
> + write_sysreg((unsigned long)vectors, vbar_el1);
> + isb();
This makes the comment I added in do_sdei_event() wrong: it still says
that an exception taken during a KVM world switch goes to the hyp
vectors and hyp-panics. Could you drop it in this patch?
--
Kiryl Shutsemau / Kirill A. Shutemov