Thread (2 messages) read the whole thread 2 messages, 2 authors, 2021-03-05

RE: [PATCH v8 4/6] arm64: hyperv: Initialize hypervisor on boot

From: Michael Kelley <hidden>
Date: 2021-03-05 21:04:06
Also in: linux-arm-kernel, linux-efi, lkml

From: Sunil Muthuswamy <redacted> Sent: Wednesday, March 3, 2021 12:21 PM
quoted
+static u64 hypercall_output __initdata;
+
+static int __init hyperv_init(void)
+{
+	struct hv_get_vpindex_from_apicid_input *input;
+	u64	status;
+	int	i;
nit: both, tabs & spaces are being used to indent variable names. Can we stick
to one?
Agreed.  Will make this consistent in the next version.
quoted
+
+	/*
+	 * Hypercall inputs must not cross a page boundary, so allocate
+	 * power of 2 size, which will be aligned to that size.
+	 */
+	input = kzalloc(roundup_pow_of_two(sizeof(input->header) +
+				sizeof(input->element[0])), GFP_KERNEL);
+	if (!input)
+		return -ENOMEM;
Similar to the comment on the other patch, can this be done through a
per-cpu hypercall input page?
Per comments on other previous patch, these allocations can be eliminated
and the problem avoided entirely.
quoted
+		if ((status & HV_HYPERCALL_RESULT_MASK) == HV_STATUS_SUCCESS)
+			hv_vp_index[i] = hypercall_output;
+		else {
CNF suggests using braces even for single line 'if' statements if the 'else' is a multi-line
statement
Will do.
quoted
+			pr_warn("Hyper-V: No VP index for CPU %d MPIDR %llx status
%llx\n",
quoted
+				i, cpu_logical_map(i), status);
+			hv_vp_index[i] = VP_INVAL;
+		}
quoted
+bool hv_is_hyperv_initialized(void)
+{
+	return hyperv_initialized;
+}
+EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized);
This to me seems like more of an indication that whether the hypervisor is Hyper-V or
something else, rather than if necessary Hyper-V pieces have been initialized. If that is
the case, suggest renaming. Maybe just call it 'hv_is_hyperv'?
This function also exists on the x86/x64 side and is used in architecture independent
code.  It's meaning is somewhere between "is Hyper-V" and "is Hyper-V initialized".
I'm not sure there's much value in changing the name everywhere.

Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help