Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mshv: Handle insufficient root memory hypervisor statuses

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.

Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Reviewed-by: Mukesh R <mrathor@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Stanislav Kinsburskii and committed by
Wei Liu
158ebb57 cf82dd5e

+46 -28
+2
drivers/hv/hv_common.c
··· 794 794 _STATUS_INFO(HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE, -EIO), 795 795 _STATUS_INFO(HV_STATUS_INSUFFICIENT_MEMORY, -ENOMEM), 796 796 _STATUS_INFO(HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY, -ENOMEM), 797 + _STATUS_INFO(HV_STATUS_INSUFFICIENT_ROOT_MEMORY, -ENOMEM), 798 + _STATUS_INFO(HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY, -ENOMEM), 797 799 _STATUS_INFO(HV_STATUS_INVALID_PARTITION_ID, -EINVAL), 798 800 _STATUS_INFO(HV_STATUS_INVALID_VP_INDEX, -EINVAL), 799 801 _STATUS_INFO(HV_STATUS_NOT_FOUND, -EIO),
+14
drivers/hv/hv_proc.c
··· 121 121 case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY: 122 122 num_pages = HV_MAX_CONTIGUOUS_ALLOCATION_PAGES; 123 123 break; 124 + 125 + case HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY: 126 + num_pages = HV_MAX_CONTIGUOUS_ALLOCATION_PAGES; 127 + fallthrough; 128 + case HV_STATUS_INSUFFICIENT_ROOT_MEMORY: 129 + if (!hv_root_partition()) { 130 + hv_status_err(hv_status, "Unexpected root memory deposit\n"); 131 + return -ENOMEM; 132 + } 133 + partition_id = HV_PARTITION_ID_SELF; 134 + break; 135 + 124 136 default: 125 137 hv_status_err(hv_status, "Unexpected!\n"); 126 138 return -ENOMEM; ··· 146 134 switch (hv_result(status)) { 147 135 case HV_STATUS_INSUFFICIENT_MEMORY: 148 136 case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY: 137 + case HV_STATUS_INSUFFICIENT_ROOT_MEMORY: 138 + case HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY: 149 139 return true; 150 140 } 151 141 return false;
+30 -28
include/hyperv/hvgdk_mini.h
··· 14 14 } __packed; 15 15 16 16 /* NOTE: when adding below, update hv_result_to_string() */ 17 - #define HV_STATUS_SUCCESS 0x0 18 - #define HV_STATUS_INVALID_HYPERCALL_CODE 0x2 19 - #define HV_STATUS_INVALID_HYPERCALL_INPUT 0x3 20 - #define HV_STATUS_INVALID_ALIGNMENT 0x4 21 - #define HV_STATUS_INVALID_PARAMETER 0x5 22 - #define HV_STATUS_ACCESS_DENIED 0x6 23 - #define HV_STATUS_INVALID_PARTITION_STATE 0x7 24 - #define HV_STATUS_OPERATION_DENIED 0x8 25 - #define HV_STATUS_UNKNOWN_PROPERTY 0x9 26 - #define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE 0xA 27 - #define HV_STATUS_INSUFFICIENT_MEMORY 0xB 28 - #define HV_STATUS_INVALID_PARTITION_ID 0xD 29 - #define HV_STATUS_INVALID_VP_INDEX 0xE 30 - #define HV_STATUS_NOT_FOUND 0x10 31 - #define HV_STATUS_INVALID_PORT_ID 0x11 32 - #define HV_STATUS_INVALID_CONNECTION_ID 0x12 33 - #define HV_STATUS_INSUFFICIENT_BUFFERS 0x13 34 - #define HV_STATUS_NOT_ACKNOWLEDGED 0x14 35 - #define HV_STATUS_INVALID_VP_STATE 0x15 36 - #define HV_STATUS_NO_RESOURCES 0x1D 37 - #define HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED 0x20 38 - #define HV_STATUS_INVALID_LP_INDEX 0x41 39 - #define HV_STATUS_INVALID_REGISTER_VALUE 0x50 40 - #define HV_STATUS_OPERATION_FAILED 0x71 41 - #define HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY 0x75 42 - #define HV_STATUS_TIME_OUT 0x78 43 - #define HV_STATUS_CALL_PENDING 0x79 44 - #define HV_STATUS_VTL_ALREADY_ENABLED 0x86 17 + #define HV_STATUS_SUCCESS 0x0 18 + #define HV_STATUS_INVALID_HYPERCALL_CODE 0x2 19 + #define HV_STATUS_INVALID_HYPERCALL_INPUT 0x3 20 + #define HV_STATUS_INVALID_ALIGNMENT 0x4 21 + #define HV_STATUS_INVALID_PARAMETER 0x5 22 + #define HV_STATUS_ACCESS_DENIED 0x6 23 + #define HV_STATUS_INVALID_PARTITION_STATE 0x7 24 + #define HV_STATUS_OPERATION_DENIED 0x8 25 + #define HV_STATUS_UNKNOWN_PROPERTY 0x9 26 + #define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE 0xA 27 + #define HV_STATUS_INSUFFICIENT_MEMORY 0xB 28 + #define HV_STATUS_INVALID_PARTITION_ID 0xD 29 + #define HV_STATUS_INVALID_VP_INDEX 0xE 30 + #define HV_STATUS_NOT_FOUND 0x10 31 + #define HV_STATUS_INVALID_PORT_ID 0x11 32 + #define HV_STATUS_INVALID_CONNECTION_ID 0x12 33 + #define HV_STATUS_INSUFFICIENT_BUFFERS 0x13 34 + #define HV_STATUS_NOT_ACKNOWLEDGED 0x14 35 + #define HV_STATUS_INVALID_VP_STATE 0x15 36 + #define HV_STATUS_NO_RESOURCES 0x1D 37 + #define HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED 0x20 38 + #define HV_STATUS_INVALID_LP_INDEX 0x41 39 + #define HV_STATUS_INVALID_REGISTER_VALUE 0x50 40 + #define HV_STATUS_OPERATION_FAILED 0x71 41 + #define HV_STATUS_INSUFFICIENT_ROOT_MEMORY 0x73 42 + #define HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY 0x75 43 + #define HV_STATUS_TIME_OUT 0x78 44 + #define HV_STATUS_CALL_PENDING 0x79 45 + #define HV_STATUS_INSUFFICIENT_CONTIGUOUS_ROOT_MEMORY 0x83 46 + #define HV_STATUS_VTL_ALREADY_ENABLED 0x86 45 47 46 48 /* 47 49 * The Hyper-V TimeRefCount register and the TSC