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]
Date:	Sat, 04 Oct 2008 18:52:06 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	Chuck Ebbert <cebbert@...hat.com>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Arjan van de Ven <arjan@...radead.org>
Subject: <PING> Re: [patch x86/core] x86: allow number of additional hotplug CPUs to be set at compile time

Andi Kleen <andi@...stfloor.org> writes:

>> The prefix rewriting doesn't happen unless I boot with additional_cpus=0,
>> maxcpus=1, or with this patch applied and the config option set. I think
>> the rules for when/if the rewriting happens changed a while ago to avoid
>> multiple switches and now it's not happening at all on this machine by
>> default.
>
> Well then something is broken, but the fix is not to lower num_possible_cpus(),
> but to fix the root cause.
>
> Does the appended patch help?

Ping? Can you please test the patch?  I think that's the correct fix.
 
I see Ingo unfortunately merged your initial broken hack, but it's wrong
and when actually used on a distribution will break real CPU hotplug there.
Please don't enable that CONFIG option in Fedora. Ideally drop
the CONFIG patch completely because it cannot do much good.

It should be replaced with the appended patch, which should go into 2.6.27
after it is confirmed to fix the problem.

Thanks.

-Andi

> ---
>
> Take disabled cpus into account in alternative.c
>
> Otherwise an UP system with one hotplug CPU will not 
> go into UP mode.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
>
> Index: linux-2.6.27-rc4-misc/arch/x86/kernel/alternative.c
> ===================================================================
> --- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/alternative.c
> +++ linux-2.6.27-rc4-misc/arch/x86/kernel/alternative.c
> @@ -454,7 +454,7 @@ void __init alternative_instructions(voi
>  					    _text, _etext);
>  
>  		/* Only switch to UP mode if we don't immediately boot others */
> -		if (num_possible_cpus() == 1 || setup_max_cpus <= 1)
> +		if (num_possible_cpus() - additional_cpus == 1 || setup_max_cpus <= 1)
>  			alternatives_smp_switch(0);
>  	}
>  #endif
> Index: linux-2.6.27-rc4-misc/arch/x86/kernel/smpboot.c
> ===================================================================
> --- linux-2.6.27-rc4-misc.orig/arch/x86/kernel/smpboot.c
> +++ linux-2.6.27-rc4-misc/arch/x86/kernel/smpboot.c
> @@ -1276,7 +1276,7 @@ static void remove_siblinginfo(int cpu)
>  	cpu_clear(cpu, cpu_sibling_setup_map);
>  }
>  
> -static int additional_cpus __initdata = -1;
> +int additional_cpus = -1;
>  
>  static __init int setup_additional_cpus(char *s)
>  {
> Index: linux-2.6.27-rc4-misc/include/asm-x86/smp.h
> ===================================================================
> --- linux-2.6.27-rc4-misc.orig/include/asm-x86/smp.h
> +++ linux-2.6.27-rc4-misc/include/asm-x86/smp.h
> @@ -204,5 +204,7 @@ static inline int hard_smp_processor_id(
>  extern void cpu_uninit(void);
>  #endif
>  
> +extern int additional_cpus;
> +
>  #endif /* __ASSEMBLY__ */
>  #endif
> -- 
> ak@...ux.intel.com

-- 
ak@...ux.intel.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ