Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372411 > unrolled thread

[PATCH 5/5] arm64: Fix behavior of maxcpus=N

Started bySuzuki K Poulose <suzuki.poulose@arm.com>
First post2016-04-06 13:30 +0200
Last post2016-04-07 12:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/5] arm64: Fix behavior of maxcpus=N Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-04-06 13:30 +0200
    Re: [PATCH 5/5] arm64: Fix behavior of maxcpus=N James Morse <james.morse@arm.com> - 2016-04-07 11:30 +0200
      Re: [PATCH 5/5] arm64: Fix behavior of maxcpus=N Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2016-04-07 11:30 +0200
      [UPDATED] [PATCH 5/5] arm64: Fix behavior of maxcpus=N Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-04-07 12:10 +0200

#1372411 — [PATCH 5/5] arm64: Fix behavior of maxcpus=N

FromSuzuki K Poulose <suzuki.poulose@arm.com>
Date2016-04-06 13:30 +0200
Subject[PATCH 5/5] arm64: Fix behavior of maxcpus=N
Message-ID<rkTOO-33a-29@gated-at.bofh.it>
maxcpu=n sets the number of CPUs activated at boot time to a max of n,
but allowing the remaining CPUs to be brought up later if the user
decides to do so. However, on arm64 due to various reasons, we disallowed
hotplugging CPUs beyond n, by marking them not present. Now that
we have checks in place to make sure the hotplugged CPUs have compatible
features with system and requires no new errata, relax the restriction.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/smp.c |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index b2d5f4e..0988ccc 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -659,21 +659,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 	if (max_cpus > ncores)
 		max_cpus = ncores;
 
-	/* Don't bother if we're effectively UP */
-	if (max_cpus <= 1)
-		return;
-
 	/*
 	 * Initialise the present map (which describes the set of CPUs
 	 * actually populated at the present time) and release the
 	 * secondaries from the bootloader.
-	 *
-	 * Make sure we online at most (max_cpus - 1) additional CPUs.
 	 */
-	max_cpus--;
 	for_each_possible_cpu(cpu) {
-		if (max_cpus == 0)
-			break;
 
 		if (cpu == smp_processor_id())
 			continue;
@@ -686,7 +677,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 			continue;
 
 		set_cpu_present(cpu, true);
-		max_cpus--;
 	}
 }
 
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1373195

FromJames Morse <james.morse@arm.com>
Date2016-04-07 11:30 +0200
Message-ID<rleqe-1G9-1@gated-at.bofh.it>
In reply to#1372411
Hi Suzuki,

On 06/04/16 12:24, Suzuki K Poulose wrote:
> maxcpu=n sets the number of CPUs activated at boot time to a max of n,
> but allowing the remaining CPUs to be brought up later if the user
> decides to do so. However, on arm64 due to various reasons, we disallowed
> hotplugging CPUs beyond n, by marking them not present. Now that
> we have checks in place to make sure the hotplugged CPUs have compatible
> features with system and requires no new errata, relax the restriction.

> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index b2d5f4e..0988ccc 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -659,21 +659,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>  	if (max_cpus > ncores)
>  		max_cpus = ncores;

This "if (max_cpus > ncores)" is the only user of max_cpus left in this
function, and 'ncores' isn't used for anything else. Dead code?


> -	/* Don't bother if we're effectively UP */
> -	if (max_cpus <= 1)
> -		return;
> -
>  	/*
>  	 * Initialise the present map (which describes the set of CPUs
>  	 * actually populated at the present time) and release the
>  	 * secondaries from the bootloader.
> -	 *
> -	 * Make sure we online at most (max_cpus - 1) additional CPUs.
>  	 */
> -	max_cpus--;
>  	for_each_possible_cpu(cpu) {
> -		if (max_cpus == 0)
> -			break;
>  
>  		if (cpu == smp_processor_id())
>  			continue;
> @@ -686,7 +677,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>  			continue;
>  
>  		set_cpu_present(cpu, true);
> -		max_cpus--;
>  	}
>  }
>  
> 


Thanks,

James

[toc] | [prev] | [next] | [standalone]


#1373200

FromSuzuki K Poulose <Suzuki.Poulose@arm.com>
Date2016-04-07 11:30 +0200
Message-ID<rleqf-1G9-17@gated-at.bofh.it>
In reply to#1373195
On 07/04/16 10:18, James Morse wrote:
> Hi Suzuki,
>
> On 06/04/16 12:24, Suzuki K Poulose wrote:
>> maxcpu=n sets the number of CPUs activated at boot time to a max of n,
>> but allowing the remaining CPUs to be brought up later if the user
>> decides to do so. However, on arm64 due to various reasons, we disallowed
>> hotplugging CPUs beyond n, by marking them not present. Now that
>> we have checks in place to make sure the hotplugged CPUs have compatible
>> features with system and requires no new errata, relax the restriction.
>
>> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
>> index b2d5f4e..0988ccc 100644
>> --- a/arch/arm64/kernel/smp.c
>> +++ b/arch/arm64/kernel/smp.c
>> @@ -659,21 +659,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>>   	if (max_cpus > ncores)
>>   		max_cpus = ncores;
>
> This "if (max_cpus > ncores)" is the only user of max_cpus left in this
> function, and 'ncores' isn't used for anything else. Dead code?

Yes, it is. We already do for_each_possible_cpu() and ncores was set to num_possible_cpus().
So, the ncores was kind of superfluous to begin with. Thanks for pointing it
out, I will remove it.

Cheers
Suzuki

[toc] | [prev] | [next] | [standalone]


#1373228 — [UPDATED] [PATCH 5/5] arm64: Fix behavior of maxcpus=N

FromSuzuki K Poulose <suzuki.poulose@arm.com>
Date2016-04-07 12:10 +0200
Subject[UPDATED] [PATCH 5/5] arm64: Fix behavior of maxcpus=N
Message-ID<rlf2V-2cW-9@gated-at.bofh.it>
In reply to#1373195
maxcpu=n sets the number of CPUs activated at boot time to a max of n,
but allowing the remaining CPUs to be brought up later if the user
decides to do so. However, on arm64 due to various reasons, we disallowed
hotplugging CPUs beyond n, by marking them not present. Now that
we have checks in place to make sure the hotplugged CPUs have compatible
features with system and requires no new errata, relax the restriction.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---

Changes:
  - Remove dead code (ncores) - [James Morse]

---
 arch/arm64/kernel/smp.c |   18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index b2d5f4e..fa9dbaa 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -647,33 +647,18 @@ void __init smp_init_cpus(void)
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
 	int err;
-	unsigned int cpu, ncores = num_possible_cpus();
+	unsigned int cpu;
 
 	init_cpu_topology();
 
 	smp_store_cpu_info(smp_processor_id());
 
 	/*
-	 * are we trying to boot more cores than exist?
-	 */
-	if (max_cpus > ncores)
-		max_cpus = ncores;
-
-	/* Don't bother if we're effectively UP */
-	if (max_cpus <= 1)
-		return;
-
-	/*
 	 * Initialise the present map (which describes the set of CPUs
 	 * actually populated at the present time) and release the
 	 * secondaries from the bootloader.
-	 *
-	 * Make sure we online at most (max_cpus - 1) additional CPUs.
 	 */
-	max_cpus--;
 	for_each_possible_cpu(cpu) {
-		if (max_cpus == 0)
-			break;
 
 		if (cpu == smp_processor_id())
 			continue;
@@ -686,7 +671,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 			continue;
 
 		set_cpu_present(cpu, true);
-		max_cpus--;
 	}
 }
 
-- 
1.7.9.5

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web