Re: [RFC PATCH V6 04/14] x86/sev: optimize system vector processing invoked from #HV exception
From: Peter Zijlstra
Date: Tue May 16 2023 - 06:24:32 EST
On Mon, May 15, 2023 at 12:59:06PM -0400, Tianyu Lan wrote:
So your subject states:
> Subject: [RFC PATCH V6 04/14] x86/sev: optimize system vector processing invoked from #HV exception
^^^^^^^^
> @@ -228,51 +238,11 @@ static void do_exc_hv(struct pt_regs *regs)
> } else if (pending_events.vector == IA32_SYSCALL_VECTOR) {
> WARN(1, "syscall shouldn't happen\n");
> } else if (pending_events.vector >= FIRST_SYSTEM_VECTOR) {
> - switch (pending_events.vector) {
> -#if IS_ENABLED(CONFIG_HYPERV)
> - case HYPERV_STIMER0_VECTOR:
> - sysvec_hyperv_stimer0(regs);
> - break;
> - case HYPERVISOR_CALLBACK_VECTOR:
> - sysvec_hyperv_callback(regs);
> - break;
> -#endif
> -#ifdef CONFIG_SMP
> - case RESCHEDULE_VECTOR:
> - sysvec_reschedule_ipi(regs);
> - break;
> - case IRQ_MOVE_CLEANUP_VECTOR:
> - sysvec_irq_move_cleanup(regs);
> - break;
> - case REBOOT_VECTOR:
> - sysvec_reboot(regs);
> - break;
> - case CALL_FUNCTION_SINGLE_VECTOR:
> - sysvec_call_function_single(regs);
> - break;
> - case CALL_FUNCTION_VECTOR:
> - sysvec_call_function(regs);
> - break;
> -#endif
> -#ifdef CONFIG_X86_LOCAL_APIC
> - case ERROR_APIC_VECTOR:
> - sysvec_error_interrupt(regs);
> - break;
> - case SPURIOUS_APIC_VECTOR:
> - sysvec_spurious_apic_interrupt(regs);
> - break;
> - case LOCAL_TIMER_VECTOR:
> - sysvec_apic_timer_interrupt(regs);
> - break;
> - case X86_PLATFORM_IPI_VECTOR:
> - sysvec_x86_platform_ipi(regs);
> - break;
> -#endif
> - case 0x0:
> - break;
> - default:
> - panic("Unexpected vector %d\n", vector);
> - unreachable();
> + if (!(sysvec_table[pending_events.vector - FIRST_SYSTEM_VECTOR])) {
> + WARN(1, "system vector entry 0x%x is NULL\n",
> + pending_events.vector);
> + } else {
> + (*sysvec_table[pending_events.vector - FIRST_SYSTEM_VECTOR])(regs);
> }
> } else {
> common_interrupt(regs, pending_events.vector);
But your code replace direct calls with an indirect call. Now AFAIK,
this SNP shit came with Zen3, and Zen3 still uses retpolines for
indirect calls.
Can you connect the dots?