public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Igor Mammedov <imammedo@redhat.com>, <tglx@linutronix.de>,
	<mingo@redhat.com>, <hpa@zytor.com>, <x86@kernel.org>,
	<toshi.kani@hp.com>, <huawei.libin@huawei.com>,
	<paul.gortmaker@windriver.com>, <linux-kernel@vger.kernel.org>,
	<srivatsa.bhat@linux.vnet.ibm.com>, <umgwanakikbuti@gmail.com>,
	<peterz@infradead.org>
Subject: Re: [PATCH] x86,cpu-hotplug: assign same CPU number to readded CPU
Date: Tue, 15 Jul 2014 13:27:02 +0900	[thread overview]
Message-ID: <53C4AD96.3030303@jp.fujitsu.com> (raw)
In-Reply-To: <20140711105920.GC17083@pd.tnic>

Hi Borislav,

(2014/07/11 19:59), Borislav Petkov wrote:
> 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.

O.K.
I'll update it.

>
>>>> +{
>>>> +	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.

O.K.
I'll send dmesg.

Thanks,
Yasuaki Ishimatsu

>
> Boot with
>
> 	"ignore_loglevel log_buf_len=10M debug apic=debug show_lapic=all"
>
> please.
>
> Thanks.
>



      reply	other threads:[~2014-07-15  4:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  8:41 [PATCH] x86,cpu-hotplug: assign same CPU number to readded CPU Yasuaki Ishimatsu
2014-07-10  9:26 ` Igor Mammedov
2014-07-11  0:48   ` Yasuaki Ishimatsu
2014-07-11 10:59     ` Borislav Petkov
2014-07-15  4:27       ` Yasuaki Ishimatsu [this message]

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=53C4AD96.3030303@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=huawei.libin@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=peterz@infradead.org \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.com \
    --cc=umgwanakikbuti@gmail.com \
    --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