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: <1232115396-26367-14-git-send-email-brgerst@gmail.com>
Date:	Fri, 16 Jan 2009 09:16:33 -0500
From:	Brian Gerst <brgerst@...il.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Brian Gerst <brgerst@...il.com>
Subject: [PATCH 14/17] x86-64: Remove load_pda_offset()

There is only one place now where the %gs base is changed after boot.
Move the code inline to setup_per_cpu_areas().

Signed-off-by: Brian Gerst <brgerst@...il.com>
---
 arch/x86/include/asm/percpu.h  |    6 ------
 arch/x86/kernel/setup_percpu.c |   20 ++++++--------------
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 165d527..ce980db 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -133,12 +133,6 @@ do {							\
 /* We can use this directly for local CPU (faster). */
 DECLARE_PER_CPU(unsigned long, this_cpu_off);
 
-#ifdef CONFIG_X86_64
-extern void load_pda_offset(int cpu);
-#else
-static inline void load_pda_offset(int cpu) { }
-#endif
-
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_SMP
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 0ddb184..916e2cf 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -69,23 +69,12 @@ static inline void setup_node_to_cpumask_map(void) { }
 #endif
 
 /*
- * Define load_pda_offset() and per-cpu __pda for x86_64.
- * load_pda_offset() is responsible for loading the offset of pda into
- * %gs.
- *
  * On SMP, pda offset also duals as percpu base address and thus it
  * should be at the start of per-cpu area.  To achieve this, it's
  * preallocated in vmlinux_64.lds.S directly instead of using
  * DEFINE_PER_CPU().
  */
 #ifdef CONFIG_X86_64
-void __cpuinit load_pda_offset(int cpu)
-{
-	/* Memory clobbers used to order pda/percpu accesses */
-	mb();
-	wrmsrl(MSR_GS_BASE, cpu_pda(cpu));
-	mb();
-}
 #ifndef CONFIG_SMP
 DEFINE_PER_CPU(struct x8664_pda, __pda);
 #endif
@@ -205,9 +194,12 @@ void __init setup_per_cpu_areas(void)
 		 * CPU0 modified pda in the init data area, reload pda
 		 * offset for CPU0 and clear the area for others.
 		 */
-		if (cpu == 0)
-			load_pda_offset(0);
-		else
+		if (cpu == 0) {
+			/* Memory clobbers used to order pda/percpu accesses */
+			mb();
+			wrmsrl(MSR_GS_BASE, cpu_pda(0));
+			mb();
+		} else
 			memset(cpu_pda(cpu), 0, sizeof(*cpu_pda(cpu)));
 #endif
 
-- 
1.6.1.rc1

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