lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4b8718c-ee74-2609-40f6-cb8f62247d51@gmail.com>
Date:   Tue, 23 Feb 2021 19:45:27 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Álvaro Fernández Rojas <noltari@...il.com>,
        jonas.gorski@...il.com, Florian Fainelli <f.fainelli@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Marc Zyngier <maz@...nel.org>,
        bcm-kernel-feedback-list@...adcom.com, linux-mips@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mips: smp-bmips: fix CPU mappings



On 2/23/2021 4:48 AM, Álvaro Fernández Rojas wrote:
> When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of
> CPU #0, the current CPU mapping code produces the following:
> - smp_processor_id(): 0
> - cpu_logical_map(): 1
> - cpu_number_map(): 1
> 
> This is because SMP isn't supported on BCM6358 since it has a shared TLB, so
> it is disabled and max_cpus is decreased from 2 to 1.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@...il.com>
> ---
>  arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
> index 359b176b665f..c4760cb48a67 100644
> --- a/arch/mips/kernel/smp-bmips.c
> +++ b/arch/mips/kernel/smp-bmips.c
> @@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)
>  	if (!board_ebase_setup)
>  		board_ebase_setup = &bmips_ebase_setup;
>  
> -	__cpu_number_map[boot_cpu] = 0;
> -	__cpu_logical_map[0] = boot_cpu;
> -
> -	for (i = 0; i < max_cpus; i++) {
> -		if (i != boot_cpu) {
> -			__cpu_number_map[i] = cpu;
> -			__cpu_logical_map[cpu] = i;
> -			cpu++;
> +	if (max_cpus > 1) {
> +		__cpu_number_map[boot_cpu] = 0;
> +		__cpu_logical_map[0] = boot_cpu;
> +
> +		for (i = 0; i < max_cpus; i++) {
> +			if (i != boot_cpu) {
> +				__cpu_number_map[i] = cpu;
> +				__cpu_logical_map[cpu] = i;
> +				cpu++;
> +			}
> +			set_cpu_possible(i, 1);
> +			set_cpu_present(i, 1);
>  		}
> -		set_cpu_possible(i, 1);
> -		set_cpu_present(i, 1);
> +	} else {
> +		__cpu_number_map[0] = boot_cpu;
> +		__cpu_logical_map[0] = 0;
> +		set_cpu_possible(0, 1);
> +		set_cpu_possible(0, 1);

Duplicate line, with that fixed:

Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ