linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
@ 2020-11-25 10:11 Tiezhu Yang
  2020-11-25 17:06 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tiezhu Yang @ 2020-11-25 10:11 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang, Florian Fainelli
  Cc: linux-mips, bcm-kernel-feedback-list, linux-kernel, Xuefeng Li

After commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"),
c->hotpluggable is 0 for CPU 0 and it will not generate a control
file in sysfs for this CPU:

[root@linux loongson]# cat /sys/devices/system/cpu/cpu0/online
cat: /sys/devices/system/cpu/cpu0/online: No such file or directory
[root@linux loongson]# echo 0 > /sys/devices/system/cpu/cpu0/online
bash: /sys/devices/system/cpu/cpu0/online: Permission denied

So no need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable(),
just remove them.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/cavium-octeon/smp.c | 3 ---
 arch/mips/kernel/smp-bmips.c  | 3 ---
 arch/mips/loongson64/smp.c    | 3 ---
 3 files changed, 9 deletions(-)

diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 076db9a..66ce552 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -290,9 +290,6 @@ static int octeon_cpu_disable(void)
 {
 	unsigned int cpu = smp_processor_id();
 
-	if (cpu == 0)
-		return -EBUSY;
-
 	if (!octeon_bootloader_entry_addr)
 		return -ENOTSUPP;
 
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 1dbfb5a..359b176 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -362,9 +362,6 @@ static int bmips_cpu_disable(void)
 {
 	unsigned int cpu = smp_processor_id();
 
-	if (cpu == 0)
-		return -EBUSY;
-
 	pr_info("SMP: CPU%d is offline\n", cpu);
 
 	set_cpu_online(cpu, false);
diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index aa0cd72..b8c1fc3 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -544,9 +544,6 @@ static int loongson3_cpu_disable(void)
 	unsigned long flags;
 	unsigned int cpu = smp_processor_id();
 
-	if (cpu == 0)
-		return -EBUSY;
-
 	set_cpu_online(cpu, false);
 	calculate_cpu_foreign_map();
 	local_irq_save(flags);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
  2020-11-25 10:11 [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable() Tiezhu Yang
@ 2020-11-25 17:06 ` Florian Fainelli
  2020-11-27  9:32 ` Thomas Bogendoerfer
  2020-12-15  3:26 ` liwei (GF)
  2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2020-11-25 17:06 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, bcm-kernel-feedback-list, linux-kernel, Xuefeng Li



On 11/25/2020 2:11 AM, Tiezhu Yang wrote:
> After commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"),
> c->hotpluggable is 0 for CPU 0 and it will not generate a control
> file in sysfs for this CPU:
> 
> [root@linux loongson]# cat /sys/devices/system/cpu/cpu0/online
> cat: /sys/devices/system/cpu/cpu0/online: No such file or directory
> [root@linux loongson]# echo 0 > /sys/devices/system/cpu/cpu0/online
> bash: /sys/devices/system/cpu/cpu0/online: Permission denied
> 
> So no need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable(),
> just remove them.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/cavium-octeon/smp.c | 3 ---
>  arch/mips/kernel/smp-bmips.c  | 3 ---

For smp-bmips.c:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
  2020-11-25 10:11 [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable() Tiezhu Yang
  2020-11-25 17:06 ` Florian Fainelli
@ 2020-11-27  9:32 ` Thomas Bogendoerfer
  2020-12-15  3:26 ` liwei (GF)
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-27  9:32 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Huacai Chen, Jiaxun Yang, Florian Fainelli, linux-mips,
	bcm-kernel-feedback-list, linux-kernel, Xuefeng Li

On Wed, Nov 25, 2020 at 06:11:30PM +0800, Tiezhu Yang wrote:
> After commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"),
> c->hotpluggable is 0 for CPU 0 and it will not generate a control
> file in sysfs for this CPU:
> 
> [root@linux loongson]# cat /sys/devices/system/cpu/cpu0/online
> cat: /sys/devices/system/cpu/cpu0/online: No such file or directory
> [root@linux loongson]# echo 0 > /sys/devices/system/cpu/cpu0/online
> bash: /sys/devices/system/cpu/cpu0/online: Permission denied
> 
> So no need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable(),
> just remove them.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/cavium-octeon/smp.c | 3 ---
>  arch/mips/kernel/smp-bmips.c  | 3 ---
>  arch/mips/loongson64/smp.c    | 3 ---
>  3 files changed, 9 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
  2020-11-25 10:11 [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable() Tiezhu Yang
  2020-11-25 17:06 ` Florian Fainelli
  2020-11-27  9:32 ` Thomas Bogendoerfer
@ 2020-12-15  3:26 ` liwei (GF)
  2020-12-15  4:10   ` Tiezhu Yang
  2 siblings, 1 reply; 5+ messages in thread
From: liwei (GF) @ 2020-12-15  3:26 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang,
	Florian Fainelli
  Cc: linux-mips, bcm-kernel-feedback-list, linux-kernel, Xuefeng Li

Hi,

On 2020/11/25 18:11, Tiezhu Yang wrote:
> After commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"),

Why CPU#0 is not hotpluggable on MIPS? Does that unrealizable?

> c->hotpluggable is 0 for CPU 0 and it will not generate a control
> file in sysfs for this CPU:
> 
> [root@linux loongson]# cat /sys/devices/system/cpu/cpu0/online
> cat: /sys/devices/system/cpu/cpu0/online: No such file or directory
> [root@linux loongson]# echo 0 > /sys/devices/system/cpu/cpu0/online
> bash: /sys/devices/system/cpu/cpu0/online: Permission denied
> 
> So no need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable(),

missing cps_cpu_disable()?

Thanks,
Wei

> just remove them.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/cavium-octeon/smp.c | 3 ---
>  arch/mips/kernel/smp-bmips.c  | 3 ---
>  arch/mips/loongson64/smp.c    | 3 ---
>  3 files changed, 9 deletions(-)
> 
> diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
> index 076db9a..66ce552 100644
> --- a/arch/mips/cavium-octeon/smp.c
> +++ b/arch/mips/cavium-octeon/smp.c
> @@ -290,9 +290,6 @@ static int octeon_cpu_disable(void)
>  {
>  	unsigned int cpu = smp_processor_id();
>  
> -	if (cpu == 0)
> -		return -EBUSY;
> -
>  	if (!octeon_bootloader_entry_addr)
>  		return -ENOTSUPP;
>  
> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
> index 1dbfb5a..359b176 100644
> --- a/arch/mips/kernel/smp-bmips.c
> +++ b/arch/mips/kernel/smp-bmips.c
> @@ -362,9 +362,6 @@ static int bmips_cpu_disable(void)
>  {
>  	unsigned int cpu = smp_processor_id();
>  
> -	if (cpu == 0)
> -		return -EBUSY;
> -
>  	pr_info("SMP: CPU%d is offline\n", cpu);
>  
>  	set_cpu_online(cpu, false);
> diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
> index aa0cd72..b8c1fc3 100644
> --- a/arch/mips/loongson64/smp.c
> +++ b/arch/mips/loongson64/smp.c
> @@ -544,9 +544,6 @@ static int loongson3_cpu_disable(void)
>  	unsigned long flags;
>  	unsigned int cpu = smp_processor_id();
>  
> -	if (cpu == 0)
> -		return -EBUSY;
> -
>  	set_cpu_online(cpu, false);
>  	calculate_cpu_foreign_map();
>  	local_irq_save(flags);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
  2020-12-15  3:26 ` liwei (GF)
@ 2020-12-15  4:10   ` Tiezhu Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Tiezhu Yang @ 2020-12-15  4:10 UTC (permalink / raw)
  To: liwei (GF),
	Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang, Florian Fainelli
  Cc: linux-mips, bcm-kernel-feedback-list, linux-kernel, Xuefeng Li

On 12/15/2020 11:26 AM, liwei (GF) wrote:
> Hi,
>
> On 2020/11/25 18:11, Tiezhu Yang wrote:
>> After commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"),
> Why CPU#0 is not hotpluggable on MIPS? Does that unrealizable?

The early discussion is here:
https://patchwork.kernel.org/project/linux-mips/patch/1594896024-16624-1-git-send-email-chenhc@lemote.com/

As Jiaxun said, it seems that this is a software limitation.
I think the initial aim of commit 9cce844abf07 ("MIPS: CPU#0 is not 
hotpluggable")
is to solve ltp test failure.

>
>> c->hotpluggable is 0 for CPU 0 and it will not generate a control
>> file in sysfs for this CPU:
>>
>> [root@linux loongson]# cat /sys/devices/system/cpu/cpu0/online
>> cat: /sys/devices/system/cpu/cpu0/online: No such file or directory
>> [root@linux loongson]# echo 0 > /sys/devices/system/cpu/cpu0/online
>> bash: /sys/devices/system/cpu/cpu0/online: Permission denied
>>
>> So no need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable(),
> missing cps_cpu_disable()?

Yes, thank you, let me send a patch to do it.

Thanks,
Tiezhu

>
> Thanks,
> Wei
>
>> just remove them.
>>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>   arch/mips/cavium-octeon/smp.c | 3 ---
>>   arch/mips/kernel/smp-bmips.c  | 3 ---
>>   arch/mips/loongson64/smp.c    | 3 ---
>>   3 files changed, 9 deletions(-)
>>
>> diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
>> index 076db9a..66ce552 100644
>> --- a/arch/mips/cavium-octeon/smp.c
>> +++ b/arch/mips/cavium-octeon/smp.c
>> @@ -290,9 +290,6 @@ static int octeon_cpu_disable(void)
>>   {
>>   	unsigned int cpu = smp_processor_id();
>>   
>> -	if (cpu == 0)
>> -		return -EBUSY;
>> -
>>   	if (!octeon_bootloader_entry_addr)
>>   		return -ENOTSUPP;
>>   
>> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
>> index 1dbfb5a..359b176 100644
>> --- a/arch/mips/kernel/smp-bmips.c
>> +++ b/arch/mips/kernel/smp-bmips.c
>> @@ -362,9 +362,6 @@ static int bmips_cpu_disable(void)
>>   {
>>   	unsigned int cpu = smp_processor_id();
>>   
>> -	if (cpu == 0)
>> -		return -EBUSY;
>> -
>>   	pr_info("SMP: CPU%d is offline\n", cpu);
>>   
>>   	set_cpu_online(cpu, false);
>> diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
>> index aa0cd72..b8c1fc3 100644
>> --- a/arch/mips/loongson64/smp.c
>> +++ b/arch/mips/loongson64/smp.c
>> @@ -544,9 +544,6 @@ static int loongson3_cpu_disable(void)
>>   	unsigned long flags;
>>   	unsigned int cpu = smp_processor_id();
>>   
>> -	if (cpu == 0)
>> -		return -EBUSY;
>> -
>>   	set_cpu_online(cpu, false);
>>   	calculate_cpu_foreign_map();
>>   	local_irq_save(flags);
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-15  4:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 10:11 [PATCH] MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable() Tiezhu Yang
2020-11-25 17:06 ` Florian Fainelli
2020-11-27  9:32 ` Thomas Bogendoerfer
2020-12-15  3:26 ` liwei (GF)
2020-12-15  4:10   ` Tiezhu Yang

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).