linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Easwar Hariharan <eahariha@linux.microsoft.com>
To: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-acpi@vger.kernel.org, eahariha@linux.microsoft.com,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	mhklinux@outlook.com, decui@microsoft.com,
	catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, daniel.lezcano@linaro.org, joro@8bytes.org,
	robin.murphy@arm.com, arnd@arndb.de,
	jinankjain@linux.microsoft.com, muminulrussell@gmail.com,
	skinsburskii@linux.microsoft.com, mrathor@linux.microsoft.com,
	ssengar@linux.microsoft.com, apais@linux.microsoft.com,
	Tianyu.Lan@microsoft.com, stanislav.kinsburskiy@gmail.com,
	gregkh@linuxfoundation.org, vkuznets@redhat.com,
	prapal@linux.microsoft.com, muislam@microsoft.com,
	anrayabh@linux.microsoft.com, rafael@kernel.org, lenb@kernel.org,
	corbet@lwn.net
Subject: Re: [PATCH v5 01/10] hyperv: Convert Hyper-V status codes to strings
Date: Wed, 26 Feb 2025 20:22:10 -0800	[thread overview]
Message-ID: <2889fab1-4836-4a66-aa63-b63d8cc70a69@linux.microsoft.com> (raw)
In-Reply-To: <1740611284-27506-2-git-send-email-nunodasneves@linux.microsoft.com>

On 2/26/2025 3:07 PM, Nuno Das Neves wrote:
> Introduce hv_result_to_string() for this purpose. This allows
> hypercall failures to be debugged more easily with dmesg.
> 

Let the commit message stand on its own, i.e. state that hv_result_to_string()
is introduced to convert hyper-v status codes to string.

> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> ---
>  drivers/hv/hv_common.c         | 65 ++++++++++++++++++++++++++++++++++
>  drivers/hv/hv_proc.c           | 13 ++++---
>  include/asm-generic/mshyperv.h |  1 +
>  3 files changed, 74 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index 9804adb4cc56..ce20818688fe 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -740,3 +740,68 @@ void hv_identify_partition_type(void)
>  			pr_crit("Hyper-V: CONFIG_MSHV_ROOT not enabled!\n");
>  	}
>  }
> +
> +const char *hv_result_to_string(u64 hv_status)
> +{
> +	switch (hv_result(hv_status)) {
> +	case HV_STATUS_SUCCESS:
> +		return "HV_STATUS_SUCCESS";
> +	case HV_STATUS_INVALID_HYPERCALL_CODE:
> +		return "HV_STATUS_INVALID_HYPERCALL_CODE";
> +	case HV_STATUS_INVALID_HYPERCALL_INPUT:
> +		return "HV_STATUS_INVALID_HYPERCALL_INPUT";
> +	case HV_STATUS_INVALID_ALIGNMENT:
> +		return "HV_STATUS_INVALID_ALIGNMENT";
> +	case HV_STATUS_INVALID_PARAMETER:
> +		return "HV_STATUS_INVALID_PARAMETER";
> +	case HV_STATUS_ACCESS_DENIED:
> +		return "HV_STATUS_ACCESS_DENIED";
> +	case HV_STATUS_INVALID_PARTITION_STATE:
> +		return "HV_STATUS_INVALID_PARTITION_STATE";
> +	case HV_STATUS_OPERATION_DENIED:
> +		return "HV_STATUS_OPERATION_DENIED";
> +	case HV_STATUS_UNKNOWN_PROPERTY:
> +		return "HV_STATUS_UNKNOWN_PROPERTY";
> +	case HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE:
> +		return "HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE";
> +	case HV_STATUS_INSUFFICIENT_MEMORY:
> +		return "HV_STATUS_INSUFFICIENT_MEMORY";
> +	case HV_STATUS_INVALID_PARTITION_ID:
> +		return "HV_STATUS_INVALID_PARTITION_ID";
> +	case HV_STATUS_INVALID_VP_INDEX:
> +		return "HV_STATUS_INVALID_VP_INDEX";
> +	case HV_STATUS_NOT_FOUND:
> +		return "HV_STATUS_NOT_FOUND";
> +	case HV_STATUS_INVALID_PORT_ID:
> +		return "HV_STATUS_INVALID_PORT_ID";
> +	case HV_STATUS_INVALID_CONNECTION_ID:
> +		return "HV_STATUS_INVALID_CONNECTION_ID";
> +	case HV_STATUS_INSUFFICIENT_BUFFERS:
> +		return "HV_STATUS_INSUFFICIENT_BUFFERS";
> +	case HV_STATUS_NOT_ACKNOWLEDGED:
> +		return "HV_STATUS_NOT_ACKNOWLEDGED";
> +	case HV_STATUS_INVALID_VP_STATE:
> +		return "HV_STATUS_INVALID_VP_STATE";
> +	case HV_STATUS_NO_RESOURCES:
> +		return "HV_STATUS_NO_RESOURCES";
> +	case HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED:
> +		return "HV_STATUS_PROCESSOR_FEATURE_NOT_SUPPORTED";
> +	case HV_STATUS_INVALID_LP_INDEX:
> +		return "HV_STATUS_INVALID_LP_INDEX";
> +	case HV_STATUS_INVALID_REGISTER_VALUE:
> +		return "HV_STATUS_INVALID_REGISTER_VALUE";
> +	case HV_STATUS_OPERATION_FAILED:
> +		return "HV_STATUS_OPERATION_FAILED";
> +	case HV_STATUS_TIME_OUT:
> +		return "HV_STATUS_TIME_OUT";
> +	case HV_STATUS_CALL_PENDING:
> +		return "HV_STATUS_CALL_PENDING";
> +	case HV_STATUS_VTL_ALREADY_ENABLED:
> +		return "HV_STATUS_VTL_ALREADY_ENABLED";
> +	default:
> +		return "Unknown";
> +	};
> +	return "Unknown";

Unnecessary extra return since the default case already returns "Unknown"

> +}
> +EXPORT_SYMBOL_GPL(hv_result_to_string);
> +

Extra line here ^

> diff --git a/drivers/hv/hv_proc.c b/drivers/hv/hv_proc.c
> index 2fae18e4f7d2..8fc30f509fa7 100644
> --- a/drivers/hv/hv_proc.c
> +++ b/drivers/hv/hv_proc.c
> @@ -87,7 +87,8 @@ int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages)
>  				     page_count, 0, input_page, NULL);
>  	local_irq_restore(flags);
>  	if (!hv_result_success(status)) {
> -		pr_err("Failed to deposit pages: %lld\n", status);
> +		pr_err("%s: Failed to deposit pages: %s\n", __func__,
> +		       hv_result_to_string(status));
>  		ret = hv_result_to_errno(status);
>  		goto err_free_allocations;
>  	}
> @@ -137,8 +138,9 @@ int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id)
>  
>  		if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) {
>  			if (!hv_result_success(status)) {
> -				pr_err("%s: cpu %u apic ID %u, %lld\n", __func__,
> -				       lp_index, apic_id, status);
> +				pr_err("%s: cpu %u apic ID %u, %s\n",
> +				       __func__, lp_index, apic_id,
> +				       hv_result_to_string(status));
>  				ret = hv_result_to_errno(status);
>  			}
>  			break;
> @@ -179,8 +181,9 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags)
>  
>  		if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) {
>  			if (!hv_result_success(status)) {
> -				pr_err("%s: vcpu %u, lp %u, %lld\n", __func__,
> -				       vp_index, flags, status);
> +				pr_err("%s: vcpu %u, lp %u, %s\n",
> +				       __func__, vp_index, flags,
> +				       hv_result_to_string(status));
>  				ret = hv_result_to_errno(status);
>  			}
>  			break;

There are more convertible instances in arch/x86/hyperv/irqdomain.c and drivers/iommu/hyperv-iommu.c

> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index b13b0cda4ac8..dc4729dba9ef 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -298,6 +298,7 @@ static inline int cpumask_to_vpset_skip(struct hv_vpset *vpset,
>  	return __cpumask_to_vpset(vpset, cpus, func);
>  }
>  
> +const char *hv_result_to_string(u64 hv_status);
>  int hv_result_to_errno(u64 status);
>  void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
>  bool hv_is_hyperv_initialized(void);


  parent reply	other threads:[~2025-02-27  4:22 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 23:07 [PATCH v5 00/10] Introduce /dev/mshv root partition driver Nuno Das Neves
2025-02-26 23:07 ` [PATCH v5 01/10] hyperv: Convert Hyper-V status codes to strings Nuno Das Neves
2025-02-26 23:26   ` Stanislav Kinsburskii
2025-02-27  4:22   ` Easwar Hariharan [this message]
2025-02-27 23:48     ` Nuno Das Neves
2025-02-27 17:02   ` Roman Kisel
2025-02-27 22:54     ` Easwar Hariharan
2025-02-27 23:08       ` Roman Kisel
2025-02-27 23:25         ` Easwar Hariharan
2025-02-28 17:20           ` Roman Kisel
2025-02-28 20:22             ` Easwar Hariharan
2025-02-28 22:26               ` Roman Kisel
2025-02-27 23:21       ` Roman Kisel
2025-02-28  0:15     ` Nuno Das Neves
2025-02-28 16:40       ` Roman Kisel
2025-03-06 17:57   ` Michael Kelley
2025-03-06 18:09     ` Michael Kelley
2025-03-06 18:40       ` Nuno Das Neves
2025-03-06 18:57         ` Michael Kelley
2025-03-07 19:38     ` Nuno Das Neves
2025-02-26 23:07 ` [PATCH v5 02/10] x86/mshyperv: Add support for extended Hyper-V features Nuno Das Neves
2025-02-26 23:27   ` Stanislav Kinsburskii
2025-02-27 17:59   ` Roman Kisel
2025-02-28  0:17     ` Nuno Das Neves
2025-02-28 16:42       ` Roman Kisel
2025-02-27 18:17   ` Easwar Hariharan
2025-03-06 18:30   ` Michael Kelley
2025-03-12 18:04     ` Nuno Das Neves
2025-03-10 13:17   ` Tianyu Lan
2025-02-26 23:07 ` [PATCH v5 03/10] arm64/hyperv: Add some missing functions to arm64 Nuno Das Neves
2025-02-26 23:27   ` Stanislav Kinsburskii
2025-02-27  5:56   ` Easwar Hariharan
2025-02-28  0:21     ` Nuno Das Neves
2025-03-06 19:05       ` Michael Kelley
2025-03-07 21:36         ` Nuno Das Neves
2025-03-07 21:55           ` Easwar Hariharan
2025-02-27 18:09   ` Roman Kisel
2025-02-26 23:07 ` [PATCH v5 04/10] hyperv: Introduce hv_recommend_using_aeoi() Nuno Das Neves
2025-02-26 23:28   ` Stanislav Kinsburskii
2025-02-27 18:04   ` Roman Kisel
2025-02-28  0:21     ` Nuno Das Neves
2025-02-27 23:03   ` Easwar Hariharan
2025-02-28  0:33     ` Nuno Das Neves
2025-02-28  0:49       ` Easwar Hariharan
2025-03-06 19:12   ` Michael Kelley
2025-03-10 12:51   ` Tianyu Lan
2025-02-26 23:07 ` [PATCH v5 05/10] acpi: numa: Export node_to_pxm() Nuno Das Neves
2025-02-26 23:31   ` Stanislav Kinsburskii
2025-02-27 23:05   ` Easwar Hariharan
2025-03-06 19:16   ` Michael Kelley
2025-03-10 12:50   ` Tianyu Lan
2025-02-26 23:08 ` [PATCH v5 06/10] Drivers/hv: Export some functions for use by root partition module Nuno Das Neves
2025-02-26 23:32   ` Stanislav Kinsburskii
2025-02-27 18:11   ` Roman Kisel
2025-02-28  0:51   ` Easwar Hariharan
2025-03-06 19:23   ` Michael Kelley
2025-03-07 21:38     ` Nuno Das Neves
2025-02-26 23:08 ` [PATCH v5 07/10] Drivers: hv: Introduce per-cpu event ring tail Nuno Das Neves
2025-02-26 23:39   ` Stanislav Kinsburskii
2025-03-07 17:02   ` Michael Kelley
2025-03-07 22:06     ` Nuno Das Neves
2025-03-07 23:21       ` Michael Kelley
2025-03-07 23:31         ` Nuno Das Neves
2025-03-07 23:37         ` Michael Kelley
2025-03-10 13:01   ` Tianyu Lan
2025-03-12 19:44     ` Nuno Das Neves
2025-03-13  7:34       ` Tianyu Lan
2025-03-13 15:56         ` Nuno Das Neves
2025-03-13 16:00           ` Tianyu Lan
2025-02-26 23:08 ` [PATCH v5 08/10] x86: hyperv: Add mshv_handler irq handler and setup function Nuno Das Neves
2025-02-26 23:43   ` Stanislav Kinsburskii
2025-03-01  0:38     ` Nuno Das Neves
2025-03-07 17:38       ` Michael Kelley
2025-03-10 21:46         ` Nuno Das Neves
2025-03-10 22:23           ` Michael Kelley
2025-03-07 17:44   ` Michael Kelley
2025-03-07 23:29     ` Nuno Das Neves
2025-03-07 23:45       ` Michael Kelley
2025-02-26 23:08 ` [PATCH v5 09/10] hyperv: Add definitions for root partition driver to hv headers Nuno Das Neves
2025-02-26 23:51   ` Stanislav Kinsburskii
2025-03-01  0:46     ` Nuno Das Neves
2025-02-27 18:13   ` Roman Kisel
2025-02-28  1:27   ` Easwar Hariharan
2025-03-01  0:52     ` Nuno Das Neves
2025-03-07 17:26   ` Michael Kelley
2025-03-07 23:35     ` Nuno Das Neves
2025-03-10 12:40   ` Tianyu Lan
2025-03-12 20:17     ` Nuno Das Neves
2025-02-26 23:08 ` [PATCH v5 10/10] Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs Nuno Das Neves
2025-02-27  4:59   ` Easwar Hariharan
2025-03-01  1:29     ` Nuno Das Neves
2025-02-27 18:50   ` Roman Kisel
2025-03-01  1:38     ` Nuno Das Neves
2025-03-06 17:32     ` Wei Liu
2025-03-07 18:06       ` Roman Kisel
2025-03-11 18:01   ` Jeff Johnson
2025-03-14 19:25     ` Nuno Das Neves
2025-03-13 16:43   ` Michael Kelley
2025-03-14  2:15     ` Nuno Das Neves
2025-03-14  3:27       ` Michael Kelley
2025-03-17 23:51   ` Michael Kelley
2025-03-18 17:24     ` Wei Liu
2025-03-18 17:45       ` Michael Kelley
2025-03-18 20:07         ` Wei Liu
2025-03-19  0:34     ` Nuno Das Neves
2025-03-19  2:10       ` Michael Kelley
2025-03-19 15:26         ` Michael Kelley
2025-03-19 18:04           ` Nuno Das Neves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2889fab1-4836-4a66-aa63-b63d8cc70a69@linux.microsoft.com \
    --to=eahariha@linux.microsoft.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=anrayabh@linux.microsoft.com \
    --cc=apais@linux.microsoft.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jinankjain@linux.microsoft.com \
    --cc=joro@8bytes.org \
    --cc=kys@microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=mrathor@linux.microsoft.com \
    --cc=muislam@microsoft.com \
    --cc=muminulrussell@gmail.com \
    --cc=nunodasneves@linux.microsoft.com \
    --cc=prapal@linux.microsoft.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=stanislav.kinsburskiy@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).