2020-09-09 09:37:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3 02/17] x86/acrn: Introduce acrn_{setup, remove}_intr_handler()

On Wed, Sep 09, 2020 at 05:08:21PM +0800, [email protected] wrote:
> From: Shuo Liu <[email protected]>
>
> The ACRN Hypervisor builds an I/O request when a trapped I/O access
> happens in User VM. Then, ACRN Hypervisor issues an upcall by sending
> a notification interrupt to the Service VM. HSM in the Service VM needs
> to hook the notification interrupt to handle I/O requests.
>
> Notification interrupts from ACRN Hypervisor are already supported and
> a, currently uninitialized, callback called.
>
> Export two APIs for HSM to setup/remove its callback.
>
> Originally-by: Yakui Zhao <[email protected]>
> Signed-off-by: Shuo Liu <[email protected]>
> Reviewed-by: Zhi Wang <[email protected]>
> Reviewed-by: Reinette Chatre <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Sean Christopherson <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Fengwei Yin <[email protected]>
> Cc: Zhi Wang <[email protected]>
> Cc: Zhenyu Wang <[email protected]>
> Cc: Yu Wang <[email protected]>
> Cc: Reinette Chatre <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> ---
> arch/x86/include/asm/acrn.h | 8 ++++++++
> arch/x86/kernel/cpu/acrn.c | 19 +++++++++++++++++++
> 2 files changed, 27 insertions(+)
> create mode 100644 arch/x86/include/asm/acrn.h
>
> diff --git a/arch/x86/include/asm/acrn.h b/arch/x86/include/asm/acrn.h
> new file mode 100644
> index 000000000000..ff259b69cde7
> --- /dev/null
> +++ b/arch/x86/include/asm/acrn.h
> @@ -0,0 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_X86_ACRN_H
> +#define _ASM_X86_ACRN_H
> +
> +void acrn_setup_intr_handler(void (*handler)(void));
> +void acrn_remove_intr_handler(void);
> +
> +#endif /* _ASM_X86_ACRN_H */
> diff --git a/arch/x86/kernel/cpu/acrn.c b/arch/x86/kernel/cpu/acrn.c
> index 0b2c03943ac6..bd1d7e759a0f 100644
> --- a/arch/x86/kernel/cpu/acrn.c
> +++ b/arch/x86/kernel/cpu/acrn.c
> @@ -9,7 +9,11 @@
> *
> */
>
> +#define pr_fmt(fmt) "acrn: " fmt
> +
> #include <linux/interrupt.h>
> +
> +#include <asm/acrn.h>
> #include <asm/apic.h>
> #include <asm/cpufeatures.h>
> #include <asm/desc.h>
> @@ -55,6 +59,21 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback)
> set_irq_regs(old_regs);
> }
>
> +void acrn_setup_intr_handler(void (*handler)(void))
> +{
> + if (acrn_intr_handler)
> + pr_warn("Overwrite the acrn_intr_handler.\n");

What can someone do with this warning? If it's really an "error", why
not prevent this from happening?

Don't scare users with things they can do nothing about.

thanks,

greg k-h


2020-09-10 06:33:56

by Shuo Liu

[permalink] [raw]
Subject: Re: [PATCH v3 02/17] x86/acrn: Introduce acrn_{setup, remove}_intr_handler()

Hi Greg,

On Wed 9.Sep'20 at 11:36:09 +0200, Greg Kroah-Hartman wrote:
>On Wed, Sep 09, 2020 at 05:08:21PM +0800, [email protected] wrote:
>> From: Shuo Liu <[email protected]>
>>
>> The ACRN Hypervisor builds an I/O request when a trapped I/O access
>> happens in User VM. Then, ACRN Hypervisor issues an upcall by sending
>> a notification interrupt to the Service VM. HSM in the Service VM needs
>> to hook the notification interrupt to handle I/O requests.
>>
>> Notification interrupts from ACRN Hypervisor are already supported and
>> a, currently uninitialized, callback called.
>>
>> Export two APIs for HSM to setup/remove its callback.
>>
>> Originally-by: Yakui Zhao <[email protected]>
>> Signed-off-by: Shuo Liu <[email protected]>
>> Reviewed-by: Zhi Wang <[email protected]>
>> Reviewed-by: Reinette Chatre <[email protected]>
>> Cc: Dave Hansen <[email protected]>
>> Cc: Sean Christopherson <[email protected]>
>> Cc: Dan Williams <[email protected]>
>> Cc: Fengwei Yin <[email protected]>
>> Cc: Zhi Wang <[email protected]>
>> Cc: Zhenyu Wang <[email protected]>
>> Cc: Yu Wang <[email protected]>
>> Cc: Reinette Chatre <[email protected]>
>> Cc: Greg Kroah-Hartman <[email protected]>
>> ---
>> arch/x86/include/asm/acrn.h | 8 ++++++++
>> arch/x86/kernel/cpu/acrn.c | 19 +++++++++++++++++++
>> 2 files changed, 27 insertions(+)
>> create mode 100644 arch/x86/include/asm/acrn.h
>>
>> diff --git a/arch/x86/include/asm/acrn.h b/arch/x86/include/asm/acrn.h
>> new file mode 100644
>> index 000000000000..ff259b69cde7
>> --- /dev/null
>> +++ b/arch/x86/include/asm/acrn.h
>> @@ -0,0 +1,8 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _ASM_X86_ACRN_H
>> +#define _ASM_X86_ACRN_H
>> +
>> +void acrn_setup_intr_handler(void (*handler)(void));
>> +void acrn_remove_intr_handler(void);
>> +
>> +#endif /* _ASM_X86_ACRN_H */
>> diff --git a/arch/x86/kernel/cpu/acrn.c b/arch/x86/kernel/cpu/acrn.c
>> index 0b2c03943ac6..bd1d7e759a0f 100644
>> --- a/arch/x86/kernel/cpu/acrn.c
>> +++ b/arch/x86/kernel/cpu/acrn.c
>> @@ -9,7 +9,11 @@
>> *
>> */
>>
>> +#define pr_fmt(fmt) "acrn: " fmt
>> +
>> #include <linux/interrupt.h>
>> +
>> +#include <asm/acrn.h>
>> #include <asm/apic.h>
>> #include <asm/cpufeatures.h>
>> #include <asm/desc.h>
>> @@ -55,6 +59,21 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback)
>> set_irq_regs(old_regs);
>> }
>>
>> +void acrn_setup_intr_handler(void (*handler)(void))
>> +{
>> + if (acrn_intr_handler)
>> + pr_warn("Overwrite the acrn_intr_handler.\n");
>
>What can someone do with this warning? If it's really an "error", why
>not prevent this from happening?

It cannot happen if there are not new user of it. The current user is
HSM hsm_init()/hsm_exit() in the later patches of this series.

I can remove the warn.

>
>Don't scare users with things they can do nothing about.

OK. Got it. Thanks.

Thanks
shuo