[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYWCmVxnO8R3vsc-@anirudh-surface.localdomain>
Date: Fri, 6 Feb 2026 05:56:41 +0000
From: Anirudh Rayabharam <anirudh@...rudhrb.com>
To: Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, longli@...rosoft.com,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/4] mshv: Handle insufficient root memory hypervisor
statuses
On Thu, Feb 05, 2026 at 06:42:27PM +0000, Stanislav Kinsburskii wrote:
> When creating guest partition objects, the hypervisor may fail to
> allocate root partition pages and return an insufficient memory status.
> In this case, deposit memory using the root partition ID instead.
>
> Note: This error should never occur in a guest of L1VH partition context.
I think you should rephrse this to:
"... should never occur in an L1VH partition"
because none of the errors in this patch series occur inside a guest. They
either occur in L1VH or root or both.
>
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>
> ---
> drivers/hv/hv_common.c | 2 +
> drivers/hv/hv_proc.c | 14 ++++++++++
> include/hyperv/hvgdk_mini.h | 58 ++++++++++++++++++++++---------------------
> 3 files changed, 46 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index f20596276662..6b67ac616789 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -794,6 +794,8 @@ static const struct hv_status_info hv_status_infos[] = {
> _STATUS_INFO(HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE, -EIO),
> _STATUS_INFO(HV_STATUS_INSUFFICIENT_MEMORY, -ENOMEM),
> _STATUS_INFO(HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY, -ENOMEM),
> + _STATUS_INFO(HV_STATUS_INSUFFICIENT_ROOT_MEMORY, -ENOMEM),
> + _STATUS_INFO(HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY, -ENOMEM),
> _STATUS_INFO(HV_STATUS_INVALID_PARTITION_ID, -EINVAL),
> _STATUS_INFO(HV_STATUS_INVALID_VP_INDEX, -EINVAL),
> _STATUS_INFO(HV_STATUS_NOT_FOUND, -EIO),
> diff --git a/drivers/hv/hv_proc.c b/drivers/hv/hv_proc.c
> index 181f6d02bce3..5f4fd9c3231c 100644
> --- a/drivers/hv/hv_proc.c
> +++ b/drivers/hv/hv_proc.c
> @@ -121,6 +121,18 @@ int hv_deposit_memory_node(int node, u64 partition_id,
> case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY:
> num_pages = HV_MAX_CONTIGUOUS_ALLOCATION_PAGES;
> break;
> +
> + case HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY:
> + num_pages = HV_MAX_CONTIGUOUS_ALLOCATION_PAGES;
> + fallthrough;
> + case HV_STATUS_INSUFFICIENT_ROOT_MEMORY:
I have the same comment as on v2 about num_pages being uninitialized when we
reach this case directly.
Thanks,
Anirudh.
> + if (!hv_root_partition()) {
> + hv_status_err(hv_status, "Unexpected root memory deposit\n");
> + return -ENOMEM;
> + }
> + partition_id = HV_PARTITION_ID_SELF;
> + break;
> +
> default:
> hv_status_err(hv_status, "Unexpected!\n");
> return -ENOMEM;
> @@ -134,6 +146,8 @@ bool hv_result_needs_memory(u64 status)
> switch (hv_result(status)) {
> case HV_STATUS_INSUFFICIENT_MEMORY:
> case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY:
> + case HV_STATUS_INSUFFICIENT_ROOT_MEMORY:
> + case HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY:
> return true;
> }
> return false;
> diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h
> index 99ea0d03e657..50f5a1419052 100644
> --- a/include/hyperv/hvgdk_mini.h
> +++ b/include/hyperv/hvgdk_mini.h
> @@ -14,34 +14,36 @@ struct hv_u128 {
> } __packed;
>
> /* NOTE: when adding below, update hv_result_to_string() */
> -#define HV_STATUS_SUCCESS 0x0
> -#define HV_STATUS_INVALID_HYPERCALL_CODE 0x2
> -#define HV_STATUS_INVALID_HYPERCALL_INPUT 0x3
> -#define HV_STATUS_INVALID_ALIGNMENT 0x4
> -#define HV_STATUS_INVALID_PARAMETER 0x5
> -#define HV_STATUS_ACCESS_DENIED 0x6
> -#define HV_STATUS_INVALID_PARTITION_STATE 0x7
> -#define HV_STATUS_OPERATION_DENIED 0x8
> -#define HV_STATUS_UNKNOWN_PROPERTY 0x9
> -#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE 0xA
> -#define HV_STATUS_INSUFFICIENT_MEMORY 0xB
> -#define HV_STATUS_INVALID_PARTITION_ID 0xD
> -#define HV_STATUS_INVALID_VP_INDEX 0xE
> -#define HV_STATUS_NOT_FOUND 0x10
> -#define HV_STATUS_INVALID_PORT_ID 0x11
> -#define HV_STATUS_INVALID_CONNECTION_ID 0x12
> -#define HV_STATUS_INSUFFICIENT_BUFFERS 0x13
> -#define HV_STATUS_NOT_ACKNOWLEDGED 0x14
> -#define HV_STATUS_INVALID_VP_STATE 0x15
> -#define HV_STATUS_NO_RESOURCES 0x1D
> -#define HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED 0x20
> -#define HV_STATUS_INVALID_LP_INDEX 0x41
> -#define HV_STATUS_INVALID_REGISTER_VALUE 0x50
> -#define HV_STATUS_OPERATION_FAILED 0x71
> -#define HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY 0x75
> -#define HV_STATUS_TIME_OUT 0x78
> -#define HV_STATUS_CALL_PENDING 0x79
> -#define HV_STATUS_VTL_ALREADY_ENABLED 0x86
> +#define HV_STATUS_SUCCESS 0x0
> +#define HV_STATUS_INVALID_HYPERCALL_CODE 0x2
> +#define HV_STATUS_INVALID_HYPERCALL_INPUT 0x3
> +#define HV_STATUS_INVALID_ALIGNMENT 0x4
> +#define HV_STATUS_INVALID_PARAMETER 0x5
> +#define HV_STATUS_ACCESS_DENIED 0x6
> +#define HV_STATUS_INVALID_PARTITION_STATE 0x7
> +#define HV_STATUS_OPERATION_DENIED 0x8
> +#define HV_STATUS_UNKNOWN_PROPERTY 0x9
> +#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE 0xA
> +#define HV_STATUS_INSUFFICIENT_MEMORY 0xB
> +#define HV_STATUS_INVALID_PARTITION_ID 0xD
> +#define HV_STATUS_INVALID_VP_INDEX 0xE
> +#define HV_STATUS_NOT_FOUND 0x10
> +#define HV_STATUS_INVALID_PORT_ID 0x11
> +#define HV_STATUS_INVALID_CONNECTION_ID 0x12
> +#define HV_STATUS_INSUFFICIENT_BUFFERS 0x13
> +#define HV_STATUS_NOT_ACKNOWLEDGED 0x14
> +#define HV_STATUS_INVALID_VP_STATE 0x15
> +#define HV_STATUS_NO_RESOURCES 0x1D
> +#define HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED 0x20
> +#define HV_STATUS_INVALID_LP_INDEX 0x41
> +#define HV_STATUS_INVALID_REGISTER_VALUE 0x50
> +#define HV_STATUS_OPERATION_FAILED 0x71
> +#define HV_STATUS_INSUFFICIENT_ROOT_MEMORY 0x73
> +#define HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY 0x75
> +#define HV_STATUS_TIME_OUT 0x78
> +#define HV_STATUS_CALL_PENDING 0x79
> +#define HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY 0x83
> +#define HV_STATUS_VTL_ALREADY_ENABLED 0x86
>
> /*
> * The Hyper-V TimeRefCount register and the TSC
>
>
Powered by blists - more mailing lists