linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: ego@linux.vnet.ibm.com
Cc: peterz@infradead.org, mingo@kernel.org,
	rafael.j.wysocki@intel.com, srivatsa@mit.edu,
	akpm@linux-foundation.org, laijs@cn.fujitsu.com,
	toshi.kani@hp.com, todd.e.brandt@linux.intel.com,
	wangyun@linux.vnet.ibm.com, fabf@skynet.be,
	linux@arm.linux.org.uk, oleg@redhat.com,
	srivatsa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH V2] PM/CPU: Parallel enalbing nonboot cpus with resume devices
Date: Thu, 18 Sep 2014 16:36:41 +0800	[thread overview]
Message-ID: <541A9999.1070607@intel.com> (raw)
In-Reply-To: <20140917090308.GD31806@in.ibm.com>

On 2014年09月17日 17:03, Gautham R Shenoy wrote:
> Hi Lan,
> 
> Sorry missed this repost! Couple of comments.
> 

Np, Thanks for review :)

> On Fri, Aug 22, 2014 at 04:33:40PM +0800, Lan Tianyu wrote:
> 
> [.. snip ..]
>>
>> +static int _cpu_up_with_trace(int cpu)
>> +{
>> +	int error;
>> +
>> +	trace_suspend_resume(TPS("CPU_ON"), cpu, true);
>> +	error = _cpu_up(cpu, 1);
>> +	trace_suspend_resume(TPS("CPU_ON"), cpu, false);
>> +	if (error) {
>> +		pr_warn("Error taking CPU%d up: %d\n", cpu, error);
>> +		return error;
>> +	}
>> +
>> +	pr_info("CPU%d is up\n", cpu);
>> +	return 0;
>> +}
>> +
>> +static int async_enable_nonboot_cpus(void *data)
>> +{
>> +	int cpu;
>> +
>> +	cpu_maps_update_begin();
>> +	arch_enable_nonboot_cpus_begin();
>> +
>> +	for_each_cpu(cpu, frozen_cpus) {
>> +		_cpu_up_with_trace(cpu);
>> +	}
>> +
>> +	arch_enable_nonboot_cpus_end();
>> +	cpumask_clear(frozen_cpus);
>> +	cpu_maps_update_done();
>> +	return 0;
>> +}
>> +
>>  void __ref enable_nonboot_cpus(void)
>>  {
>> +	struct task_struct *tsk;
>>  	int cpu, error;
>>
>>  	/* Allow everyone to use the CPU hotplug again */
>> @@ -563,22 +597,34 @@ void __ref enable_nonboot_cpus(void)
>>
>>  	pr_info("Enabling non-boot CPUs ...\n");
>>
>> -	arch_enable_nonboot_cpus_begin();
>> +	cpu = cpumask_first(frozen_cpus);
>> +	cpumask_clear_cpu(cpu, frozen_cpus);
>>
>> -	for_each_cpu(cpu, frozen_cpus) {
>> -		trace_suspend_resume(TPS("CPU_ON"), cpu, true);
>> -		error = _cpu_up(cpu, 1);
>> -		trace_suspend_resume(TPS("CPU_ON"), cpu, false);
>> -		if (!error) {
>> -			pr_info("CPU%d is up\n", cpu);
>> -			continue;
>> +	error = _cpu_up_with_trace(cpu);
> 
>  If cpu fails to come up, you need to add a pr_warn() citing the
>  reason why it failed to come up.

Ok.

> 
> 
>> +	if (cpumask_empty(frozen_cpus))
>> +		goto out;
>> +
>> +	if (error) {
>> +		/*
>> +		 * If fail to bring up the first frozen cpus,
>> +		 * enable the rest frozen cpus on the boot cpu.
>> +		 */
>> +		arch_enable_nonboot_cpus_begin();
>> +		for_each_cpu(cpu, frozen_cpus) {
>> +			_cpu_up_with_trace(cpu);
>>  		}
>> -		pr_warn("Error taking CPU%d up: %d\n", cpu, error);
>> -	}
>> +		arch_enable_nonboot_cpus_end();
>>
>> -	arch_enable_nonboot_cpus_end();
>> +	} else {
>> +		tsk = kthread_create_on_cpu(async_enable_nonboot_cpus,
>> +				NULL, cpu, "async-enable-nonboot-cpus");
>> +		if (IS_ERR(tsk)) {
>> +			pr_err("Failed to create async enable nonboot cpus thread.\n");
>> +			goto out;
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is not good. If you fail to
> create a kthread on the first non-boot cpu, that means none of the
> other non-boot cpus will be brought up. 
> 
> Hence you might want to consider reordering the code in such a manner
> that if the first non-boot cpu fails to come up or if you fail to
> create the kthread task, then the boot cpu will boot the remaining non
> boot cpus.

Yes, this sounds good and will do it in the new version.

> 
> --
> Thanks and Regards
> gautham.
> 


-- 
Best regards
Tianyu Lan

      reply	other threads:[~2014-09-18  8:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22  8:33 [RFC PATCH V2] PM/CPU: Parallel enalbing nonboot cpus with resume devices Lan Tianyu
2014-08-29  3:40 ` Lan Tianyu
2014-08-30  0:22   ` Rafael J. Wysocki
2014-09-03  8:51     ` Lan Tianyu
2014-09-17  9:03 ` Gautham R Shenoy
2014-09-18  8:36   ` Lan Tianyu [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=541A9999.1070607@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=ego@linux.vnet.ibm.com \
    --cc=fabf@skynet.be \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=srivatsa@mit.edu \
    --cc=todd.e.brandt@linux.intel.com \
    --cc=toshi.kani@hp.com \
    --cc=wangyun@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).