Re: [PATCH] x86,cpu-hotplug: assign same CPU number to readded CPU
From: Borislav Petkov
Date: Fri Jul 11 2014 - 06:59:36 EST
On Fri, Jul 11, 2014 at 09:48:27AM +0900, Yasuaki Ishimatsu wrote:
> >>+static int get_cpuid(int apicid)
Btw this "cpuid" is misleading. Call it "cpu_num" or so.
> >>+{
> >>+ int cpuid;
> >>+
> >>+ cpuid = apicid_to_cpuid[apicid];
> >>+ if (cpuid < 0)
> >>+ cpuid = cpumask_next_zero(-1, cpu_used_mask);
> >Why do you need additional cpu bitmask?
>
> To assing new CPU number, I prepared new cpu bitmask.
>
> The following two steps are necessary to assign CPU number to APIC ID.
> 1. Check whether APIC ID has been assigned CPU number
> 2. Assign new CPU number if ACPI ID has not been assigned CPU number (it
> means apicid_to_cpuid[] returns -1)
>
> Step 1. is checked by apicid_to_cpuid[]. And step 2. assigns new CPU
> number by using cpu_used_mask.
>
> To keep cpu number, cpumask must not be cleared by hot removing CPU.
> If cpumask is cleared by hot removing CPU, the cpumask cannot be used
> to keep CPU number.
>
> Currently, cpu_present_map is used to assign CPU number. But the cpumask
> is cleared by hot removing CPU since the mask is prepared to remember
> existed CPUs in the system. So the cpu_present_map must be cleared
> at CPU hot remove.
>
> I confirmed whether present cpumasks (cpu_possible_map, cpu_online_map
> et al) is usable or not for this purpose. But there is no cpumask that
> can be used to keep CPU number. So I prepared new cpu bitmask.
>
> >How about just finding the first apicid_to_cpuid[apicid] < 0
> >and dropping not needed anymore bitmask.
>
> When apicid_to_cpuid[] return -1, kernel assigns new CPU number. For
> this, the cpu_used_mask is necessary.
And we can't have that - we cannot have cores which had number X get
number Y after hotplug.
Can you send a full dmesg after you've done a physical node hotplug on a
machine? Privately is fine too.
Boot with
"ignore_loglevel log_buf_len=10M debug apic=debug show_lapic=all"
please.
Thanks.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/