Re: [PATCH v2 03/13] mshv: add SEV-SNP isolated page hypercalls

[email protected] Mon, 10 Aug 2026 12:58:29 +0000
Newsgroups org.kernel.vger.linux-hyperv
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The error log in `hv_call_import_isolated_pages` under-reports the number of successfully imported pages if an error occurs mid-batch.
--

--- Patch [3]: [PATCH v2 03/13] mshv: add SEV-SNP isolated page hypercalls ---
commit 6412d57ab824c1079e692800b1ba551aa8b078c8
Author: Wei Liu <[email protected]>

mshv: add SEV-SNP isolated page hypercalls
    
This commit adds hypercall helpers for importing isolated pages and
completing isolated imports to transfer state to the hypervisor. These
are used by SEV-SNP guest launch flows.

> diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c
> index 48abe338c06f8..4e48c1a9a6308 100644
> --- a/drivers/hv/mshv_root_hv_call.c
> +++ b/drivers/hv/mshv_root_hv_call.c
[ ... ]
> @@ -1010,6 +1014,104 @@ int hv_unmap_stats_page(enum hv_stats_object_type type,
>  }
>  
>  #ifdef HV_SUPPORTS_SEV_SNP_GUESTS
> +int hv_call_import_isolated_pages(u64 partition_id, u64 *pages,
> +				  u64 num_pages,
> +				  enum hv_isolated_page_type page_type,
> +				  enum hv_isolated_page_size page_size,
> +				  void (*completion_handler)(void *data,
> +							     u64 *status),
> +				  void *completion_data)
> +{
[ ... ]
> +		completed = hv_repcomp(status);
> +		if (hv_result(status) == HV_STATUS_CALL_PENDING) {
> +			completion_handler(completion_data, &status);
> +			if (hv_repcomp(status))
> +				completed = hv_repcomp(status);
> +		}
> +
> +		if (!hv_result_success(status)) {
> +			pr_err("%s: completed %llu of %llu, %s\n", __func__,
> +			       num_pages - remaining, num_pages,
> +			       hv_result_to_string(status));

[Severity: Low]
Does this error message under-report the number of completed pages?

If a rep hypercall fails after completing some iterations mid-batch, the
iterations completed in the current batch are stored in the completed
variable via hv_repcomp(status).

Because remaining is only decremented at the end of the loop, calculating
num_pages - remaining here appears to omit the pages successfully completed
in the current failing batch.

> +			return hv_result_to_errno(status);
> +		}

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3