login
Header Space

 
 

Re: x86: Unify current.h

Previous thread: Re: [PATCH] mdacon messing up default vc's, set default to vc13-16 again by Roland on Monday, May 5, 2008 - 2:47 pm. (1 message)

Next thread: Re: Hotplug CPU support for Oprofile by Mike Travis on Monday, May 5, 2008 - 3:00 pm. (2 messages)
To: Ingo Molnar <mingo@...>
Cc: <travis@...>, <linux-kernel@...>
Date: Monday, May 5, 2008 - 2:48 pm

There are just two definitions that are shared but the resulting combined 
file is resonably small. Putting these two arch headers together shows 
that further unifications requires a unification of the per cpu / pda 
handling between both arches (zero based or some variation thereof).

Signed-off-by: Christoph Lameter &lt;clameter@sgi.com&gt;

---
 include/asm-x86/current.h    |   40 ++++++++++++++++++++++++++++++++++++----
 include/asm-x86/current_32.h |   17 -----------------
 include/asm-x86/current_64.h |   27 ---------------------------
 3 files changed, 36 insertions(+), 48 deletions(-)

Index: linux-next/include/asm-x86/current.h
===================================================================
--- linux-next.orig/include/asm-x86/current.h	2008-05-04 22:33:42.299851061 -0700
+++ linux-next/include/asm-x86/current.h	2008-05-05 11:22:16.531407871 -0700
@@ -1,5 +1,37 @@
+#ifndef _X86_CURRENT_H
+#define _X86_CURRENT_H
+
+struct task_struct;
+
 #ifdef CONFIG_X86_32
-# include "current_32.h"
-#else
-# include "current_64.h"
-#endif
+#include &lt;linux/compiler.h&gt;
+#include &lt;asm/percpu.h&gt;
+
+DECLARE_PER_CPU(struct task_struct *, current_task);
+static __always_inline struct task_struct *get_current(void)
+{
+	return x86_read_percpu(current_task);
+}
+
+#else /* X86_32 */
+
+#ifndef __ASSEMBLY__
+#include &lt;asm/pda.h&gt;
+
+static __always_inline struct task_struct *get_current(void)
+{
+	return read_pda(pcurrent);
+}
+
+#else /* __ASSEMBLY__ */
+
+#include &lt;asm/asm-offsets.h&gt;
+#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* X86_32 */
+
+#define current get_current()
+
+#endif /* X86_CURRENT_H */
Index: linux-next/include/asm-x86/current_32.h
===================================================================
--- linux-next.orig/include/asm-x86/current_32.h	2008-05-04 22:48:44.689850207 -0700
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,17 +0,0 @@
-#ifndef _I386_CURRENT_H
-...
To: Christoph Lameter <clameter@...>
Cc: <travis@...>, <linux-kernel@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>
Date: Tuesday, May 6, 2008 - 8:28 am

applied, thanks Christoph.

	Ingo
--
To: Christoph Lameter <clameter@...>
Cc: <travis@...>, <linux-kernel@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>
Date: Tuesday, May 6, 2008 - 8:51 am

x86.git testing found a build failure due to this patch:

  include/asm/current.h: Assembler messages:
  include/asm/current.h:4: Error: no such instruction: `struct task_struct'

with this config:

  http://redhat.com/~mingo/misc/config-Tue_May__6_14_45_51_CEST_2008.bad

i suspect the __ASSEMBLY__ protections in the unified file are not wide 
enough?

	Ingo
--
To: Ingo Molnar <mingo@...>
Cc: <travis@...>, <linux-kernel@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>
Date: Tuesday, May 6, 2008 - 2:00 pm

Duh. yes. The x86_64 __ASSEMBLY__ protection is no longer there. We could 
move the task_struct def back into the arch specific portion. Sigh.


---
 include/asm-x86/current.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6/include/asm-x86/current.h
===================================================================
--- linux-2.6.orig/include/asm-x86/current.h	2008-05-06 10:58:03.000000000 -0700
+++ linux-2.6/include/asm-x86/current.h	2008-05-06 10:58:40.000000000 -0700
@@ -1,12 +1,12 @@
 #ifndef _X86_CURRENT_H
 #define _X86_CURRENT_H
 
-struct task_struct;
-
 #ifdef CONFIG_X86_32
 #include &lt;linux/compiler.h&gt;
 #include &lt;asm/percpu.h&gt;
 
+struct task_struct;
+
 DECLARE_PER_CPU(struct task_struct *, current_task);
 static __always_inline struct task_struct *get_current(void)
 {
@@ -18,6 +18,8 @@ static __always_inline struct task_struc
 #ifndef __ASSEMBLY__
 #include &lt;asm/pda.h&gt;
 
+struct task_struct;
+
 static __always_inline struct task_struct *get_current(void)
 {
 	return read_pda(pcurrent);
--
Previous thread: Re: [PATCH] mdacon messing up default vc's, set default to vc13-16 again by Roland on Monday, May 5, 2008 - 2:47 pm. (1 message)

Next thread: Re: Hotplug CPU support for Oprofile by Mike Travis on Monday, May 5, 2008 - 3:00 pm. (2 messages)
speck-geostationary