Re: [RFC PATCH v5 3/4] x86/acrn: Use HYPERVISOR_CALLBACK_VECTOR for ACRN guest upcall vector

From: Ingo Molnar
Date: Thu Apr 25 2019 - 03:17:07 EST



* Zhao Yakui <yakui.zhao@xxxxxxxxx> wrote:

> Linux kernel uses the HYPERVISOR_CALLBACK_VECTOR for hypervisor upcall
> vector. And it is already used for Xen and HyperV.

English sentences should not be started with 'and'.

> After ACRN hypervisor is detected, it will also use this defined vector
> to notify ACRN guest.

Missing 'the', twice.

> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_X86_ACRN_H
> +#define _ASM_X86_ACRN_H
> +
> +void acrn_hv_callback_vector(void);

Please mark these with 'extern', as customary in x86 headers.

>
> +#include <linux/interrupt.h>
> +#include <asm/acrn.h>
> +#include <asm/desc.h>
> #include <asm/hypervisor.h>
> +#include <asm/irq_regs.h>
>
> static uint32_t __init acrn_detect(void)
> {
> @@ -18,6 +22,8 @@ static uint32_t __init acrn_detect(void)
>
> static void __init acrn_init_platform(void)
> {
> + alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> + acrn_hv_callback_vector);

Why is this on two lines, not a single line?

> +static void (*acrn_intr_handler)(void);
> +
> +__visible void __irq_entry acrn_hv_vector_handler(struct pt_regs *regs)
> +{
> + struct pt_regs *old_regs = set_irq_regs(regs);
> +
> + entering_ack_irq();

Does the hypervisor model the APIC EOI command, i.e. does it require the
APIC to be acked? I.e. would not acking the APIC create an IRQ storm?

> + inc_irq_stat(irq_hv_callback_count);
> +
> + if (acrn_intr_handler)
> + acrn_intr_handler();

Nothing appears to be setting acrn_intr_handler, so this will never
execute anything? Is more code relying on this?

Thanks,

Ingo