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:	Wed, 14 Mar 2007 13:25:49 +1100
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	lkml - Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Zachary Amsden <zach@...are.com>,
	Jeremy Fitzhardinge <jeremy@...source.com>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@...e.de>
Subject: Re: [PATCH 0/8] x86 boot, pda and gdt cleanups

On Tue, 2007-03-13 at 13:48 -0700, Jeremy Fitzhardinge wrote:
> Rusty Russell wrote:
> > Hi all,
> >
> > 	The GDT stuff on x86 is a little more complex than it need be, but
> > playing with boot code is always dangerous.  These compile and boot on
> > UP and SMP for me, but Andrew should let the cook in -mm for a while.
> >   
> Hi Rusty,
> 
> This is my rough hacking patch I needed to get things into a Xen-shape
> state.

Looks good.  Just one thing:

>  void __devinit native_smp_prepare_boot_cpu(void)
>  {
> -	cpu_set(smp_processor_id(), cpu_online_map);
> -	cpu_set(smp_processor_id(), cpu_callout_map);
> -	cpu_set(smp_processor_id(), cpu_present_map);
> -	cpu_set(smp_processor_id(), cpu_possible_map);
> -	per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
> +	int cpu = smp_processor_id();
> +
> +	cpu_set(cpu, cpu_online_map);
> +	cpu_set(cpu, cpu_callout_map);
> +	cpu_set(cpu, cpu_present_map);
> +	cpu_set(cpu, cpu_possible_map);
> +	per_cpu(cpu_state, cpu) = CPU_ONLINE;
>  
>  	/* Set up %fs to point to our per-CPU area now it's allocated */
> -	init_gdt(smp_processor_id(), &init_task);
> -	cpu_set_gdt(smp_processor_id());
> +	init_gdt(cpu, &init_task);
> +	cpu_set_gdt(cpu);
>  }

This is called "pissing in the corners".  Don't do it: we don't need to
touch that code and I actually prefer the original anyway (explicit is
*good*).  

The habit of extracting cpu number once then using it is an optimization
which we should be aiming to get rid of (it simply hurts archs with
efficient per-cpu implementations).

Cheers,
Rusty.

-
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