Skip to contentSkip to conversation

arch/x86: Provide the CPU number in the wakeup AP callback

PATCH Applied Roman Kisel 7 participants 14 messages Apr 30, 2025 – May 7, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 arch/x86: Provide the CPU number in the wakeup AP callback

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

---
The diff in ivm.c might catch your eye but that code mixes up the APIC ID and the CPU number anyway. That is fixed in another patch:
https://lore.kernel.org/linux-hyperv/[email protected]/
independently of this one (being an optimization).
I separated the two as this one might be more disputatious due to the change in the API (although it is a tiny one and comes with the benefits).

[V3]
- Fixed the cpu nummber to be unsigned int within the patch and in the do_boot_cpu() function.
** Thank you, Thomas! **

[V2]
https://lore.kernel.org/linux-hyperv/[email protected]/
- Remove the struct used in v1 in favor of passing the CPU number directly to the callback not to increase complexity.
** Thank you, Michael! **
[V1]

	https://lore.kernel.org/linux-hyperv/[email protected]/
---
 arch/x86/coco/sev/core.c           | 13 ++-----------
 arch/x86/hyperv/hv_vtl.c           | 12 ++----------
 arch/x86/hyperv/ivm.c              |  2 +-
 arch/x86/include/asm/apic.h        |  8 ++++----
 arch/x86/include/asm/mshyperv.h    |  5 +++--
 arch/x86/kernel/acpi/madt_wakeup.c |  2 +-
 arch/x86/kernel/apic/apic_noop.c   |  8 +++++++-
 arch/x86/kernel/apic/x2apic_uv_x.c |  2 +-
 arch/x86/kernel/smpboot.c          | 10 +++++-----
 9 files changed, 26 insertions(+), 36 deletions(-)
arch/x86/coco/sev/core.c +2 -11
index 82492efc5d94..8b6d310b61b9 100644
@@ -1179,7 +1179,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa, int apic_id)
 		free_page((unsigned long)vmsa);
 }
 
-static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
+static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *cur_vmsa, *vmsa;
 	struct ghcb_state state;
@@ -1187,7 +1187,7 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 	unsigned long flags;
 	struct ghcb *ghcb;
 	u8 sipi_vector;
-	int cpu, ret;
+	int ret;
 	u64 cr4;
 
 	/*
@@ -1208,15 +1208,6 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 
 	/* Override start_ip with known protected guest start IP */
 	start_ip = real_mode_header->sev_es_trampoline_start;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apic_id))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
-
 	cur_vmsa = per_cpu(sev_vmsa, cpu);
 
 	/*
arch/x86/hyperv/hv_vtl.c +2 -10
index 582fe820e29c..4d6e0e198041 100644
@@ -237,17 +237,9 @@ static int hv_vtl_apicid_to_vp_id(u32 apic_id)
 	return ret;
 }
 
-static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip)
+static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip, unsigned int cpu)
 {
-	int vp_id, cpu;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apicid))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
+	int vp_id;
 
 	pr_debug("Bringing up CPU with APIC ID %d in VTL2...\n", apicid);
 	vp_id = hv_vtl_apicid_to_vp_id(apicid);
arch/x86/hyperv/ivm.c +1 -1
index c0039a90e9e0..6025da891a83 100644
@@ -288,7 +288,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa)
 		free_page((unsigned long)vmsa);
 }
 
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *vmsa = (struct sev_es_save_area *)
 		__get_free_page(GFP_KERNEL | __GFP_ZERO);
arch/x86/include/asm/apic.h +4 -4
index f21ff1932699..33f677e2db75 100644
@@ -313,9 +313,9 @@ struct apic {
 	u32	(*get_apic_id)(u32 id);
 
 	/* wakeup_secondary_cpu */
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 	/* wakeup secondary CPU using 64-bit wakeup point */
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 
 	char	*name;
 };
@@ -333,8 +333,8 @@ struct apic_override {
 	void	(*send_IPI_self)(int vector);
 	u64	(*icr_read)(void);
 	void	(*icr_write)(u32 low, u32 high);
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 };
 
 /*
arch/x86/include/asm/mshyperv.h +3 -2
index 07aadf0e839f..cab952f722e4 100644
@@ -268,11 +268,12 @@ int hv_unmap_ioapic_interrupt(int ioapic_id, struct hv_interrupt_entry *entry);
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 bool hv_ghcb_negotiate_protocol(void);
 void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason);
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip);
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu);
 #else
 static inline bool hv_ghcb_negotiate_protocol(void) { return false; }
 static inline void hv_ghcb_terminate(unsigned int set, unsigned int reason) {}
-static inline int hv_snp_boot_ap(u32 cpu, unsigned long start_ip) { return 0; }
+static inline int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip,
+		unsigned int cpu) { return 0; }
 #endif
 
 #if defined(CONFIG_AMD_MEM_ENCRYPT) || defined(CONFIG_INTEL_TDX_GUEST)
arch/x86/kernel/acpi/madt_wakeup.c +1 -1
index d5ef6215583b..f48581888d53 100644
@@ -169,7 +169,7 @@ static int __init acpi_mp_setup_reset(u64 reset_vector)
 	return 0;
 }
 
-static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip)
+static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip, unsigned int cpu)
 {
 	if (!acpi_mp_wake_mailbox_paddr) {
 		pr_warn_once("No MADT mailbox: cannot bringup secondary CPUs. Booting with kexec?\n");
arch/x86/kernel/apic/apic_noop.c +7 -1
index b5bb7a2e8340..58abb941c45b 100644
@@ -27,7 +27,13 @@ static void noop_send_IPI_allbutself(int vector) { }
 static void noop_send_IPI_all(int vector) { }
 static void noop_send_IPI_self(int vector) { }
 static void noop_apic_icr_write(u32 low, u32 id) { }
-static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip) { return -1; }
+
+static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip,
+	unsigned int cpu)
+{
+	return -1;
+}
+
 static u64 noop_apic_icr_read(void) { return 0; }
 static u32 noop_get_apic_id(u32 apicid) { return 0; }
 static void noop_apic_eoi(void) { }
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
index 7fef504ca508..15209f220e1f 100644
@@ -667,7 +667,7 @@ static __init void build_uv_gr_table(void)
 	}
 }
 
-static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip)
+static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip, unsigned int cpu)
 {
 	unsigned long val;
 	int pnode;
arch/x86/kernel/smpboot.c +5 -5
index c10850ae6f09..b013296b100f 100644
@@ -715,7 +715,7 @@ static void send_init_sequence(u32 phys_apicid)
 /*
  * Wake up AP by INIT, INIT, STARTUP sequence.
  */
-static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip)
+static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip, unsigned int cpu)
 {
 	unsigned long send_status = 0, accept_status = 0;
 	int num_starts, j, maxlvt;
@@ -862,7 +862,7 @@ int common_cpu_up(unsigned int cpu, struct task_struct *idle)
  * Returns zero if startup was successfully sent, else error code from
  * ->wakeup_secondary_cpu.
  */
-static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
+static int do_boot_cpu(u32 apicid, unsigned int cpu, struct task_struct *idle)
 {
 	unsigned long start_ip = real_mode_header->trampoline_start;
 	int ret;
@@ -916,11 +916,11 @@ static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
 	 * - Use an INIT boot APIC message
 	 */
 	if (apic->wakeup_secondary_cpu_64)
-		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip, cpu);
 	else if (apic->wakeup_secondary_cpu)
-		ret = apic->wakeup_secondary_cpu(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu(apicid, start_ip, cpu);
 	else
-		ret = wakeup_secondary_cpu_via_init(apicid, start_ip);
+		ret = wakeup_secondary_cpu_via_init(apicid, start_ip, cpu);
 
 	/* If the wakeup mechanism failed, cleanup the warm reset vector */
 	if (ret)

base-commit: 628cc040b3a2980df6032766e8ef0688e981ab95

Signature · 1 line
2.43.0
Reviewed-by on v3 1/1
#1 lore raw

From: Roman Kisel <[email protected]> Sent: Wednesday, April 30, 2025 1:47 PM

Quoted 6 lines

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Quoted 6 lines

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

LGTM.

Quoted 244 lines

---
The diff in ivm.c might catch your eye but that code mixes up the APIC ID and the CPU number anyway. That is fixed in another patch:
https://lore.kernel.org/linux-hyperv/[email protected]/
independently of this one (being an optimization).
I separated the two as this one might be more disputatious due to the change in the API (although it is a tiny one and comes with the benefits).

[V3]
- Fixed the cpu nummber to be unsigned int within the patch and in the do_boot_cpu() function.
** Thank you, Thomas! **

[V2]
https://lore.kernel.org/linux-hyperv/[email protected]/
- Remove the struct used in v1 in favor of passing the CPU number directly to the callback not to increase complexity.
** Thank you, Michael! **
[V1]

	https://lore.kernel.org/linux-hyperv/[email protected]/
---
 arch/x86/coco/sev/core.c           | 13 ++-----------
 arch/x86/hyperv/hv_vtl.c           | 12 ++----------
 arch/x86/hyperv/ivm.c              |  2 +-
 arch/x86/include/asm/apic.h        |  8 ++++----
 arch/x86/include/asm/mshyperv.h    |  5 +++--
 arch/x86/kernel/acpi/madt_wakeup.c |  2 +-
 arch/x86/kernel/apic/apic_noop.c   |  8 +++++++-
 arch/x86/kernel/apic/x2apic_uv_x.c |  2 +-
 arch/x86/kernel/smpboot.c          | 10 +++++-----
 9 files changed, 26 insertions(+), 36 deletions(-)
arch/x86/coco/sev/core.c +2 -11
index 82492efc5d94..8b6d310b61b9 100644
@@ -1179,7 +1179,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa, int apic_id)
 		free_page((unsigned long)vmsa);
 }
 
-static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
+static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *cur_vmsa, *vmsa;
 	struct ghcb_state state;
@@ -1187,7 +1187,7 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 	unsigned long flags;
 	struct ghcb *ghcb;
 	u8 sipi_vector;
-	int cpu, ret;
+	int ret;
 	u64 cr4;
 
 	/*
@@ -1208,15 +1208,6 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 
 	/* Override start_ip with known protected guest start IP */
 	start_ip = real_mode_header->sev_es_trampoline_start;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apic_id))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
-
 	cur_vmsa = per_cpu(sev_vmsa, cpu);
 
 	/*
arch/x86/hyperv/hv_vtl.c +2 -10
index 582fe820e29c..4d6e0e198041 100644
@@ -237,17 +237,9 @@ static int hv_vtl_apicid_to_vp_id(u32 apic_id)
 	return ret;
 }
 
-static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip)
+static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip, unsigned int cpu)
 {
-	int vp_id, cpu;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apicid))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
+	int vp_id;
 
 	pr_debug("Bringing up CPU with APIC ID %d in VTL2...\n", apicid);
 	vp_id = hv_vtl_apicid_to_vp_id(apicid);
arch/x86/hyperv/ivm.c +1 -1
index c0039a90e9e0..6025da891a83 100644
@@ -288,7 +288,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa)
 		free_page((unsigned long)vmsa);
 }
 
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *vmsa = (struct sev_es_save_area *)
 		__get_free_page(GFP_KERNEL | __GFP_ZERO);
arch/x86/include/asm/apic.h +4 -4
index f21ff1932699..33f677e2db75 100644
@@ -313,9 +313,9 @@ struct apic {
 	u32	(*get_apic_id)(u32 id);
 
 	/* wakeup_secondary_cpu */
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 	/* wakeup secondary CPU using 64-bit wakeup point */
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 
 	char	*name;
 };
@@ -333,8 +333,8 @@ struct apic_override {
 	void	(*send_IPI_self)(int vector);
 	u64	(*icr_read)(void);
 	void	(*icr_write)(u32 low, u32 high);
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 };
 
 /*
arch/x86/include/asm/mshyperv.h +3 -2
index 07aadf0e839f..cab952f722e4 100644
@@ -268,11 +268,12 @@ int hv_unmap_ioapic_interrupt(int ioapic_id, struct
 hv_interrupt_entry *entry);
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 bool hv_ghcb_negotiate_protocol(void);
 void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason);
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip);
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu);
 #else
 static inline bool hv_ghcb_negotiate_protocol(void) { return false; }
 static inline void hv_ghcb_terminate(unsigned int set, unsigned int reason) {}
-static inline int hv_snp_boot_ap(u32 cpu, unsigned long start_ip) { return 0; }
+static inline int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip,
+		unsigned int cpu) { return 0; }
 #endif
 

#if defined(CONFIG_AMD_MEM_ENCRYPT) || defined(CONFIG_INTEL_TDX_GUEST)

arch/x86/kernel/acpi/madt_wakeup.c +1 -1
index d5ef6215583b..f48581888d53 100644
@@ -169,7 +169,7 @@ static int __init acpi_mp_setup_reset(u64 reset_vector)
 	return 0;
 }
 
-static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip)
+static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip, unsigned int cpu)
 {
 	if (!acpi_mp_wake_mailbox_paddr) {
 		pr_warn_once("No MADT mailbox: cannot bringup secondary CPUs.

Booting with kexec?\n");

arch/x86/kernel/apic/apic_noop.c +7 -1
index b5bb7a2e8340..58abb941c45b 100644
@@ -27,7 +27,13 @@ static void noop_send_IPI_allbutself(int vector) { }
 static void noop_send_IPI_all(int vector) { }
 static void noop_send_IPI_self(int vector) { }
 static void noop_apic_icr_write(u32 low, u32 id) { }
-static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip) { return -1; }
+
+static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip,
+	unsigned int cpu)
+{
+	return -1;
+}
+
 static u64 noop_apic_icr_read(void) { return 0; }
 static u32 noop_get_apic_id(u32 apicid) { return 0; }
 static void noop_apic_eoi(void) { }
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
index 7fef504ca508..15209f220e1f 100644
@@ -667,7 +667,7 @@ static __init void build_uv_gr_table(void)
 	}
 }
 
-static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip)
+static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip, unsigned int cpu)
 {
 	unsigned long val;
 	int pnode;
arch/x86/kernel/smpboot.c +5 -5
index c10850ae6f09..b013296b100f 100644
@@ -715,7 +715,7 @@ static void send_init_sequence(u32 phys_apicid)
 /*
  * Wake up AP by INIT, INIT, STARTUP sequence.
  */
-static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip)
+static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip, unsigned int cpu)
 {
 	unsigned long send_status = 0, accept_status = 0;
 	int num_starts, j, maxlvt;
@@ -862,7 +862,7 @@ int common_cpu_up(unsigned int cpu, struct task_struct *idle)
  * Returns zero if startup was successfully sent, else error code from
  * ->wakeup_secondary_cpu.
  */
-static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
+static int do_boot_cpu(u32 apicid, unsigned int cpu, struct task_struct *idle)
 {
 	unsigned long start_ip = real_mode_header->trampoline_start;
 	int ret;
@@ -916,11 +916,11 @@ static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
 	 * - Use an INIT boot APIC message
 	 */
 	if (apic->wakeup_secondary_cpu_64)
-		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip, cpu);
 	else if (apic->wakeup_secondary_cpu)
-		ret = apic->wakeup_secondary_cpu(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu(apicid, start_ip, cpu);
 	else
-		ret = wakeup_secondary_cpu_via_init(apicid, start_ip);
+		ret = wakeup_secondary_cpu_via_init(apicid, start_ip, cpu);
 
 	/* If the wakeup mechanism failed, cleanup the warm reset vector */
 	if (ret)

base-commit: 628cc040b3a2980df6032766e8ef0688e981ab95 --
2.43.0

Reviewed-by on v3 1/1
#2 lore raw
In reply to Roman Kisel
Quoted 11 lines · Roman Kisel

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

maintainer
#3 lore raw
In reply to Roman Kisel
Quoted 31 lines · Roman Kisel

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

---
The diff in ivm.c might catch your eye but that code mixes up the APIC ID and the CPU number anyway. That is fixed in another patch:
https://lore.kernel.org/linux-hyperv/[email protected]/
independently of this one (being an optimization).
I separated the two as this one might be more disputatious due to the change in the API (although it is a tiny one and comes with the benefits).

[V3]
- Fixed the cpu nummber to be unsigned int within the patch and in the do_boot_cpu() function.
** Thank you, Thomas! **

[V2]
https://lore.kernel.org/linux-hyperv/[email protected]/
- Remove the struct used in v1 in favor of passing the CPU number directly to the callback not to increase complexity.
** Thank you, Michael! **
[V1]

Quoted 11 lines
	https://lore.kernel.org/linux-hyperv/[email protected]/
---
 arch/x86/coco/sev/core.c           | 13 ++-----------
 arch/x86/hyperv/hv_vtl.c           | 12 ++----------
 arch/x86/hyperv/ivm.c              |  2 +-
 arch/x86/include/asm/apic.h        |  8 ++++----
 arch/x86/include/asm/mshyperv.h    |  5 +++--
 arch/x86/kernel/acpi/madt_wakeup.c |  2 +-
 arch/x86/kernel/apic/apic_noop.c   |  8 +++++++-
 arch/x86/kernel/apic/x2apic_uv_x.c |  2 +-
 arch/x86/kernel/smpboot.c          | 10 +++++-----

Since this is tagged as a hyperv-next patch, I'm happy to pick this up.

Some changes should be acked by x86 maintainers.

Thanks,
Wei.

Quoted 210 lines
 9 files changed, 26 insertions(+), 36 deletions(-)
arch/x86/coco/sev/core.c +2 -11
index 82492efc5d94..8b6d310b61b9 100644
@@ -1179,7 +1179,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa, int apic_id)
 		free_page((unsigned long)vmsa);
 }
 
-static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
+static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *cur_vmsa, *vmsa;
 	struct ghcb_state state;
@@ -1187,7 +1187,7 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 	unsigned long flags;
 	struct ghcb *ghcb;
 	u8 sipi_vector;
-	int cpu, ret;
+	int ret;
 	u64 cr4;
 
 	/*
@@ -1208,15 +1208,6 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
 
 	/* Override start_ip with known protected guest start IP */
 	start_ip = real_mode_header->sev_es_trampoline_start;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apic_id))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
-
 	cur_vmsa = per_cpu(sev_vmsa, cpu);
 
 	/*
arch/x86/hyperv/hv_vtl.c +2 -10
index 582fe820e29c..4d6e0e198041 100644
@@ -237,17 +237,9 @@ static int hv_vtl_apicid_to_vp_id(u32 apic_id)
 	return ret;
 }
 
-static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip)
+static int hv_vtl_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip, unsigned int cpu)
 {
-	int vp_id, cpu;
-
-	/* Find the logical CPU for the APIC ID */
-	for_each_present_cpu(cpu) {
-		if (arch_match_cpu_phys_id(cpu, apicid))
-			break;
-	}
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
+	int vp_id;
 
 	pr_debug("Bringing up CPU with APIC ID %d in VTL2...\n", apicid);
 	vp_id = hv_vtl_apicid_to_vp_id(apicid);
arch/x86/hyperv/ivm.c +1 -1
index c0039a90e9e0..6025da891a83 100644
@@ -288,7 +288,7 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa)
 		free_page((unsigned long)vmsa);
 }
 
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu)
 {
 	struct sev_es_save_area *vmsa = (struct sev_es_save_area *)
 		__get_free_page(GFP_KERNEL | __GFP_ZERO);
arch/x86/include/asm/apic.h +4 -4
index f21ff1932699..33f677e2db75 100644
@@ -313,9 +313,9 @@ struct apic {
 	u32	(*get_apic_id)(u32 id);
 
 	/* wakeup_secondary_cpu */
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 	/* wakeup secondary CPU using 64-bit wakeup point */
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 
 	char	*name;
 };
@@ -333,8 +333,8 @@ struct apic_override {
 	void	(*send_IPI_self)(int vector);
 	u64	(*icr_read)(void);
 	void	(*icr_write)(u32 low, u32 high);
-	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip);
-	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip);
+	int	(*wakeup_secondary_cpu)(u32 apicid, unsigned long start_eip, unsigned int cpu);
+	int	(*wakeup_secondary_cpu_64)(u32 apicid, unsigned long start_eip, unsigned int cpu);
 };
 
 /*
arch/x86/include/asm/mshyperv.h +3 -2
index 07aadf0e839f..cab952f722e4 100644
@@ -268,11 +268,12 @@ int hv_unmap_ioapic_interrupt(int ioapic_id, struct hv_interrupt_entry *entry);
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 bool hv_ghcb_negotiate_protocol(void);
 void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason);
-int hv_snp_boot_ap(u32 cpu, unsigned long start_ip);
+int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu);
 #else
 static inline bool hv_ghcb_negotiate_protocol(void) { return false; }
 static inline void hv_ghcb_terminate(unsigned int set, unsigned int reason) {}
-static inline int hv_snp_boot_ap(u32 cpu, unsigned long start_ip) { return 0; }
+static inline int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip,
+		unsigned int cpu) { return 0; }
 #endif
 
 #if defined(CONFIG_AMD_MEM_ENCRYPT) || defined(CONFIG_INTEL_TDX_GUEST)
arch/x86/kernel/acpi/madt_wakeup.c +1 -1
index d5ef6215583b..f48581888d53 100644
@@ -169,7 +169,7 @@ static int __init acpi_mp_setup_reset(u64 reset_vector)
 	return 0;
 }
 
-static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip)
+static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip, unsigned int cpu)
 {
 	if (!acpi_mp_wake_mailbox_paddr) {
 		pr_warn_once("No MADT mailbox: cannot bringup secondary CPUs. Booting with kexec?\n");
arch/x86/kernel/apic/apic_noop.c +7 -1
index b5bb7a2e8340..58abb941c45b 100644
@@ -27,7 +27,13 @@ static void noop_send_IPI_allbutself(int vector) { }
 static void noop_send_IPI_all(int vector) { }
 static void noop_send_IPI_self(int vector) { }
 static void noop_apic_icr_write(u32 low, u32 id) { }
-static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip) { return -1; }
+
+static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip,
+	unsigned int cpu)
+{
+	return -1;
+}
+
 static u64 noop_apic_icr_read(void) { return 0; }
 static u32 noop_get_apic_id(u32 apicid) { return 0; }
 static void noop_apic_eoi(void) { }
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
index 7fef504ca508..15209f220e1f 100644
@@ -667,7 +667,7 @@ static __init void build_uv_gr_table(void)
 	}
 }
 
-static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip)
+static int uv_wakeup_secondary(u32 phys_apicid, unsigned long start_rip, unsigned int cpu)
 {
 	unsigned long val;
 	int pnode;
arch/x86/kernel/smpboot.c +5 -5
index c10850ae6f09..b013296b100f 100644
@@ -715,7 +715,7 @@ static void send_init_sequence(u32 phys_apicid)
 /*
  * Wake up AP by INIT, INIT, STARTUP sequence.
  */
-static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip)
+static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip, unsigned int cpu)
 {
 	unsigned long send_status = 0, accept_status = 0;
 	int num_starts, j, maxlvt;
@@ -862,7 +862,7 @@ int common_cpu_up(unsigned int cpu, struct task_struct *idle)
  * Returns zero if startup was successfully sent, else error code from
  * ->wakeup_secondary_cpu.
  */
-static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
+static int do_boot_cpu(u32 apicid, unsigned int cpu, struct task_struct *idle)
 {
 	unsigned long start_ip = real_mode_header->trampoline_start;
 	int ret;
@@ -916,11 +916,11 @@ static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle)
 	 * - Use an INIT boot APIC message
 	 */
 	if (apic->wakeup_secondary_cpu_64)
-		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu_64(apicid, start_ip, cpu);
 	else if (apic->wakeup_secondary_cpu)
-		ret = apic->wakeup_secondary_cpu(apicid, start_ip);
+		ret = apic->wakeup_secondary_cpu(apicid, start_ip, cpu);
 	else
-		ret = wakeup_secondary_cpu_via_init(apicid, start_ip);
+		ret = wakeup_secondary_cpu_via_init(apicid, start_ip, cpu);
 
 	/* If the wakeup mechanism failed, cleanup the warm reset vector */
 	if (ret)

base-commit: 628cc040b3a2980df6032766e8ef0688e981ab95

Signature · 1 line
2.43.0
#4 lore raw
Quoted 1 line · Wei Liu

On Wed, Apr 30, 2025 at 01:47:20PM -0700, Roman Kisel wrote:

[...]

Quoted 10 lines
Quoted 9 lines
  arch/x86/coco/sev/core.c           | 13 ++-----------
  arch/x86/hyperv/hv_vtl.c           | 12 ++----------
  arch/x86/hyperv/ivm.c              |  2 +-
  arch/x86/include/asm/apic.h        |  8 ++++----
  arch/x86/include/asm/mshyperv.h    |  5 +++--
  arch/x86/kernel/acpi/madt_wakeup.c |  2 +-
  arch/x86/kernel/apic/apic_noop.c   |  8 +++++++-
  arch/x86/kernel/apic/x2apic_uv_x.c |  2 +-
  arch/x86/kernel/smpboot.c          | 10 +++++-----
Quoted 2 lines

Since this is tagged as a hyperv-next patch, I'm happy to pick this up.

Thank you very much, Wei!

Quoted 1 line

Some changes should be acked by x86 maintainers.

Tom and Thomas reviewed the patch, and the scripts/get_maintainer.pl prints them as x86 maintainers. If I understand correctly what you're saying, someone who sends patches from the x86 tree to Linus should add Acked-by to the patch. Likely I should just wait until such person gets to this patch.

If I'm misunderstanding, I'd appreciate a quick note to help me navigate this :)

Quoted 4 lines

Thanks,
Wei.

Signature · 2 lines
Thank you,
Roman
maintainer
#5 lore raw
Quoted 24 lines · Roman Kisel
Quoted 1 line · Wei Liu

On Wed, Apr 30, 2025 at 01:47:20PM -0700, Roman Kisel wrote:

[...]

Quoted 10 lines
Quoted 9 lines
  arch/x86/coco/sev/core.c           | 13 ++-----------
  arch/x86/hyperv/hv_vtl.c           | 12 ++----------
  arch/x86/hyperv/ivm.c              |  2 +-
  arch/x86/include/asm/apic.h        |  8 ++++----
  arch/x86/include/asm/mshyperv.h    |  5 +++--
  arch/x86/kernel/acpi/madt_wakeup.c |  2 +-
  arch/x86/kernel/apic/apic_noop.c   |  8 +++++++-
  arch/x86/kernel/apic/x2apic_uv_x.c |  2 +-
  arch/x86/kernel/smpboot.c          | 10 +++++-----
Quoted 2 lines

Since this is tagged as a hyperv-next patch, I'm happy to pick this up.

Thank you very much, Wei!

Quoted 1 line

Some changes should be acked by x86 maintainers.

Quoted 9 lines

Tom and Thomas reviewed the patch, and the scripts/get_maintainer.pl prints them as x86 maintainers. If I understand correctly what you're saying, someone who sends patches from the x86 tree to Linus should add Acked-by to the patch. Likely I should just wait until such person gets to this patch.

If I'm misunderstanding, I'd appreciate a quick note to help me navigate this :)

$ ./scripts/get_maintainer.pl -f arch/x86/kernel
Thomas Gleixner <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:89/608=15%)
Ingo Molnar <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:180/608=30%)
Borislav Petkov <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:245/608=40%)
Dave Hansen <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:70/608=12%)
[email protected] (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
"H. Peter Anvin" <[email protected]> (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Reinette Chatre <[email protected]> (commit_signer:65/608=11%)
Tony Luck <[email protected]> (authored:31/608=5%)
James Morse <[email protected]> (authored:31/608=5%)
[email protected] (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT))

I'm looking for acks / reviews from Thomas, Ingo, Borislav, or Dave.

If Thomas had given an ack or a review before, you should've added that to the patch here.

You don't need to do that for this patch. Please point me to Thomas' reply to the previous version and I can add the missing tag to patch while I queue it.

Thanks,
Wei.

#6 lore raw
Quoted 3 lines · Wei Liu

You don't need to do that for this patch. Please point me to Thomas' reply to the previous version and I can add the missing tag to patch while I queue it.

It's right here:

	https://lore.kernel.org/all/8734dnouq6.ffs@tglx/

It's pretty darn trivial to find if you do any of the following:

1. Read this thread in your mail reader that understands threads, or
2. Look at this thread on lore, or
3. Run "b4 am" on the thread

Sure, it can be kinda hard to do #1/#2 on gigantic threads if there are a ton of replies from the maintainer. But there were 5 messages in this thread and only one from Thomas.

I'd highly suggest adding one or more of those tools to your maintainer toolbox! b4, especially, does all the work for you.

maintainer
#7 lore raw
Quoted 8 lines · Dave Hansen
Quoted 3 lines · Wei Liu

You don't need to do that for this patch. Please point me to Thomas' reply to the previous version and I can add the missing tag to patch while I queue it.

It's right here:

	https://lore.kernel.org/all/8734dnouq6.ffs@tglx/

Thanks for the pointer. This is appreciated.

Quoted 7 lines

It's pretty darn trivial to find if you do any of the following:

1. Read this thread in your mail reader that understands threads, or
2. Look at this thread on lore, or
3. Run "b4 am" on the thread

Quoted 6 lines

Sure, it can be kinda hard to do #1/#2 on gigantic threads if there are a ton of replies from the maintainer. But there were 5 messages in this thread and only one from Thomas.

I'd highly suggest adding one or more of those tools to your maintainer toolbox! b4, especially, does all the work for you.

I use b4, too.

I wished I had more time to go over every things in my inbox. That's why I asked Roman (and other contributors) to include whatever tags were given during the review process while they submit new versions of their patches.

Thanks,
Wei.

maintainer
#8 lore raw
Quoted 11 lines · Wei Liu
Quoted 8 lines · Dave Hansen
Quoted 3 lines · Wei Liu

You don't need to do that for this patch. Please point me to Thomas' reply to the previous version and I can add the missing tag to patch while I queue it.

It's right here:

	https://lore.kernel.org/all/8734dnouq6.ffs@tglx/

Thanks for the pointer. This is appreciated.

Oh, it is right there in this same exact thread. I'm dumb.

Wei.

maintainer Applied
#9 lore raw
In reply to Roman Kisel
Quoted 11 lines · Roman Kisel

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

Queued to hyperv-next. Thanks.

#10 lore raw
Quoted 6 lines · Roman Kisel
Quoted 5 lines

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Quoted 8 lines
Quoted 6 lines

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

Queued to hyperv-next. Thanks.

We need to update numachip_wakeup_secondary as well, otherwise this will break the builds.

Regards,
Saurabh

maintainer
#11 lore raw
In reply to Wei Liu
Quoted 6 lines · Wei Liu
Quoted 5 lines · Roman Kisel

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Quoted 8 lines
Quoted 6 lines

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

Queued to hyperv-next. Thanks.

This patch broke linux-next. I have dropped it. Please change numachip_wakeup_secondary.

Wei.

#13 lore raw
In reply to Roman Kisel
kernel test robot noticed the following build errors:

Hi Roman,

kernel test robot noticed the following build errors:

[auto build test ERROR on 628cc040b3a2980df6032766e8ef0688e981ab95]

url:    https://github.com/intel-lab-lkp/linux/commits/Roman-Kisel/arch-x86-Provide-the-CPU-number-in-the-wakeup-AP-callback/20250501-044909
base:   628cc040b3a2980df6032766e8ef0688e981ab95
patch link:    https://lore.kernel.org/r/20250430204720.108962-1-romank%40linux.microsoft.com
patch subject: [PATCH hyperv-next v3] arch/x86: Provide the CPU number in the wakeup AP callback
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250507/[email protected]/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250507/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/apic/apic_numachip.c:228:27: error: incompatible function pointer types initializing 'int (*)(u32, unsigned long, unsigned int)' (aka 'int (*)(unsigned int, unsigned long, unsigned int)') with an expression of type 'int (u32, unsigned long)' (aka 'int (unsigned int, unsigned long)') [-Wincompatible-function-pointer-types]

228 | .wakeup_secondary_cpu = numachip_wakeup_secondary,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/apic/apic_numachip.c:262:27: error: incompatible function pointer types initializing 'int (*)(u32, unsigned long, unsigned int)' (aka 'int (*)(unsigned int, unsigned long, unsigned int)') with an expression of type 'int (u32, unsigned long)' (aka 'int (unsigned int, unsigned long)') [-Wincompatible-function-pointer-types]
262 | .wakeup_secondary_cpu = numachip_wakeup_secondary,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

vim +228 arch/x86/kernel/apic/apic_numachip.c

d9d4dee6cedfa1 Daniel J Blueman 2015-09-21  204  
db1003a719d75c Daniel J Blueman 2015-09-21  205  static const struct apic apic_numachip1 __refconst = {
44b111b519160e Steffen Persvold 2011-12-06  206  	.name				= "NumaConnect system",
db1003a719d75c Daniel J Blueman 2015-09-21  207  	.probe				= numachip1_probe,
db1003a719d75c Daniel J Blueman 2015-09-21  208  	.acpi_madt_oem_check		= numachip1_acpi_madt_oem_check,
44b111b519160e Steffen Persvold 2011-12-06  209  
8c44963b603db7 Thomas Gleixner  2020-10-24  210  	.dest_mode_logical		= false,
44b111b519160e Steffen Persvold 2011-12-06  211  
44b111b519160e Steffen Persvold 2011-12-06  212  	.disable_esr			= 0,
44b111b519160e Steffen Persvold 2011-12-06  213  
44b111b519160e Steffen Persvold 2011-12-06  214  	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
44b111b519160e Steffen Persvold 2011-12-06  215  
d92e5e7cf580ac Thomas Gleixner  2023-08-08  216  	.max_apic_id			= UINT_MAX,
db1003a719d75c Daniel J Blueman 2015-09-21  217  	.get_apic_id			= numachip1_get_apic_id,
44b111b519160e Steffen Persvold 2011-12-06  218  
9f9e3bb1cf2ecb Thomas Gleixner  2017-09-13  219  	.calc_dest_apicid		= apic_default_calc_apicid,
44b111b519160e Steffen Persvold 2011-12-06  220  
c61a0d31ba0ce7 Thomas Gleixner  2015-11-04  221  	.send_IPI			= numachip_send_IPI_one,
44b111b519160e Steffen Persvold 2011-12-06  222  	.send_IPI_mask			= numachip_send_IPI_mask,
44b111b519160e Steffen Persvold 2011-12-06  223  	.send_IPI_mask_allbutself	= numachip_send_IPI_mask_allbutself,
44b111b519160e Steffen Persvold 2011-12-06  224  	.send_IPI_allbutself		= numachip_send_IPI_allbutself,
44b111b519160e Steffen Persvold 2011-12-06  225  	.send_IPI_all			= numachip_send_IPI_all,
44b111b519160e Steffen Persvold 2011-12-06  226  	.send_IPI_self			= numachip_send_IPI_self,
44b111b519160e Steffen Persvold 2011-12-06  227  
44b111b519160e Steffen Persvold 2011-12-06 @228  	.wakeup_secondary_cpu		= numachip_wakeup_secondary,
44b111b519160e Steffen Persvold 2011-12-06  229  
44b111b519160e Steffen Persvold 2011-12-06  230  	.read				= native_apic_mem_read,
44b111b519160e Steffen Persvold 2011-12-06  231  	.write				= native_apic_mem_write,
185c8f33a048bd Thomas Gleixner  2023-08-08  232  	.eoi				= native_apic_mem_eoi,
44b111b519160e Steffen Persvold 2011-12-06  233  	.icr_read			= native_apic_icr_read,
44b111b519160e Steffen Persvold 2011-12-06  234  	.icr_write			= native_apic_icr_write,
44b111b519160e Steffen Persvold 2011-12-06  235  };
44b111b519160e Steffen Persvold 2011-12-06  236  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#12 lore raw
In reply to Wei Liu
Quoted 10 lines · Wei Liu
Quoted 9 lines · Wei Liu
Quoted 8 lines · Roman Kisel

When starting APs, confidential guests and paravisor guests need to know the CPU number, and the pattern of using the linear search has emerged in several places. With N processors that leads to the O(N^2) time complexity.

Provide the CPU number in the AP wake up callback so that one can get the CPU number in constant time.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Queued to hyperv-next. Thanks.

This patch broke linux-next. I have dropped it. Please change numachip_wakeup_secondary.

Thanks for your help! Working on that.

Quoted 1 line

Wei.

Signature · 2 lines
Thank you,
Roman