[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4a27944-7622-429c-9e59-602f727363b2@linux.microsoft.com>
Date: Wed, 8 Jan 2025 13:08:29 -0800
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
To: Roman Kisel <romank@...ux.microsoft.com>, hpa@...or.com,
kys@...rosoft.com, bp@...en8.de, dave.hansen@...ux.intel.com,
decui@...rosoft.com, eahariha@...ux.microsoft.com, haiyangz@...rosoft.com,
mingo@...hat.com, mhklinux@...look.com, tglx@...utronix.de,
tiala@...rosoft.com, wei.liu@...nel.org, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, x86@...nel.org
Cc: apais@...rosoft.com, benhill@...rosoft.com, ssengar@...rosoft.com,
sunilmut@...rosoft.com, vdso@...bites.dev
Subject: Re: [PATCH v5 3/5] hyperv: Enable the hypercall output page for the
VTL mode
On 12/30/2024 10:09 AM, Roman Kisel wrote:
> Due to the hypercall page not being allocated in the VTL mode,
> the code resorts to using a part of the input page.
>
> Allocate the hypercall output page in the VTL mode thus enabling
> it to use it for output and share code with dom0.
>
> Signed-off-by: Roman Kisel <romank@...ux.microsoft.com>
> ---
> drivers/hv/hv_common.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index c6ed3ba4bf61..c983cfd4d6c0 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -340,7 +340,7 @@ int __init hv_common_init(void)
> BUG_ON(!hyperv_pcpu_input_arg);
>
> /* Allocate the per-CPU state for output arg for root */
> - if (hv_root_partition) {
> + if (hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE)) {
> hyperv_pcpu_output_arg = alloc_percpu(void *);
> BUG_ON(!hyperv_pcpu_output_arg);
> }
> @@ -435,7 +435,7 @@ int hv_common_cpu_init(unsigned int cpu)
> void **inputarg, **outputarg;
> u64 msr_vp_index;
> gfp_t flags;
> - int pgcount = hv_root_partition ? 2 : 1;
> + const int pgcount = (hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE)) ? 2 : 1;
> void *mem;
> int ret;
>
> @@ -453,7 +453,7 @@ int hv_common_cpu_init(unsigned int cpu)
> if (!mem)
> return -ENOMEM;
>
> - if (hv_root_partition) {
> + if (hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE)) {
> outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
> *outputarg = (char *)mem + HV_HYP_PAGE_SIZE;
> }
Replying in a new thread since I don't have all the context about the different
VTL code paths that may need to converge. To my perspective, the approach in this
patch seems perfectly reasonable to fix the current issue.
One small improvement might be to put this check into a helper function. That would
make it easier to amend later when/if a clearly better solution is proposed.
Something like:
static inline bool hv_output_page_exists()
{
return hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE);
}
Thanks
Nuno
Powered by blists - more mailing lists