Hello,
So, overall, I think this is the right way to go although I have no
idea whether the acpi part is okay.
+/*Rename it to nr_logical_cpuids and just mention that it's allocated
+ * Current allocated max logical CPU ID plus 1.
+ * All allocated CPU ID should be in [0, max_logical_cpuid),
+ * so the maximum of max_logical_cpuid is nr_cpu_ids.
+ *
+ * NOTE: Reserve 0 for BSP.
+ */
+static int max_logical_cpuid = 1;
contiguously?
+static int cpuid_to_apicid[] = {And maybe mention how the two variables are synchronized?
+ [0 ... NR_CPUS - 1] = -1,
+};
+static int allocate_logical_cpuid(int apicid)So, the original code didn't have this failure mode, why is this
+{
+ int i;
+
+ /*
+ * cpuid <-> apicid mapping is persistent, so when a cpu is up,
+ * check if the kernel has allocated a cpuid for it.
+ */
+ for (i = 0; i < max_logical_cpuid; i++) {
+ if (cpuid_to_apicid[i] == apicid)
+ return i;
+ }
+
+ /* Allocate a new cpuid. */
+ if (max_logical_cpuid >= nr_cpu_ids) {
+ WARN_ONCE(1, "Only %d processors supported."
+ "Processor %d/0x%x and the rest are ignored.\n",
+ nr_cpu_ids - 1, max_logical_cpuid, apicid);
+ return -1;
+ }
different for the new code?
Thanks.