[PATCH 4/12] tls-unnecessary-init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* zach@xxxxxxxxxx (zach@xxxxxxxxxx) wrote:
> The per-CPU initialization code is copying in bogus data into
> thread->tls_array.  Note that it copies &per_cpu(cpu_gdt_table, cpu),
> not &per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_TLS_MIN).  That is totally
> broken and unnecessary.  Make the initialization explicitly NULL.
> 
> Signed-off-by: Zachary Amsden <zach@xxxxxxxxxx
> Index: linux-2.6.13/include/asm-i386/processor.h
> ===================================================================
> --- linux-2.6.13.orig/include/asm-i386/processor.h	2005-08-08 15:27:25.000000000 -0700
> +++ linux-2.6.13/include/asm-i386/processor.h	2005-08-08 17:57:17.000000000 -0700
> @@ -463,6 +463,7 @@
>  };
>  
>  #define INIT_THREAD  {							\
> +	.tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES-1 ] = { 0,0 } },	\
>  	.vm86_info = NULL,						\
>  	.sysenter_cs = __KERNEL_CS,					\
>  	.io_bitmap_ptr = NULL,						\
> Index: linux-2.6.13/arch/i386/kernel/cpu/common.c
> ===================================================================
> --- linux-2.6.13.orig/arch/i386/kernel/cpu/common.c	2005-08-08 17:09:57.000000000 -0700
> +++ linux-2.6.13/arch/i386/kernel/cpu/common.c	2005-08-08 17:50:09.000000000 -0700
> @@ -607,12 +607,6 @@
>  	cpu_gdt_descr[cpu].address =
>  	    (unsigned long)&per_cpu(cpu_gdt_table, cpu);
>  
> -	/*
> -	 * Set up the per-thread TLS descriptor cache:
> -	 */
> -	memcpy(thread->tls_array, &per_cpu(cpu_gdt_table, cpu),
> -		GDT_ENTRY_TLS_ENTRIES * 8);
> -

Heh, yeah that cleanup is in Xen:

-       memcpy(thread->tls_array, &per_cpu(cpu_gdt_table, cpu),
-               GDT_ENTRY_TLS_ENTRIES * 8);
+       memcpy(thread->tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
+              GDT_ENTRY_TLS_ENTRIES * 8);


I recall considering removing that stuff since it looked redundant,
but there's mention of reload, and barrier so I left it alone...

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux