x86: make i8259_64 more _32-like

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b8e05b5677d2b4f3cd218ee90a7332715cb262f
Commit: 2b8e05b5677d2b4f3cd218ee90a7332715cb262f
Parent: f20ebee41882d28c965166e56c1331fbd28778bb
Author: Paul Jimenez [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:29 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:29 2008 +0100

x86: make i8259_64 more _32-like

Howdy! Here's a simple janitorish patch for you:

This patch mainly hinges around two includes and their ramifications:

#include i8259.h  which provides cached_{slave,master}_mask
#include io_ports.h   which provides PIC_{MASTER,SLAVE}_{IMR,CMD}

Adding these two includes and using those half dozen or so definitions
removed 140+ lines of diffs between i8259_32.c and i8259_64.c, thus
making it easier for the real substantitive differences between them to
show up, and hopefully therefore making it easier to eventually merge
the two.  All the warnings that checkpatch.pl throws (missing spaces
after commas and 80 character lines) exist intentionally to match
i8259_32.c.

Signed-off-by: Paul Jimenez [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/i8259_64.c |  154 +++-
 1 files changed, 81 insertions(+), 73 deletions(-)

diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index ba6d572..be82b12 100644
--- a/arch/x86/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
@@ -21,6 +21,7 @@
 #include asm/delay.h
 #include asm/desc.h
 #include asm/apic.h
+#include asm/i8259.h
 
 /*
  * Common place to define all x86 IRQ vectors
@@ -48,7 +49,7 @@
  */
 
 /*
- * The IO-APIC gives us many more interrupt sources. Most of these 
+ * The IO-APIC gives us many more interrupt sources. Most of these
  * are unused but an SMP system is supposed to have enough memory ...
  * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
  * across the spectrum, so we really want to be prepared to get all
@@ -114,11 +115,7 @@ static struct irq_chip i8259A_chip = {
 /*
  * This contains the irq mask for both 8259A irq controllers,
  */
-static unsigned int cached_irq_mask = 0x;
-
-#define __byte(x,y)(((unsigned char *)(y))[x])
-#define cached_21  (__byte(0,cached_irq_mask))
-#define cached_A1  (__byte(1,cached_irq_mask))
+unsigned int cached_irq_mask = 0x;
 
 /*
  * Not all IRQs can be routed through the IO-APIC, eg. on certain (older)
@@ -139,9 +136,9 @@ void disable_8259A_irq(unsigned int irq)
spin_lock_irqsave(i8259A_lock, flags);
cached_irq_mask |= mask;
if (irq  8)
-   outb(cached_A1,0xA1);
+   outb(cached_slave_mask, PIC_SLAVE_IMR);
else
-   outb(cached_21,0x21);
+   outb(cached_master_mask, PIC_MASTER_IMR);
spin_unlock_irqrestore(i8259A_lock, flags);
 }
 
@@ -153,9 +150,9 @@ void enable_8259A_irq(unsigned int irq)
spin_lock_irqsave(i8259A_lock, flags);
cached_irq_mask = mask;
if (irq  8)
-   outb(cached_A1,0xA1);
+   outb(cached_slave_mask, PIC_SLAVE_IMR);
else
-   outb(cached_21,0x21);
+   outb(cached_master_mask, PIC_MASTER_IMR);
spin_unlock_irqrestore(i8259A_lock, flags);
 }
 
@@ -167,9 +164,9 @@ int i8259A_irq_pending(unsigned int irq)
 
spin_lock_irqsave(i8259A_lock, flags);
if (irq  8)
-   ret = inb(0x20)  mask;
+   ret = inb(PIC_MASTER_CMD)  mask;
else
-   ret = inb(0xA0)  (mask  8);
+   ret = inb(PIC_SLAVE_CMD)  (mask  8);
spin_unlock_irqrestore(i8259A_lock, flags);
 
return ret;
@@ -196,14 +193,14 @@ static inline int i8259A_irq_real(unsigned int irq)
int irqmask = 1irq;
 
if (irq  8) {
-   outb(0x0B,0x20);/* ISR register */
-   value = inb(0x20)  irqmask;
-   outb(0x0A,0x20);/* back to the IRR register */
+   outb(0x0B,PIC_MASTER_CMD);  /* ISR register */
+   value = inb(PIC_MASTER_CMD)  irqmask;
+   outb(0x0A,PIC_MASTER_CMD);  /* back to the IRR register */
return value;
}
-   outb(0x0B,0xA0);/* ISR register */
-   value = inb(0xA0)  (irqmask  8);
-   outb(0x0A,0xA0);/* back to the IRR register */
+   outb(0x0B,PIC_SLAVE_CMD);   /* ISR register */
+   value = inb(PIC_SLAVE_CMD)  (irqmask  8);
+   outb(0x0A,PIC_SLAVE_CMD);   /* back to the IRR register */
return value;
 }
 
@@ -240,14 +237,17 @@ static void mask_and_ack_8259A(unsigned int irq)
 
 handle_real_irq:
if (irq  8) {
-   

x86: prepare merger of asm/alternative_{32,64}.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1d8a1f6b51f6b195dfdcf05821be97edede5664a
Commit: 1d8a1f6b51f6b195dfdcf05821be97edede5664a
Parent: 2b8e05b5677d2b4f3cd218ee90a7332715cb262f
Author: H. Peter Anvin [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:30 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:30 2008 +0100

x86: prepare merger of asm/alternative_{32,64}.h

Prepare for merging asm/alternative_{32,64}.h by making the 32- and
64-bit versions textually identical.  This involves:

- removing arbitrary header inclusion differences
- reorganizing the 32-bit version slightly to match the 64-bit version
- using asm/asm.h to unify the assembly code
- renaming struct paravirt_patch to struct paravirt_patch_site in the
  64-bit version to match the 32-bit version; there are no references
  to struct paravirt_patch elsewhere in the tree.

Signed-off-by: H. Peter Anvin [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/alternative_32.h |  131 --
 include/asm-x86/alternative_64.h |   84 
 2 files changed, 112 insertions(+), 103 deletions(-)

diff --git a/include/asm-x86/alternative_32.h b/include/asm-x86/alternative_32.h
index bda6c81..4919b5e 100644
--- a/include/asm-x86/alternative_32.h
+++ b/include/asm-x86/alternative_32.h
@@ -1,23 +1,63 @@
 #ifndef _I386_ALTERNATIVE_H
 #define _I386_ALTERNATIVE_H
 
-#include asm/types.h
-#include linux/stddef.h
 #include linux/types.h
+#include linux/stddef.h
+#include asm/asm.h
+
+/*
+ * Alternative inline assembly for SMP.
+ *
+ * The LOCK_PREFIX macro defined here replaces the LOCK and
+ * LOCK_PREFIX macros used everywhere in the source tree.
+ *
+ * SMP alternatives use the same data structures as the other
+ * alternatives and the X86_FEATURE_UP flag to indicate the case of a
+ * UP system running a SMP kernel.  The existing apply_alternatives()
+ * works fine for patching a SMP kernel for UP.
+ *
+ * The SMP alternative tables can be kept after boot and contain both
+ * UP and SMP versions of the instructions to allow switching back to
+ * SMP at runtime, when hotplugging in a new CPU, which is especially
+ * useful in virtualized environments.
+ *
+ * The very common lock prefix is handled as special case in a
+ * separate table which is a pure address list without replacement ptr
+ * and size information.  That keeps the table sizes small.
+ */
+
+#ifdef CONFIG_SMP
+#define LOCK_PREFIX \
+   .section .smp_locks,\a\\n   \
+   _ASM_ALIGN \n \
+   _ASM_PTR 661f\n /* address */ \
+   .previous\n   \
+   661:\n\tlock; 
+
+#else /* ! CONFIG_SMP */
+#define LOCK_PREFIX 
+#endif
+
+/* This must be included *after* the definition of LOCK_PREFIX */
+#include asm/cpufeature.h
 
 struct alt_instr {
-   u8 *instr;  /* original instruction */
+   u8 *instr;  /* original instruction */
u8 *replacement;
u8  cpuid;  /* cpuid bit set for replacement */
u8  instrlen;   /* length of original instruction */
-   u8  replacementlen; /* length of new instruction, = instrlen */
-   u8  pad;
+   u8  replacementlen; /* length of new instruction, = instrlen */
+   u8  pad1;
+#ifdef CONFIG_X86_64
+   u32 pad2;
+#endif
 };
 
 extern void alternative_instructions(void);
 extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
 
 struct module;
+
 #ifdef CONFIG_SMP
 extern void alternatives_smp_module_add(struct module *mod, char *name,
void *locks, void *locks_end,
@@ -45,17 +85,17 @@ static inline void alternatives_smp_switch(int smp) {}
  * without volatile and memory clobber.
  */
 #define alternative(oldinstr, newinstr, feature)   \
-   asm volatile (661:\n\t oldinstr \n662:\n\
+   asm volatile (661:\n\t oldinstr \n662:\n\
  .section .altinstructions,\a\\n   \
-   .align 4\n\
-   .long 661b\n/* label */   \
-   .long 663f\n/* new instruction */ \
-   .byte %c0\n /* feature bit */ \
-   .byte 662b-661b\n   /* sourcelen */   \
-   .byte 664f-663f\n   /* replacementlen */  \
+ _ASM_ALIGN \n   \
+ _ASM_PTR 661b\n /* label */ \
+ _ASM_PTR 663f\n /* new instruction 

x86: actually merge asm/alternative.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6b59257082e136fbbce1aa017575a451c0df0592
Commit: 6b59257082e136fbbce1aa017575a451c0df0592
Parent: 1d8a1f6b51f6b195dfdcf05821be97edede5664a
Author: H. Peter Anvin [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:30 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:30 2008 +0100

x86: actually merge asm/alternative.h

This actually merges asm-x86/alternative_{32,64}.h into
asm-x86/alternative.h.

Signed-off-by: H. Peter Anvin [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/alternative.h|  166 -
 include/asm-x86/alternative_32.h |  161 
 include/asm-x86/alternative_64.h |  161 
 3 files changed, 161 insertions(+), 327 deletions(-)

diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h
dissimilarity index 85%
index 9eef6a3..d8bacf3 100644
--- a/include/asm-x86/alternative.h
+++ b/include/asm-x86/alternative.h
@@ -1,5 +1,161 @@
-#ifdef CONFIG_X86_32
-# include alternative_32.h
-#else
-# include alternative_64.h
-#endif
+#ifndef _ASM_X86_ALTERNATIVE_H
+#define _ASM_X86_ALTERNATIVE_H
+
+#include linux/types.h
+#include linux/stddef.h
+#include asm/asm.h
+
+/*
+ * Alternative inline assembly for SMP.
+ *
+ * The LOCK_PREFIX macro defined here replaces the LOCK and
+ * LOCK_PREFIX macros used everywhere in the source tree.
+ *
+ * SMP alternatives use the same data structures as the other
+ * alternatives and the X86_FEATURE_UP flag to indicate the case of a
+ * UP system running a SMP kernel.  The existing apply_alternatives()
+ * works fine for patching a SMP kernel for UP.
+ *
+ * The SMP alternative tables can be kept after boot and contain both
+ * UP and SMP versions of the instructions to allow switching back to
+ * SMP at runtime, when hotplugging in a new CPU, which is especially
+ * useful in virtualized environments.
+ *
+ * The very common lock prefix is handled as special case in a
+ * separate table which is a pure address list without replacement ptr
+ * and size information.  That keeps the table sizes small.
+ */
+
+#ifdef CONFIG_SMP
+#define LOCK_PREFIX \
+   .section .smp_locks,\a\\n   \
+   _ASM_ALIGN \n \
+   _ASM_PTR 661f\n /* address */ \
+   .previous\n   \
+   661:\n\tlock; 
+
+#else /* ! CONFIG_SMP */
+#define LOCK_PREFIX 
+#endif
+
+/* This must be included *after* the definition of LOCK_PREFIX */
+#include asm/cpufeature.h
+
+struct alt_instr {
+   u8 *instr;  /* original instruction */
+   u8 *replacement;
+   u8  cpuid;  /* cpuid bit set for replacement */
+   u8  instrlen;   /* length of original instruction */
+   u8  replacementlen; /* length of new instruction, = instrlen */
+   u8  pad1;
+#ifdef CONFIG_X86_64
+   u32 pad2;
+#endif
+};
+
+extern void alternative_instructions(void);
+extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
+
+struct module;
+
+#ifdef CONFIG_SMP
+extern void alternatives_smp_module_add(struct module *mod, char *name,
+   void *locks, void *locks_end,
+   void *text, void *text_end);
+extern void alternatives_smp_module_del(struct module *mod);
+extern void alternatives_smp_switch(int smp);
+#else
+static inline void alternatives_smp_module_add(struct module *mod, char *name,
+   void *locks, void *locks_end,
+   void *text, void *text_end) {}
+static inline void alternatives_smp_module_del(struct module *mod) {}
+static inline void alternatives_smp_switch(int smp) {}
+#endif /* CONFIG_SMP */
+
+/*
+ * Alternative instructions for different CPU types or capabilities.
+ *
+ * This allows to use optimized instructions even on generic binary
+ * kernels.
+ *
+ * length of oldinstr must be longer or equal the length of newinstr
+ * It can be padded with nops as needed.
+ *
+ * For non barrier like inlines please define new variants
+ * without volatile and memory clobber.
+ */
+#define alternative(oldinstr, newinstr, feature)   \
+   asm volatile (661:\n\t oldinstr \n662:\n\
+ .section .altinstructions,\a\\n   \
+ _ASM_ALIGN \n   \
+ _ASM_PTR 661b\n /* label */ \
+ _ASM_PTR 663f\n /* new instruction */   \
+   .byte %c0\n   /* feature bit */   \
+   .byte 

x86 e820_64.c: make 2 functions static

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=013d23e1567c4cebee0a2db5c8fa97b91b34ac2a
Commit: 013d23e1567c4cebee0a2db5c8fa97b91b34ac2a
Parent: 6b59257082e136fbbce1aa017575a451c0df0592
Author: Adrian Bunk [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:30 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:30 2008 +0100

x86 e820_64.c: make 2 functions static

This patch makes the following needlessly global functions static:
- e820_print_map()
- early_panic()

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/e820_64.c |4 ++--
 include/asm-x86/e820_64.h |1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 0128b0b..11a3d65 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -373,7 +373,7 @@ unsigned long __init e820_hole_size(unsigned long start, 
unsigned long end)
return end - start - (ram  PAGE_SHIFT);
 }
 
-void __init e820_print_map(char *who)
+static void __init e820_print_map(char *who)
 {
int i;
 
@@ -633,7 +633,7 @@ static int __init copy_e820_map(struct e820entry *biosmap, 
int nr_map)
return 0;
 }
 
-void early_panic(char *msg)
+static void early_panic(char *msg)
 {
early_printk(msg);
panic(msg);
diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h
index 0bd4787..e535e60 100644
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -21,7 +21,6 @@ extern void contig_e820_setup(void);
 extern unsigned long e820_end_of_ram(void);
 extern void e820_reserve_resources(void);
 extern void e820_mark_nosave_regions(void);
-extern void e820_print_map(char *who);
 extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned 
type);
 extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned 
type);
 extern unsigned long e820_hole_size(unsigned long start, unsigned long end);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 mce_64.c: make struct mcelog static

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=231fd906c5e71219bbc32618a8ed8b439d5dde98
Commit: 231fd906c5e71219bbc32618a8ed8b439d5dde98
Parent: 52e3d90def24008c9b3435a1032d9a7f05766bce
Author: Adrian Bunk [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:30 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:30 2008 +0100

x86 mce_64.c: make struct mcelog static

This patch makes the needlessly global struct mcelog static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/x86/kernel/cpu/mcheck/mce_64.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c 
b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 242e866..8ef6a6b 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -63,7 +63,7 @@ static DECLARE_WAIT_QUEUE_HEAD(mce_wait);
  * separate MCEs from kernel messages to avoid bogus bug reports.
  */
 
-struct mce_log mcelog = {
+static struct mce_log mcelog = {
MCE_LOG_SIGNATURE,
MCE_LOG_LEN,
 };
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: pci-calgary_64.c: make a variable static

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ed65260bb814a5c600a4e883f6bda73e287f5dec
Commit: ed65260bb814a5c600a4e883f6bda73e287f5dec
Parent: 867ab545668385b903f9379019000383675c49b3
Author: Adrian Bunk [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:31 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:31 2008 +0100

x86: pci-calgary_64.c: make a variable static

debugging is a horrible name for a global variable - thankfully it can
become static.

Also put it out of __read_mostly so that gcc no longer has to emit it
at all.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/pci-calgary_64.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 6bf1f71..21d7e0f 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -183,7 +183,7 @@ static struct calgary_bus_info bus_info[MAX_PHB_BUS_NUM] = 
{ { NULL, 0, 0 }, };
 
 /* enable this to stress test the chip's TCE cache */
 #ifdef CONFIG_IOMMU_DEBUG
-int debugging __read_mostly = 1;
+static int debugging = 1;
 
 static inline unsigned long verify_bit_range(unsigned long* bitmap,
int expected, unsigned long start, unsigned long end)
@@ -202,7 +202,7 @@ static inline unsigned long verify_bit_range(unsigned long* 
bitmap,
return ~0UL;
 }
 #else /* debugging is disabled */
-int debugging __read_mostly = 0;
+static int debugging;
 
 static inline unsigned long verify_bit_range(unsigned long* bitmap,
int expected, unsigned long start, unsigned long end)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: pci-dma_64.c: cleanups

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3e7593966be6f6d29a15138c0c96b961d437f2f5
Commit: 3e7593966be6f6d29a15138c0c96b961d437f2f5
Parent: ed65260bb814a5c600a4e883f6bda73e287f5dec
Author: Adrian Bunk [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:31 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:31 2008 +0100

x86: pci-dma_64.c: cleanups

This patch contains the following cleanups:
- make the needlessly global iommu_setup() static
- remove the unused EXPORT_SYMBOL(iommu_merge)

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/pci-dma_64.c |3 +--
 include/asm-x86/pci_64.h |1 -
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 5552d23..a82473d 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -13,7 +13,6 @@
 #include asm/calgary.h
 
 int iommu_merge __read_mostly = 0;
-EXPORT_SYMBOL(iommu_merge);
 
 dma_addr_t bad_dma_address __read_mostly;
 EXPORT_SYMBOL(bad_dma_address);
@@ -230,7 +229,7 @@ EXPORT_SYMBOL(dma_set_mask);
  * See Documentation/x86_64/boot-options.txt for the iommu kernel parameter
  * documentation.
  */
-__init int iommu_setup(char *p)
+static __init int iommu_setup(char *p)
 {
iommu_merge = 1;
 
diff --git a/include/asm-x86/pci_64.h b/include/asm-x86/pci_64.h
index ef54226..3746903 100644
--- a/include/asm-x86/pci_64.h
+++ b/include/asm-x86/pci_64.h
@@ -26,7 +26,6 @@ extern int (*pci_config_write)(int seg, int bus, int dev, int 
fn, int reg, int l
 
 
 extern void pci_iommu_alloc(void);
-extern int iommu_setup(char *opt);
 
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: mtrr use type bool [RESEND AGAIN]

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d2ee8de5f6d26ef2942e0b449aa68d9236d5777
Commit: 2d2ee8de5f6d26ef2942e0b449aa68d9236d5777
Parent: 3e7593966be6f6d29a15138c0c96b961d437f2f5
Author: Paul Jimenez [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:31 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:31 2008 +0100

x86: mtrr use type bool [RESEND AGAIN]

This is a janitorish patch to 1) remove private TRUE/FALSE #def's in
favor of using the standard enum from linux/stddef.h and 2) switch the
variables holding those values to type 'bool' (from linux/types.h)
since it both seems more appropriate and allows for potentially better
optimization.

As a truly minor aside, I removed a couple of comments documenting
a 'do_safe' parameter that seems to no longer exist.

Signed-off-by: Paul Jimenez [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/cpu/mtrr/amd.c |2 --
 arch/x86/kernel/cpu/mtrr/generic.c |   16 +++-
 arch/x86/kernel/cpu/mtrr/if.c  |   15 ---
 arch/x86/kernel/cpu/mtrr/main.c|8 +---
 arch/x86/kernel/cpu/mtrr/mtrr.h|6 ++
 include/asm-x86/mtrr.h |8 
 6 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/amd.c b/arch/x86/kernel/cpu/mtrr/amd.c
index 0949cdb..ee2331b 100644
--- a/arch/x86/kernel/cpu/mtrr/amd.c
+++ b/arch/x86/kernel/cpu/mtrr/amd.c
@@ -53,8 +53,6 @@ static void amd_set_mtrr(unsigned int reg, unsigned long base,
 base The base address of the region.
 size The size of the region. If this is 0 the region is disabled.
 type The type of the region.
-do_safe If TRUE, do the change safely. If FALSE, safety measures should
-be done externally.
 [RETURNS] Nothing.
 */
 {
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c 
b/arch/x86/kernel/cpu/mtrr/generic.c
index 992f08d..1c331c3 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -188,7 +188,7 @@ static inline void k8_enable_fixed_iorrs(void)
  * \param changed pointer which indicates whether the MTRR needed to be changed
  * \param msrwords pointer to the MSR values which the MSR should have
  */
-static void set_fixed_range(int msr, int * changed, unsigned int * msrwords)
+static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
 {
unsigned lo, hi;
 
@@ -200,7 +200,7 @@ static void set_fixed_range(int msr, int * changed, 
unsigned int * msrwords)
((msrwords[0] | msrwords[1])  K8_MTRR_RDMEM_WRMEM_MASK))
k8_enable_fixed_iorrs();
mtrr_wrmsr(msr, msrwords[0], msrwords[1]);
-   *changed = TRUE;
+   *changed = true;
}
 }
 
@@ -260,7 +260,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned 
long *base,
 static int set_fixed_ranges(mtrr_type * frs)
 {
unsigned long long *saved = (unsigned long long *) frs;
-   int changed = FALSE;
+   bool changed = false;
int block=-1, range;
 
while (fixed_range_blocks[++block].ranges)
@@ -273,17 +273,17 @@ static int set_fixed_ranges(mtrr_type * frs)
 
 /*  Set the MSR pair relating to a var range. Returns TRUE if
 changes are made  */
-static int set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr)
+static bool set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr)
 {
unsigned int lo, hi;
-   int changed = FALSE;
+   bool changed = false;
 
rdmsr(MTRRphysBase_MSR(index), lo, hi);
if ((vr-base_lo  0xf0ffUL) != (lo  0xf0ffUL)
|| (vr-base_hi  (size_and_mask  (32 - PAGE_SHIFT))) !=
(hi  (size_and_mask  (32 - PAGE_SHIFT {
mtrr_wrmsr(MTRRphysBase_MSR(index), vr-base_lo, vr-base_hi);
-   changed = TRUE;
+   changed = true;
}
 
rdmsr(MTRRphysMask_MSR(index), lo, hi);
@@ -292,7 +292,7 @@ static int set_mtrr_var_ranges(unsigned int index, struct 
mtrr_var_range *vr)
|| (vr-mask_hi  (size_and_mask  (32 - PAGE_SHIFT))) !=
(hi  (size_and_mask  (32 - PAGE_SHIFT {
mtrr_wrmsr(MTRRphysMask_MSR(index), vr-mask_lo, vr-mask_hi);
-   changed = TRUE;
+   changed = true;
}
return changed;
 }
@@ -417,8 +417,6 @@ static void generic_set_mtrr(unsigned int reg, unsigned 
long base,
 base The base address of the region.
 size The size of the region. If this is 0 the region is disabled.
 type The type of the region.
-do_safe If TRUE, do the change safely. If FALSE, safety measures should
-be done externally.
 [RETURNS] Nothing.
 */
 {
diff --git 

x86: remove duplicate includes

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=201c19948b879ed95ac986bc994af29d7cf4859f
Commit: 201c19948b879ed95ac986bc994af29d7cf4859f
Parent: 2d2ee8de5f6d26ef2942e0b449aa68d9236d5777
Author: Lucas Woods [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:32 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:32 2008 +0100

x86: remove duplicate includes

Signed-off-by: Lucas Woods [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/hpet.c   |1 -
 arch/x86/kernel/pci-calgary_64.c |1 -
 arch/x86/vdso/vclock_gettime.c   |1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index a3c56c9..5c17027 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -6,7 +6,6 @@
 #include linux/init.h
 #include linux/sysdev.h
 #include linux/pm.h
-#include linux/delay.h
 
 #include asm/fixmap.h
 #include asm/hpet.h
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 21d7e0f..21f34db 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -30,7 +30,6 @@
 #include linux/spinlock.h
 #include linux/string.h
 #include linux/dma-mapping.h
-#include linux/init.h
 #include linux/bitops.h
 #include linux/pci_ids.h
 #include linux/pci.h
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 5b54cdf..23476c2 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -19,7 +19,6 @@
 #include asm/hpet.h
 #include asm/unistd.h
 #include asm/io.h
-#include asm/vgtod.h
 #include vextern.h
 
 #define gtod vdso_vsyscall_gtod_data
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: remove dead code in ia32-emu

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9773db2a301b089bb95907eec5ad1a2ef7fb4099
Commit: 9773db2a301b089bb95907eec5ad1a2ef7fb4099
Parent: 201c19948b879ed95ac986bc994af29d7cf4859f
Author: Cyrill Gorcunov [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:32 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:32 2008 +0100

x86: remove dead code in ia32-emu

Remove useless second time checking of fsave argument in save_i387_ia32()
routine.  It's possible the compiler is doing the same but that is much
better to remove the dead code explicitly.

Signed-off-by: Cyrill Gorcunov [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/fpu32.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/fpu32.c b/arch/x86/ia32/fpu32.c
index 459bf74..ae80745 100644
--- a/arch/x86/ia32/fpu32.c
+++ b/arch/x86/ia32/fpu32.c
@@ -174,8 +174,6 @@ int save_i387_ia32(struct task_struct *tsk, struct 
_fpstate_ia32 __user *buf,
if (fsave)
return 0;
err |= __put_user(tsk-thread.i387.fxsave.swd, buf-status);
-   if (fsave)
-   return err ? -1 : 1;
err |= __put_user(X86_FXSR_MAGIC, buf-magic);
err |= __copy_to_user(buf-_fxsr_env[0], tsk-thread.i387.fxsave,
  sizeof(struct i387_fxsave_struct));
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: remove extern declarations for code, data, bss resources

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9cce83dd1d59f52e2c8f8c7d265ba4854c40785
Commit: c9cce83dd1d59f52e2c8f8c7d265ba4854c40785
Parent: 9773db2a301b089bb95907eec5ad1a2ef7fb4099
Author: Bernhard Walle [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:32 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:32 2008 +0100

x86: remove extern declarations for code, data, bss resources

This patch removes the extern struct resource declarations for
data_resource, code_resource and bss_resource on x86 and declares that
three structures as static as done on other architectures like IA64.

On i386, these structures are moved to setup_32.c (from e820_32.c) because
that's code that is not specific to e820 and also required on EFI systems.
That makes the extern reference superfluous.

On x86_64, data_resource, code_resource and bss_resource are passed to
e820_reserve_resources() as arguments just as done on i386 and IA64.  That
also avoids the extern reference and it's possible to make it static.

Signed-off-by: Bernhard Walle [EMAIL PROTECTED]
Cc: Luck, Tony [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/e820_32.c  |  110 +--
 arch/x86/kernel/e820_64.c  |   11 ++--
 arch/x86/kernel/setup_32.c |  106 +-
 arch/x86/kernel/setup_64.c |8 ++--
 include/asm-x86/e820_32.h  |6 ++
 include/asm-x86/e820_64.h  |5 ++-
 include/linux/ioport.h |2 +
 7 files changed, 127 insertions(+), 121 deletions(-)

diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index 18f500d..87cadc8 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -37,26 +37,6 @@ unsigned long pci_mem_start = 0x1000;
 EXPORT_SYMBOL(pci_mem_start);
 #endif
 extern int user_defined_memmap;
-struct resource data_resource = {
-   .name   = Kernel data,
-   .start  = 0,
-   .end= 0,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-struct resource code_resource = {
-   .name   = Kernel code,
-   .start  = 0,
-   .end= 0,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-struct resource bss_resource = {
-   .name   = Kernel bss,
-   .start  = 0,
-   .end= 0,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
-};
 
 static struct resource system_rom_resource = {
.name   = System ROM,
@@ -111,60 +91,6 @@ static struct resource video_rom_resource = {
.flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
 };
 
-static struct resource video_ram_resource = {
-   .name   = Video RAM area,
-   .start  = 0xa,
-   .end= 0xb,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-static struct resource standard_io_resources[] = { {
-   .name   = dma1,
-   .start  = 0x,
-   .end= 0x001f,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = pic1,
-   .start  = 0x0020,
-   .end= 0x0021,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = timer0,
-   .start  = 0x0040,
-   .end= 0x0043,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = timer1,
-   .start  = 0x0050,
-   .end= 0x0053,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = keyboard,
-   .start  = 0x0060,
-   .end= 0x006f,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = dma page reg,
-   .start  = 0x0080,
-   .end= 0x008f,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = pic2,
-   .start  = 0x00a0,
-   .end= 0x00a1,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = dma2,
-   .start  = 0x00c0,
-   .end= 0x00df,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-}, {
-   .name   = fpu,
-   .start  = 0x00f0,
-   .end= 0x00ff,
-   .flags  = IORESOURCE_BUSY | IORESOURCE_IO
-} };
-
 #define ROMSIGNATURE 0xaa55
 
 static int __init romsignature(const unsigned char *rom)
@@ -260,10 +186,9 @@ static void __init probe_roms(void)
  * Request address space for all standard RAM and ROM resources
  * and also for regions reported as reserved by the e820.
  */
-static void __init
-legacy_init_iomem_resources(struct resource *code_resource,
-   struct resource *data_resource,
-   struct resource *bss_resource)
+void __init legacy_init_iomem_resources(struct resource *code_resource,
+   struct resource *data_resource,
+   struct resource *bss_resource)
 {
int i;
 
@@ -305,35 +230,6 

x86: bitops_32.h style cleanups

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ec12fa5c80126b252ebcb474d12c832ec4647daa
Commit: ec12fa5c80126b252ebcb474d12c832ec4647daa
Parent: c9cce83dd1d59f52e2c8f8c7d265ba4854c40785
Author: Randy Dunlap [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:32 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:32 2008 +0100

x86: bitops_32.h style cleanups

Coding style cleanups in x86/bitops_32.h:

- drop space in * addr
- whitespace  indentation fixes
- spello fixes

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/bitops_32.h |   48 +-
 1 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h
index 0b40f6d..5a29cce 100644
--- a/include/asm-x86/bitops_32.h
+++ b/include/asm-x86/bitops_32.h
@@ -37,7 +37,7 @@
  * Note that @nr may be almost arbitrarily large; this function is not
  * restricted to acting on a single-word quantity.
  */
-static inline void set_bit(int nr, volatile unsigned long * addr)
+static inline void set_bit(int nr, volatile unsigned long *addr)
 {
__asm__ __volatile__( LOCK_PREFIX
btsl %1,%0
@@ -54,7 +54,7 @@ static inline void set_bit(int nr, volatile unsigned long * 
addr)
  * If it's called on the same region of memory simultaneously, the effect
  * may be that only one operation succeeds.
  */
-static inline void __set_bit(int nr, volatile unsigned long * addr)
+static inline void __set_bit(int nr, volatile unsigned long *addr)
 {
__asm__(
btsl %1,%0
@@ -72,7 +72,7 @@ static inline void __set_bit(int nr, volatile unsigned long * 
addr)
  * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
  * in order to ensure changes are visible on other processors.
  */
-static inline void clear_bit(int nr, volatile unsigned long * addr)
+static inline void clear_bit(int nr, volatile unsigned long *addr)
 {
__asm__ __volatile__( LOCK_PREFIX
btrl %1,%0
@@ -94,7 +94,7 @@ static inline void clear_bit_unlock(unsigned long nr, 
volatile unsigned long *ad
clear_bit(nr, addr);
 }
 
-static inline void __clear_bit(int nr, volatile unsigned long * addr)
+static inline void __clear_bit(int nr, volatile unsigned long *addr)
 {
__asm__ __volatile__(
btrl %1,%0
@@ -132,7 +132,7 @@ static inline void __clear_bit_unlock(unsigned long nr, 
volatile unsigned long *
  * If it's called on the same region of memory simultaneously, the effect
  * may be that only one operation succeeds.
  */
-static inline void __change_bit(int nr, volatile unsigned long * addr)
+static inline void __change_bit(int nr, volatile unsigned long *addr)
 {
__asm__ __volatile__(
btcl %1,%0
@@ -150,7 +150,7 @@ static inline void __change_bit(int nr, volatile unsigned 
long * addr)
  * Note that @nr may be almost arbitrarily large; this function is not
  * restricted to acting on a single-word quantity.
  */
-static inline void change_bit(int nr, volatile unsigned long * addr)
+static inline void change_bit(int nr, volatile unsigned long *addr)
 {
__asm__ __volatile__( LOCK_PREFIX
btcl %1,%0
@@ -167,7 +167,7 @@ static inline void change_bit(int nr, volatile unsigned 
long * addr)
  * It may be reordered on other architectures than x86.
  * It also implies a memory barrier.
  */
-static inline int test_and_set_bit(int nr, volatile unsigned long * addr)
+static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
 {
int oldbit;
 
@@ -199,7 +199,7 @@ static inline int test_and_set_bit_lock(int nr, volatile 
unsigned long *addr)
  * If two examples of this operation race, one can appear to succeed
  * but actually fail.  You must protect multiple accesses with a lock.
  */
-static inline int __test_and_set_bit(int nr, volatile unsigned long * addr)
+static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
 {
int oldbit;
 
@@ -219,7 +219,7 @@ static inline int __test_and_set_bit(int nr, volatile 
unsigned long * addr)
  * It can be reorderdered on other architectures other than x86.
  * It also implies a memory barrier.
  */
-static inline int test_and_clear_bit(int nr, volatile unsigned long * addr)
+static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
 {
int oldbit;
 
@@ -270,7 +270,7 @@ static inline int __test_and_change_bit(int nr, volatile 
unsigned long *addr)
  * This operation is atomic and cannot be reordered.  
  * It also implies a memory barrier.
  */
-static inline int test_and_change_bit(int nr, volatile unsigned long* addr)
+static 

x86: clean up stack allocation and free

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6ea8bad1c06c8ccde381f1c848afe6a245bb33b5
Commit: 6ea8bad1c06c8ccde381f1c848afe6a245bb33b5
Parent: ec12fa5c80126b252ebcb474d12c832ec4647daa
Author: [EMAIL PROTECTED] [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:32 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:32 2008 +0100

x86: clean up stack allocation and free

Clean up the allocation and freeing of stacks a bit by using a __GFP_ZERO 
flag
instead of memset.

Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Mike Travis [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/thread_info_64.h |   16 +---
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index 7f6ee68..1ac23c1 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -74,20 +74,14 @@ static inline struct thread_info *stack_thread_info(void)
 
 /* thread information allocation */
 #ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info(tsk) \
-({ \
-   struct thread_info *ret;\
-   \
-   ret = ((struct thread_info *) 
__get_free_pages(GFP_KERNEL,THREAD_ORDER)); \
-   if (ret)\
-   memset(ret, 0, THREAD_SIZE);\
-   ret;\
-})
+#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
 #else
-#define alloc_thread_info(tsk) \
-   ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define THREAD_FLAGS GFP_KERNEL
 #endif
 
+#define alloc_thread_info(tsk) \
+   ((struct thread_info *) __get_free_pages(THREAD_FLAGS, THREAD_ORDER))
+
 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
 
 #else /* !__ASSEMBLY__ */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: clean up nmi_32/64.c

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=416b72182ac3f3f4931ed17d0256b1d805d1b553
Commit: 416b72182ac3f3f4931ed17d0256b1d805d1b553
Parent: 6ea8bad1c06c8ccde381f1c848afe6a245bb33b5
Author: Hiroshi Shimamoto [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:33 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:33 2008 +0100

x86: clean up nmi_32/64.c

clean up and make nmi_32/64.c more similar.
- white space and coding style clean up.
- nmi_cpu_busy is available on CONFIG_SMP.
- move functions __acpi_nmi_enable, acpi_nmi_enable,
  __acpi_nmi_disable and acpi_nmi_disable.
- make variables name more similar.

Signed-off-by: Hiroshi Shimamoto [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/nmi_32.c |   14 ---
 arch/x86/kernel/nmi_64.c |   95 +++---
 2 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 4f4bfd3..edd4136 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -51,13 +51,13 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, 
int cpu);
 
 static int endflag __initdata = 0;
 
+#ifdef CONFIG_SMP
 /* The performance counters used by NMI_LOCAL_APIC don't trigger when
  * the CPU is idle. To make sure the NMI watchdog really ticks on all
  * CPUs during the test make them busy.
  */
 static __init void nmi_cpu_busy(void *data)
 {
-#ifdef CONFIG_SMP
local_irq_enable_in_hardirq();
/* Intentionally don't use cpu_relax here. This is
   to make sure that the performance counter really ticks,
@@ -67,8 +67,8 @@ static __init void nmi_cpu_busy(void *data)
   care if they get somewhat less cycles. */
while (endflag == 0)
mb();
-#endif
 }
+#endif
 
 static int __init check_nmi_watchdog(void)
 {
@@ -87,11 +87,13 @@ static int __init check_nmi_watchdog(void)
 
printk(KERN_INFO Testing NMI watchdog ... );
 
+#ifdef CONFIG_SMP
if (nmi_watchdog == NMI_LOCAL_APIC)
smp_call_function(nmi_cpu_busy, (void *)endflag, 0, 0);
+#endif
 
for_each_possible_cpu(cpu)
-   prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
+   prev_nmi_count[cpu] = nmi_count(cpu);
local_irq_enable();
mdelay((20*1000)/nmi_hz); // wait 20 ticks
 
@@ -237,10 +239,10 @@ void acpi_nmi_disable(void)
on_each_cpu(__acpi_nmi_disable, NULL, 0, 1);
 }
 
-void setup_apic_nmi_watchdog (void *unused)
+void setup_apic_nmi_watchdog(void *unused)
 {
if (__get_cpu_var(wd_enabled))
-   return;
+   return;
 
/* cheap hack to support suspend/resume */
/* if cpu0 is not active neither should the other cpus */
@@ -329,7 +331,7 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, 
unsigned reason)
unsigned int sum;
int touched = 0;
int cpu = smp_processor_id();
-   int rc=0;
+   int rc = 0;
 
/* check for other users first */
if (notify_die(DIE_NMI, nmi, regs, reason, 2, SIGINT)
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index 53faef6..fb99484 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -78,22 +78,22 @@ static __init void nmi_cpu_busy(void *data)
 }
 #endif
 
-int __init check_nmi_watchdog (void)
+int __init check_nmi_watchdog(void)
 {
-   int *counts;
+   int *prev_nmi_count;
int cpu;
 
-   if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED)) 
+   if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
return 0;
 
if (!atomic_read(nmi_active))
return 0;
 
-   counts = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
-   if (!counts)
+   prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
+   if (!prev_nmi_count)
return -1;
 
-   printk(KERN_INFO testing NMI watchdog ... );
+   printk(KERN_INFO Testing NMI watchdog ... );
 
 #ifdef CONFIG_SMP
if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -101,30 +101,29 @@ int __init check_nmi_watchdog (void)
 #endif
 
for (cpu = 0; cpu  NR_CPUS; cpu++)
-   counts[cpu] = cpu_pda(cpu)-__nmi_count;
+   prev_nmi_count[cpu] = cpu_pda(cpu)-__nmi_count;
local_irq_enable();
mdelay((20*1000)/nmi_hz); // wait 20 ticks
 
for_each_online_cpu(cpu) {
if (!per_cpu(wd_enabled, cpu))
continue;
-   if (cpu_pda(cpu)-__nmi_count - counts[cpu] = 5) {
+   if (cpu_pda(cpu)-__nmi_count - prev_nmi_count[cpu] = 5) {
printk(KERN_WARNING WARNING: CPU#%d: NMI 
   appears to be stuck (%d-%d)!\n,
-  

x86: irqflags consolidation

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6abcd98ffafbff81f0bfd7ee1d129e634af13245
Commit: 6abcd98ffafbff81f0bfd7ee1d129e634af13245
Parent: 416b72182ac3f3f4931ed17d0256b1d805d1b553
Author: Glauber de Oliveira Costa [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:33 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:33 2008 +0100

x86: irqflags consolidation

This patch consolidates the irqflags include files containing common
paravirt definitions. The native definition for interrupt handling, halt,
and such, are the same for 32 and 64 bit, and they are kept in irqflags.h.
the differences are split in the arch-specific files.

The syscall function, irq_enable_sysexit, has a very specific i386 naming,
and its name is then changed to a more general one.

Signed-off-by: Glauber de Oliveira Costa [EMAIL PROTECTED]
Signed-off-by: Steven Rostedt [EMAIL PROTECTED]
Acked-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/asm-offsets_32.c |2 +-
 arch/x86/kernel/entry_32.S   |8 +-
 arch/x86/kernel/paravirt_32.c|   10 +-
 arch/x86/kernel/vmi_32.c |4 +-
 arch/x86/xen/enlighten.c |2 +-
 include/asm-x86/irqflags.h   |  250 +-
 include/asm-x86/irqflags_32.h|  195 -
 include/asm-x86/irqflags_64.h|  174 --
 include/asm-x86/paravirt.h   |9 +-
 9 files changed, 263 insertions(+), 391 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 0e45981..c1ccfab 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -123,7 +123,7 @@ void foo(void)
OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
-   OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
+   OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, 
irq_enable_syscall_ret);
OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
 #endif
 
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index dc7f938..d63609d 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -58,7 +58,7 @@
  * for paravirtualization.  The following will never clobber any registers:
  *   INTERRUPT_RETURN (aka. iret)
  *   GET_CR0_INTO_EAX (aka. movl %cr0, %eax)
- *   ENABLE_INTERRUPTS_SYSEXIT (aka sti; sysexit).
+ *   ENABLE_INTERRUPTS_SYSCALL_RET (aka sti; sysexit).
  *
  * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka cli/sti), you must
  * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
@@ -351,7 +351,7 @@ sysenter_past_esp:
xorl %ebp,%ebp
TRACE_IRQS_ON
 1: mov  PT_FS(%esp), %fs
-   ENABLE_INTERRUPTS_SYSEXIT
+   ENABLE_INTERRUPTS_SYSCALL_RET
CFI_ENDPROC
 .pushsection .fixup,ax
 2: movl $0,PT_FS(%esp)
@@ -882,10 +882,10 @@ ENTRY(native_iret)
 .previous
 END(native_iret)
 
-ENTRY(native_irq_enable_sysexit)
+ENTRY(native_irq_enable_syscall_ret)
sti
sysexit
-END(native_irq_enable_sysexit)
+END(native_irq_enable_syscall_ret)
 #endif
 
 KPROBE_ENTRY(int3)
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index f500079..706b056 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -60,7 +60,7 @@ DEF_NATIVE(pv_irq_ops, irq_enable, sti);
 DEF_NATIVE(pv_irq_ops, restore_fl, push %eax; popf);
 DEF_NATIVE(pv_irq_ops, save_fl, pushf; pop %eax);
 DEF_NATIVE(pv_cpu_ops, iret, iret);
-DEF_NATIVE(pv_cpu_ops, irq_enable_sysexit, sti; sysexit);
+DEF_NATIVE(pv_cpu_ops, irq_enable_syscall_ret, sti; sysexit);
 DEF_NATIVE(pv_mmu_ops, read_cr2, mov %cr2, %eax);
 DEF_NATIVE(pv_mmu_ops, write_cr3, mov %eax, %cr3);
 DEF_NATIVE(pv_mmu_ops, read_cr3, mov %cr3, %eax);
@@ -88,7 +88,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void 
*ibuf,
SITE(pv_irq_ops, restore_fl);
SITE(pv_irq_ops, save_fl);
SITE(pv_cpu_ops, iret);
-   SITE(pv_cpu_ops, irq_enable_sysexit);
+   SITE(pv_cpu_ops, irq_enable_syscall_ret);
SITE(pv_mmu_ops, read_cr2);
SITE(pv_mmu_ops, read_cr3);
SITE(pv_mmu_ops, write_cr3);
@@ -186,7 +186,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void 
*insnbuf,
/* If the operation is a nop, then nop the callsite */
ret = paravirt_patch_nop();
else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
-type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit))
+type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_syscall_ret))
/* If 

x86: consolidate spinlock.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2fed0c507cf0101d511366f36e8573f403dbfea5
Commit: 2fed0c507cf0101d511366f36e8573f403dbfea5
Parent: 6abcd98ffafbff81f0bfd7ee1d129e634af13245
Author: Glauber de Oliveira Costa [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:33 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:33 2008 +0100

x86: consolidate spinlock.h

The cli and sti instructions need to be replaced by paravirt hooks.
For the i386 architecture, this is already done. The code requirements
aren't much different from x86_64 POV, so this part is consolidated in
the common header

Signed-off-by: Glauber de Oliveira Costa [EMAIL PROTECTED]
Signed-off-by: Steven Rostedt [EMAIL PROTECTED]
Acked-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/spinlock.h|   14 
 include/asm-x86/spinlock_32.h |   71 +++--
 include/asm-x86/spinlock_64.h |   37 ++---
 3 files changed, 64 insertions(+), 58 deletions(-)

diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
index d74d85e..e1d555a 100644
--- a/include/asm-x86/spinlock.h
+++ b/include/asm-x86/spinlock.h
@@ -1,5 +1,19 @@
+#ifndef _X86_SPINLOCK_H_
+#define _X86_SPINLOCK_H_
+
+#ifdef CONFIG_PARAVIRT
+#include asm/paravirt.h
+#else
+#define CLI_STRING cli
+#define STI_STRING sti
+#define CLI_STI_CLOBBERS
+#define CLI_STI_INPUT_ARGS
+#endif /* CONFIG_PARAVIRT */
+
 #ifdef CONFIG_X86_32
 # include spinlock_32.h
 #else
 # include spinlock_64.h
 #endif
+
+#endif
diff --git a/include/asm-x86/spinlock_32.h b/include/asm-x86/spinlock_32.h
index d3bcebe..c42c3f1 100644
--- a/include/asm-x86/spinlock_32.h
+++ b/include/asm-x86/spinlock_32.h
@@ -5,16 +5,6 @@
 #include asm/rwlock.h
 #include asm/page.h
 #include asm/processor.h
-#include linux/compiler.h
-
-#ifdef CONFIG_PARAVIRT
-#include asm/paravirt.h
-#else
-#define CLI_STRING cli
-#define STI_STRING sti
-#define CLI_STI_CLOBBERS
-#define CLI_STI_INPUT_ARGS
-#endif /* CONFIG_PARAVIRT */
 
 /*
  * Your basic SMP spinlocks, allowing only a single CPU anywhere
@@ -27,23 +17,24 @@
  * (the type definitions are in asm/spinlock_types.h)
  */
 
-static inline int __raw_spin_is_locked(raw_spinlock_t *x)
+static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
 {
-   return *(volatile signed char *)((x)-slock) = 0;
+   return *(volatile signed char *)((lock)-slock) = 0;
 }
 
 static inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
-   asm volatile(\n1:\t
-LOCK_PREFIX  ; decb %0\n\t
-jns 3f\n
-2:\t
-rep;nop\n\t
-cmpb $0,%0\n\t
-jle 2b\n\t
-jmp 1b\n
-3:\n\t
-: +m (lock-slock) : : memory);
+   asm volatile(
+   \n1:\t
+   LOCK_PREFIX  ; decb %0\n\t
+   jns 3f\n
+   2:\t
+   rep;nop\n\t
+   cmpb $0,%0\n\t
+   jle 2b\n\t
+   jmp 1b\n
+   3:\n\t
+   : +m (lock-slock) : : memory);
 }
 
 /*
@@ -55,7 +46,8 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
  * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use this variant.
  */
 #ifndef CONFIG_PROVE_LOCKING
-static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long 
flags)
+static inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
+unsigned long flags)
 {
asm volatile(
\n1:\t
@@ -79,18 +71,20 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t 
*lock, unsigned long fla
5:\n\t
: [slock] +m (lock-slock)
: [flags] r (flags)
- CLI_STI_INPUT_ARGS
+ CLI_STI_INPUT_ARGS
: memory CLI_STI_CLOBBERS);
 }
 #endif
 
 static inline int __raw_spin_trylock(raw_spinlock_t *lock)
 {
-   char oldval;
+   signed char oldval;
+
asm volatile(
xchgb %b0,%1
:=q (oldval), +m (lock-slock)
:0 (0) : memory);
+
return oldval  0;
 }
 
@@ -112,7 +106,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
 
 static inline void __raw_spin_unlock(raw_spinlock_t *lock)
 {
-   char oldval = 1;
+   unsigned char oldval = 1;
 
asm volatile(xchgb %b0, %1
 : =q (oldval), +m (lock-slock)
@@ -139,31 +133,16 @@ static inline void __raw_spin_unlock_wait(raw_spinlock_t 
*lock)
  *
  * On x86, we implement read-write locks as a 32-bit counter
  * with the high bit (sign) being the contended bit.
- *
- * The inline 

x86: fix asm constraints in spinlock_32/64.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a33fff3a033f2e8a930067ad608c21e1f86bffab
Commit: a33fff3a033f2e8a930067ad608c21e1f86bffab
Parent: 2fed0c507cf0101d511366f36e8573f403dbfea5
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:34 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:34 2008 +0100

x86: fix asm constraints in spinlock_32/64.h

Use the correct constraints for the spinlock assembler functions.

read (modify) write functions need +m instead of =m

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/spinlock_32.h |2 +-
 include/asm-x86/spinlock_64.h |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/asm-x86/spinlock_32.h b/include/asm-x86/spinlock_32.h
index c42c3f1..fca124a 100644
--- a/include/asm-x86/spinlock_32.h
+++ b/include/asm-x86/spinlock_32.h
@@ -99,7 +99,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
 
 static inline void __raw_spin_unlock(raw_spinlock_t *lock)
 {
-   asm volatile(movb $1,%0 : +m (lock-slock) :: memory);
+   asm volatile(movb $1,%0 : =m (lock-slock) :: memory);
 }
 
 #else
diff --git a/include/asm-x86/spinlock_64.h b/include/asm-x86/spinlock_64.h
index 3b5adf9..e81f6c1 100644
--- a/include/asm-x86/spinlock_64.h
+++ b/include/asm-x86/spinlock_64.h
@@ -34,7 +34,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
jle 3b\n\t
jmp 1b\n
2:\t
-   : =m (lock-slock) : : memory);
+   : +m (lock-slock) : : memory);
 }
 
 /*
@@ -80,7 +80,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
 
asm volatile(
xchgl %0,%1
-   :=q (oldval), =m (lock-slock)
+   :=q (oldval), +m (lock-slock)
:0 (0) : memory);
 
return oldval  0;
@@ -162,13 +162,13 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
 
 static inline void __raw_read_unlock(raw_rwlock_t *rw)
 {
-   asm volatile(LOCK_PREFIX incl %0 :=m (rw-lock) : : memory);
+   asm volatile(LOCK_PREFIX incl %0 :+m (rw-lock) : : memory);
 }
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-   asm volatile(LOCK_PREFIX addl $ RW_LOCK_BIAS_STR ,%0
-   : =m (rw-lock) : : memory);
+   asm volatile(LOCK_PREFIX addl $ RW_LOCK_BIAS_STR , %0
+   : +m (rw-lock) : : memory);
 }
 
 #define _raw_spin_relax(lock)  cpu_relax()
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: use immediates instead of RW_LOCK_BIAS_STR

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6514f93a2ce643ef5914eae7ce49b978e1d356aa
Commit: 6514f93a2ce643ef5914eae7ce49b978e1d356aa
Parent: a33fff3a033f2e8a930067ad608c21e1f86bffab
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:34 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:34 2008 +0100

x86: use immediates instead of RW_LOCK_BIAS_STR

Use immediate instead of the RW_LOCK_BIAS_STR.
Makes the code more readable and gets rid of the string constant.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/rwlock.h  |1 -
 include/asm-x86/spinlock_32.h |8 
 include/asm-x86/spinlock_64.h |6 +++---
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/include/asm-x86/rwlock.h b/include/asm-x86/rwlock.h
index f2b64a4..6a8c0d6 100644
--- a/include/asm-x86/rwlock.h
+++ b/include/asm-x86/rwlock.h
@@ -2,7 +2,6 @@
 #define _ASM_X86_RWLOCK_H
 
 #define RW_LOCK_BIAS0x0100
-#define RW_LOCK_BIAS_STR   0x0100
 
 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */
 
diff --git a/include/asm-x86/spinlock_32.h b/include/asm-x86/spinlock_32.h
index fca124a..e7a14ab 100644
--- a/include/asm-x86/spinlock_32.h
+++ b/include/asm-x86/spinlock_32.h
@@ -156,11 +156,11 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
 
 static inline void __raw_write_lock(raw_rwlock_t *rw)
 {
-   asm volatile(LOCK_PREFIX  subl $ RW_LOCK_BIAS_STR ,(%0)\n\t
+   asm volatile(LOCK_PREFIX  subl %1,(%0)\n\t
 jz 1f\n
 call __write_lock_failed\n\t
 1:\n
-::a (rw) : memory);
+::a (rw), i (RW_LOCK_BIAS) : memory);
 }
 
 static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -191,8 +191,8 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-   asm volatile(LOCK_PREFIX addl $ RW_LOCK_BIAS_STR , %0
-: +m (rw-lock) : : memory);
+   asm volatile(LOCK_PREFIX addl %1, %0
+: +m (rw-lock) : i (RW_LOCK_BIAS) : memory);
 }
 
 #define _raw_spin_relax(lock)  cpu_relax()
diff --git a/include/asm-x86/spinlock_64.h b/include/asm-x86/spinlock_64.h
index e81f6c1..ab50e7f 100644
--- a/include/asm-x86/spinlock_64.h
+++ b/include/asm-x86/spinlock_64.h
@@ -127,7 +127,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
 jns 1f\n
 call __read_lock_failed\n\t
 1:\n
-::D (rw), i (RW_LOCK_BIAS) : memory);
+::D (rw) : memory);
 }
 
 static inline void __raw_write_lock(raw_rwlock_t *rw)
@@ -167,8 +167,8 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-   asm volatile(LOCK_PREFIX addl $ RW_LOCK_BIAS_STR , %0
-   : +m (rw-lock) : : memory);
+   asm volatile(LOCK_PREFIX addl %1, %0
+: +m (rw-lock) : i (RW_LOCK_BIAS) : memory);
 }
 
 #define _raw_spin_relax(lock)  cpu_relax()
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: spinlock_32/64 match the jump labels and symbols

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b23ed84ec34f04f54f7d5b1e35f258d64a7a5fb
Commit: 3b23ed84ec34f04f54f7d5b1e35f258d64a7a5fb
Parent: 6514f93a2ce643ef5914eae7ce49b978e1d356aa
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:34 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:34 2008 +0100

x86: spinlock_32/64 match the jump labels and symbols

Match the jump labels in  the 32/64 variants and switch the
64bit version to symbols, so the functions are almost identical
except for the operand size now.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/spinlock_32.h |1 -
 include/asm-x86/spinlock_64.h |   21 +++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/asm-x86/spinlock_32.h b/include/asm-x86/spinlock_32.h
index e7a14ab..4ef626d 100644
--- a/include/asm-x86/spinlock_32.h
+++ b/include/asm-x86/spinlock_32.h
@@ -53,7 +53,6 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
\n1:\t
LOCK_PREFIX  ; decb %[slock]\n\t
jns 5f\n
-   2:\t
testl $0x200, %[flags]\n\t
jz 4f\n\t
STI_STRING \n
diff --git a/include/asm-x86/spinlock_64.h b/include/asm-x86/spinlock_64.h
index ab50e7f..19d483c 100644
--- a/include/asm-x86/spinlock_64.h
+++ b/include/asm-x86/spinlock_64.h
@@ -27,13 +27,13 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
asm volatile(
\n1:\t
LOCK_PREFIX  ; decl %0\n\t
-   jns 2f\n
-   3:\n
+   jns 3f\n
+   2:\t
rep;nop\n\t
cmpl $0,%0\n\t
-   jle 3b\n\t
+   jle 2b\n\t
jmp 1b\n
-   2:\t
+   3:\n\t
: +m (lock-slock) : : memory);
 }
 
@@ -51,25 +51,26 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t 
*lock,
 {
asm volatile(
\n1:\t
-   LOCK_PREFIX  ; decl %0\n\t
+   LOCK_PREFIX  ; decl %[slock]\n\t
jns 5f\n
-   testl $0x200, %1\n\t  /* interrupts were disabled? */
+   testl $0x200, %[flags]\n\t
jz 4f\n\t
STI_STRING \n
3:\t
rep;nop\n\t
-   cmpl $0, %0\n\t
+   cmpl $0, %[slock]\n\t
jle 3b\n\t
CLI_STRING \n\t
jmp 1b\n
4:\t
rep;nop\n\t
-   cmpl $0, %0\n\t
+   cmpl $0, %[slock]\n\t
jg 1b\n\t
jmp 4b\n
5:\n\t
-   : +m (lock-slock)
-   : r ((unsigned)flags) CLI_STI_INPUT_ARGS
+   : [slock] +m (lock-slock)
+   : [flags] r ((unsigned)flags)
+ CLI_STI_INPUT_ARGS
: memory CLI_STI_CLOBBERS);
 }
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: merge spinlock.h variants

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1075cf7a959f72833e54dd2d4f885617e58e3e0a
Commit: 1075cf7a959f72833e54dd2d4f885617e58e3e0a
Parent: cf244e30f5b50763cbe85f7de30923d12999e38d
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:34 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:34 2008 +0100

x86: merge spinlock.h variants

Merge them finally together

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/spinlock.h|  211 -
 include/asm-x86/spinlock_32.h |  208 
 include/asm-x86/spinlock_64.h |  186 
 3 files changed, 209 insertions(+), 396 deletions(-)

diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
index e1d555a..afd4b80 100644
--- a/include/asm-x86/spinlock.h
+++ b/include/asm-x86/spinlock.h
@@ -1,6 +1,22 @@
 #ifndef _X86_SPINLOCK_H_
 #define _X86_SPINLOCK_H_
 
+#include asm/atomic.h
+#include asm/rwlock.h
+#include asm/page.h
+#include asm/processor.h
+
+/*
+ * Your basic SMP spinlocks, allowing only a single CPU anywhere
+ *
+ * Simple spin lock operations.  There are two variants, one clears IRQ's
+ * on the local processor, one does not.
+ *
+ * We make no fairness assumptions. They have a cost.
+ *
+ * (the type definitions are in asm/spinlock_types.h)
+ */
+
 #ifdef CONFIG_PARAVIRT
 #include asm/paravirt.h
 #else
@@ -11,9 +27,200 @@
 #endif /* CONFIG_PARAVIRT */
 
 #ifdef CONFIG_X86_32
-# include spinlock_32.h
+typedef char _slock_t;
+# define LOCK_INS_DEC decb
+# define LOCK_INS_XCH xchgb
+# define LOCK_INS_MOV movb
+# define LOCK_INS_CMP cmpb
+# define LOCK_PTR_REG a
 #else
-# include spinlock_64.h
+typedef int _slock_t;
+# define LOCK_INS_DEC decl
+# define LOCK_INS_XCH xchgl
+# define LOCK_INS_MOV movl
+# define LOCK_INS_CMP cmpl
+# define LOCK_PTR_REG D
+#endif
+
+static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
+{
+   return *(volatile _slock_t *)((lock)-slock) = 0;
+}
+
+static inline void __raw_spin_lock(raw_spinlock_t *lock)
+{
+   asm volatile(
+   \n1:\t
+   LOCK_PREFIX  ;  LOCK_INS_DEC  %0\n\t
+   jns 3f\n
+   2:\t
+   rep;nop\n\t
+   LOCK_INS_CMP  $0,%0\n\t
+   jle 2b\n\t
+   jmp 1b\n
+   3:\n\t
+   : +m (lock-slock) : : memory);
+}
+
+/*
+ * It is easier for the lock validator if interrupts are not re-enabled
+ * in the middle of a lock-acquire. This is a performance feature anyway
+ * so we turn it off:
+ *
+ * NOTE: there's an irqs-on section here, which normally would have to be
+ * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use this variant.
+ */
+#ifndef CONFIG_PROVE_LOCKING
+static inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
+unsigned long flags)
+{
+   asm volatile(
+   \n1:\t
+   LOCK_PREFIX  ;  LOCK_INS_DEC  %[slock]\n\t
+   jns 5f\n
+   testl $0x200, %[flags]\n\t
+   jz 4f\n\t
+   STI_STRING \n
+   3:\t
+   rep;nop\n\t
+   LOCK_INS_CMP  $0, %[slock]\n\t
+   jle 3b\n\t
+   CLI_STRING \n\t
+   jmp 1b\n
+   4:\t
+   rep;nop\n\t
+   LOCK_INS_CMP  $0, %[slock]\n\t
+   jg 1b\n\t
+   jmp 4b\n
+   5:\n\t
+   : [slock] +m (lock-slock)
+   : [flags] r ((u32)flags)
+ CLI_STI_INPUT_ARGS
+   : memory CLI_STI_CLOBBERS);
+}
+#endif
+
+static inline int __raw_spin_trylock(raw_spinlock_t *lock)
+{
+   _slock_t oldval;
+
+   asm volatile(
+   LOCK_INS_XCH  %0,%1
+   :=q (oldval), +m (lock-slock)
+   :0 (0) : memory);
+
+   return oldval  0;
+}
+
+/*
+ * __raw_spin_unlock based on writing $1 to the low byte.
+ * This method works. Despite all the confusion.
+ * (except on PPro SMP or if we are using OOSTORE, so we use xchgb there)
+ * (PPro errata 66, 92)
+ */
+#if defined(X86_64) || \
+   (!defined(CONFIG_X86_OOSTORE)  !defined(CONFIG_X86_PPRO_FENCE))
+
+static inline void __raw_spin_unlock(raw_spinlock_t *lock)
+{
+   asm volatile(LOCK_INS_MOV  $1,%0 : =m (lock-slock) :: memory);
+}
+
+#else
+
+static inline void __raw_spin_unlock(raw_spinlock_t *lock)
+{
+   unsigned char oldval = 1;
+
+   asm volatile(xchgb %b0, %1
+: =q (oldval), +m (lock-slock)
+: 0 (oldval) : memory);
+}
+
 #endif
 
+static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
+{
+   while (__raw_spin_is_locked(lock))
+   cpu_relax();
+}
+
+/*
+ * Read-write spinlocks, allowing multiple readers

x86: cleanup tlbflush.h variants

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0b9c99b6f21c2e9e00938e9c57942ed71bfe4d21
Commit: 0b9c99b6f21c2e9e00938e9c57942ed71bfe4d21
Parent: 1075cf7a959f72833e54dd2d4f885617e58e3e0a
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:35 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:35 2008 +0100

x86: cleanup tlbflush.h variants

Bring the tlbflush.h variants into sync to prepare merging and
paravirt support.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/smp_64.c|   12 ++--
 arch/x86/mach-voyager/voyager_smp.c |7 +-
 arch/x86/mm/boot_ioremap_32.c   |2 +-
 include/asm-x86/cpufeature.h|9 +++
 include/asm-x86/tlbflush_32.h   |  120 +++
 include/asm-x86/tlbflush_64.h   |   78 +--
 6 files changed, 128 insertions(+), 100 deletions(-)

diff --git a/arch/x86/kernel/smp_64.c b/arch/x86/kernel/smp_64.c
index 62b0f2a..7142447 100644
--- a/arch/x86/kernel/smp_64.c
+++ b/arch/x86/kernel/smp_64.c
@@ -55,7 +55,6 @@ union smp_flush_state {
cpumask_t flush_cpumask;
struct mm_struct *flush_mm;
unsigned long flush_va;
-#define FLUSH_ALL  -1ULL
spinlock_t tlbstate_lock;
};
char pad[SMP_CACHE_BYTES];
@@ -153,7 +152,7 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs 
*regs)
 
if (f-flush_mm == read_pda(active_mm)) {
if (read_pda(mmu_state) == TLBSTATE_OK) {
-   if (f-flush_va == FLUSH_ALL)
+   if (f-flush_va == TLB_FLUSH_ALL)
local_flush_tlb();
else
__flush_tlb_one(f-flush_va);
@@ -166,11 +165,12 @@ out:
add_pda(irq_tlb_count, 1);
 }
 
-static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
-   unsigned long va)
+void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
+unsigned long va)
 {
int sender;
union smp_flush_state *f;
+   cpumask_t cpumask = *cpumaskp;
 
/* Caller has disabled preemption */
sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS;
@@ -223,7 +223,7 @@ void flush_tlb_current_task(void)
 
local_flush_tlb();
if (!cpus_empty(cpu_mask))
-   flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
+   flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
preempt_enable();
 }
 
@@ -242,7 +242,7 @@ void flush_tlb_mm (struct mm_struct * mm)
leave_mm(smp_processor_id());
}
if (!cpus_empty(cpu_mask))
-   flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
+   flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
 
preempt_enable();
 }
diff --git a/arch/x86/mach-voyager/voyager_smp.c 
b/arch/x86/mach-voyager/voyager_smp.c
index 981def2..b472a2d 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -800,7 +800,6 @@ static void smp_reschedule_interrupt(void)
 static struct mm_struct *flush_mm;
 static unsigned long flush_va;
 static DEFINE_SPINLOCK(tlbstate_lock);
-#define FLUSH_ALL  0x
 
 /*
  * We cannot call mmdrop() because we are in interrupt context,
@@ -834,7 +833,7 @@ static void smp_invalidate_interrupt(void)
 
if (flush_mm == per_cpu(cpu_tlbstate, cpu).active_mm) {
if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) {
-   if (flush_va == FLUSH_ALL)
+   if (flush_va == TLB_FLUSH_ALL)
local_flush_tlb();
else
__flush_tlb_one(flush_va);
@@ -903,7 +902,7 @@ void flush_tlb_current_task(void)
cpu_mask = cpus_addr(mm-cpu_vm_mask)[0]  ~(1  smp_processor_id());
local_flush_tlb();
if (cpu_mask)
-   voyager_flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
+   voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
 
preempt_enable();
 }
@@ -923,7 +922,7 @@ void flush_tlb_mm(struct mm_struct *mm)
leave_mm(smp_processor_id());
}
if (cpu_mask)
-   voyager_flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
+   voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
 
preempt_enable();
 }
diff --git a/arch/x86/mm/boot_ioremap_32.c b/arch/x86/mm/boot_ioremap_32.c
index f14da2a..b20f74a 100644
--- a/arch/x86/mm/boot_ioremap_32.c
+++ b/arch/x86/mm/boot_ioremap_32.c
@@ -57,7 +57,7 @@ static void __boot_ioremap(unsigned long phys_addr, unsigned 
long nrpages,
pte = 

x86: merge mpspec variants

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c2805aa1d8ae51c7582d2ccbd736afa545cf5cc4
Commit: c2805aa1d8ae51c7582d2ccbd736afa545cf5cc4
Parent: 64883ab0e3386d72112a9091d886352a7b4b8bf6
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:35 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:35 2008 +0100

x86: merge mpspec variants

The delta is now minimal. Merge them

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/mpspec.h|  113 ++-
 include/asm-x86/mpspec_32.h |   84 
 include/asm-x86/mpspec_64.h |   79 --
 3 files changed, 111 insertions(+), 165 deletions(-)

diff --git a/include/asm-x86/mpspec.h b/include/asm-x86/mpspec.h
index 8f268e8..a2a6b2e 100644
--- a/include/asm-x86/mpspec.h
+++ b/include/asm-x86/mpspec.h
@@ -1,5 +1,114 @@
+#ifndef _AM_X86_MPSPEC_H
+#define _AM_X86_MPSPEC_H
+
+#include asm/mpspec_def.h
+
 #ifdef CONFIG_X86_32
-# include mpspec_32.h
+#include mach_mpspec.h
+
+extern int mp_bus_id_to_type[MAX_MP_BUSSES];
+extern int mp_bus_id_to_node[MAX_MP_BUSSES];
+extern int mp_bus_id_to_local[MAX_MP_BUSSES];
+extern int quad_local_to_mp_bus_id[NR_CPUS/4][4];
+
+extern unsigned int def_to_bigsmp;
+extern int apic_version[MAX_APICS];
+extern int pic_mode;
+
 #else
-# include mpspec_64.h
+
+#define MAX_MP_BUSSES 256
+/* Each PCI slot may be a combo card with its own bus.  4 IRQ pins per slot. */
+#define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
+
+extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
+
+#endif
+
+extern int mp_bus_id_to_pci_bus[MAX_MP_BUSSES];
+
+extern unsigned int boot_cpu_physical_apicid;
+extern int smp_found_config;
+extern int nr_ioapics;
+extern int mp_irq_entries;
+extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
+extern int mpc_default_type;
+extern unsigned long mp_lapic_addr;
+
+extern void find_smp_config(void);
+extern void get_smp_config(void);
+
+#ifdef CONFIG_ACPI
+extern void mp_register_lapic(u8 id, u8 enabled);
+extern void mp_register_lapic_address(u64 address);
+extern void mp_register_ioapic(u8 id, u32 address, u32 gsi_base);
+extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
+  u32 gsi);
+extern void mp_config_acpi_legacy_irqs(void);
+extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
+#endif /* CONFIG_ACPI */
+
+#define PHYSID_ARRAY_SIZE  BITS_TO_LONGS(MAX_APICS)
+
+struct physid_mask
+{
+   unsigned long mask[PHYSID_ARRAY_SIZE];
+};
+
+typedef struct physid_mask physid_mask_t;
+
+#define physid_set(physid, map)set_bit(physid, 
(map).mask)
+#define physid_clear(physid, map)  clear_bit(physid, (map).mask)
+#define physid_isset(physid, map)  test_bit(physid, (map).mask)
+#define physid_test_and_set(physid, map) \
+   test_and_set_bit(physid, (map).mask)
+
+#define physids_and(dst, src1, src2) \
+   bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
+
+#define physids_or(dst, src1, src2) \
+   bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
+
+#define physids_clear(map) \
+   bitmap_zero((map).mask, MAX_APICS)
+
+#define physids_complement(dst, src) \
+   bitmap_complement((dst).mask, (src).mask, MAX_APICS)
+
+#define physids_empty(map) \
+   bitmap_empty((map).mask, MAX_APICS)
+
+#define physids_equal(map1, map2) \
+   bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
+
+#define physids_weight(map) \
+   bitmap_weight((map).mask, MAX_APICS)
+
+#define physids_shift_right(d, s, n) \
+   bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
+
+#define physids_shift_left(d, s, n) \
+   bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
+
+#define physids_coerce(map)((map).mask[0])
+
+#define physids_promote(physids)   \
+   ({  \
+   physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
+   __physid_mask.mask[0] = physids;\
+   __physid_mask;  \
+   })
+
+#define physid_mask_of_physid(physid)  \
+   ({  \
+   physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
+   physid_set(physid, __physid_mask);  \
+   __physid_mask;  \
+   })
+
+#define PHYSID_MASK_ALL{ {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
+#define PHYSID_MASK_NONE   { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
+
+extern 

x86: cleanup acpi_32/64.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a999410135602d98bd007e835dc21c0c279ad72
Commit: 8a999410135602d98bd007e835dc21c0c279ad72
Parent: ae9d983be1eefac4b5efad69a188e7ac89a75797
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:36 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:36 2008 +0100

x86: cleanup acpi_32/64.h

Fix coding style to get a readable diff

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/acpi_32.h |   35 ++-
 include/asm-x86/acpi_64.h |   41 +
 2 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/include/asm-x86/acpi_32.h b/include/asm-x86/acpi_32.h
index c8afeea..03612bc 100644
--- a/include/asm-x86/acpi_32.h
+++ b/include/asm-x86/acpi_32.h
@@ -24,11 +24,8 @@
 #ifndef _ASM_ACPI_H
 #define _ASM_ACPI_H
 
-#ifdef __KERNEL__
-
 #include acpi/pdc_intel.h
-
-#include asm/system.h/* defines cmpxchg */
+#include asm/numa.h
 
 #define COMPILER_DEPENDENT_INT64   long long
 #define COMPILER_DEPENDENT_UINT64  unsigned long long
@@ -67,17 +64,17 @@ int __acpi_release_global_lock(unsigned int *lock);
  * Math helper asm macros
  */
 #define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-asm(divl %2;\
-:=a(q32), =d(r32) \
-:r(d32),\
-0(n_lo), 1(n_hi))
+   asm(divl %2;   \
+   :=a(q32), =d(r32)\
+   :r(d32),   \
+0(n_lo), 1(n_hi))
 
 
 #define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-asm(shrl   $1,%2; \
-rcrl   $1,%3; \
-:=r(n_hi), =r(n_lo) \
-:0(n_hi), 1(n_lo))
+   asm(shrl   $1,%2   ;  \
+   rcrl   $1,%3; \
+   :=r(n_hi), =r(n_lo) \
+   :0(n_hi), 1(n_lo))
 
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
@@ -87,6 +84,9 @@ extern int acpi_strict;
 extern int acpi_disabled;
 extern int acpi_ht;
 extern int acpi_pci_disabled;
+extern int acpi_skip_timer_override;
+extern int acpi_use_timer_override;
+
 static inline void disable_acpi(void)
 {
acpi_disabled = 1;
@@ -100,11 +100,6 @@ static inline void disable_acpi(void)
 
 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
 
-#ifdef CONFIG_X86_IO_APIC
-extern int acpi_skip_timer_override;
-extern int acpi_use_timer_override;
-#endif
-
 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
 static inline void acpi_disable_pci(void)
 {
@@ -122,7 +117,7 @@ extern unsigned long acpi_wakeup_address;
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
 
-#else  /* !CONFIG_ACPI */
+#else /* !CONFIG_ACPI */
 
 #define acpi_lapic 0
 #define acpi_ioapic 0
@@ -130,10 +125,8 @@ static inline void acpi_noirq_set(void) { }
 static inline void acpi_disable_pci(void) { }
 static inline void disable_acpi(void) { }
 
-#endif /* !CONFIG_ACPI */
+#endif /* !CONFIG_ACPI */
 
 #define ARCH_HAS_POWER_INIT1
 
-#endif /*__KERNEL__*/
-
 #endif /*_ASM_ACPI_H*/
diff --git a/include/asm-x86/acpi_64.h b/include/asm-x86/acpi_64.h
index 58114ed..b2670c6 100644
--- a/include/asm-x86/acpi_64.h
+++ b/include/asm-x86/acpi_64.h
@@ -24,8 +24,6 @@
 #ifndef _ASM_ACPI_H
 #define _ASM_ACPI_H
 
-#ifdef __KERNEL__
-
 #include acpi/pdc_intel.h
 #include asm/numa.h
 
@@ -66,17 +64,17 @@ int __acpi_release_global_lock(unsigned int *lock);
  * Math helper asm macros
  */
 #define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-asm(divl %2;\
-:=a(q32), =d(r32) \
-:r(d32),\
-0(n_lo), 1(n_hi))
+   asm(divl %2;   \
+   :=a(q32), =d(r32)\
+   :r(d32),   \
+0(n_lo), 1(n_hi))
 
 
 #define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-asm(shrl   $1,%2; \
-rcrl   $1,%3; \
-:=r(n_hi), =r(n_lo) \
-:0(n_hi), 1(n_lo))
+   asm(shrl   $1,%2   ;  \
+   rcrl   $1,%3; \
+   :=r(n_hi), =r(n_lo) \
+   :0(n_hi), 1(n_lo))
 
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
@@ -84,8 +82,11 @@ extern int acpi_ioapic;
 extern int acpi_noirq;
 extern int acpi_strict;
 extern int acpi_disabled;
-extern int acpi_pci_disabled;
 extern int acpi_ht;
+extern int acpi_pci_disabled;
+extern int acpi_skip_timer_override;
+extern int acpi_use_timer_override;
+
 static inline void disable_acpi(void)
 {
acpi_disabled = 1;
@@ -98,6 +99,7 @@ static inline void disable_acpi(void)
 #define FIX_ACPI_PAGES 4
 
 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
+
 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
 static inline void acpi_disable_pci(void)
 {
@@ -115,7 

x86: put all kern_addr_valid() incarnations to pgtable.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4757d7d8d00c5f8b2c176ca03b0a8eabbc206664
Commit: 4757d7d8d00c5f8b2c176ca03b0a8eabbc206664
Parent: 0b80fc721bed2635c7f0b198e1c862a4596dc2cd
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:37 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:37 2008 +0100

x86: put all kern_addr_valid() incarnations to pgtable.h

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/mmzone_32.h|3 ---
 include/asm-x86/pgtable_32.h   |8 +++-
 include/asm-x86/sparsemem_32.h |3 ---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/asm-x86/mmzone_32.h b/include/asm-x86/mmzone_32.h
index 118e981..5d6f4ce 100644
--- a/include/asm-x86/mmzone_32.h
+++ b/include/asm-x86/mmzone_32.h
@@ -87,9 +87,6 @@ static inline int pfn_to_nid(unsigned long pfn)
__pgdat-node_start_pfn + __pgdat-node_spanned_pages;  \
 })
 
-/* XXX: FIXME -- wli */
-#define kern_addr_valid(kaddr) (0)
-
 #ifdef CONFIG_X86_NUMAQ/* we have contiguous memory on NUMA-Q */
 #define pfn_valid(pfn)  ((pfn)  num_physpages)
 #else
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index ed3e70d..a8be1ee 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -497,9 +497,15 @@ static inline void paravirt_pagetable_setup_done(pgd_t 
*base)
 
 #endif /* !__ASSEMBLY__ */
 
+/*
+ * kern_addr_valid() is (1) for FLATMEM and (0) for
+ * SPARSEMEM and DISCONTIGMEM
+ */
 #ifdef CONFIG_FLATMEM
 #define kern_addr_valid(addr)  (1)
-#endif /* CONFIG_FLATMEM */
+#else
+#define kern_addr_valid(kaddr) (0)
+#endif
 
 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot)\
remap_pfn_range(vma, vaddr, pfn, size, prot)
diff --git a/include/asm-x86/sparsemem_32.h b/include/asm-x86/sparsemem_32.h
index cfeed99..d89c321 100644
--- a/include/asm-x86/sparsemem_32.h
+++ b/include/asm-x86/sparsemem_32.h
@@ -24,8 +24,5 @@
 #define MAX_PHYSMEM_BITS   32
 #endif
 
-/* XXX: FIXME -- wli */
-#define kern_addr_valid(kaddr)  (0)
-
 #endif /* CONFIG_SPARSEMEM */
 #endif /* _I386_SPARSEMEM_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: merge include/asm-x86/sparsemem.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a423ff0c4a0472607bbed6790fdaeec54af2ebb
Commit: 8a423ff0c4a0472607bbed6790fdaeec54af2ebb
Parent: 4757d7d8d00c5f8b2c176ca03b0a8eabbc206664
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:37 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:37 2008 +0100

x86: merge include/asm-x86/sparsemem.h

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/mmzone_64.h|2 ++
 include/asm-x86/sparsemem.h|   39 ++-
 include/asm-x86/sparsemem_32.h |   28 
 include/asm-x86/sparsemem_64.h |   26 --
 4 files changed, 36 insertions(+), 59 deletions(-)

diff --git a/include/asm-x86/mmzone_64.h b/include/asm-x86/mmzone_64.h
index 19a8937..1e0ed34 100644
--- a/include/asm-x86/mmzone_64.h
+++ b/include/asm-x86/mmzone_64.h
@@ -41,6 +41,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned 
long addr)
 #define node_end_pfn(nid)   (NODE_DATA(nid)-node_start_pfn + \
 NODE_DATA(nid)-node_spanned_pages)
 
+extern int early_pfn_to_nid(unsigned long pfn);
+
 #ifdef CONFIG_DISCONTIGMEM
 #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn)  PAGE_SHIFT)
 
diff --git a/include/asm-x86/sparsemem.h b/include/asm-x86/sparsemem.h
dissimilarity index 68%
index 3f203b1..fa58cd5 100644
--- a/include/asm-x86/sparsemem.h
+++ b/include/asm-x86/sparsemem.h
@@ -1,5 +1,34 @@
-#ifdef CONFIG_X86_32
-# include sparsemem_32.h
-#else
-# include sparsemem_64.h
-#endif
+#ifndef _ASM_X86_SPARSEMEM_H
+#define _ASM_X86_SPARSEMEM_H
+
+#ifdef CONFIG_SPARSEMEM
+/*
+ * generic non-linear memory support:
+ *
+ * 1) we will not split memory into more chunks than will fit into the flags
+ *field of the struct page
+ *
+ * SECTION_SIZE_BITS   2^n: size of each section
+ * MAX_PHYSADDR_BITS   2^n: max size of physical address space
+ * MAX_PHYSMEM_BITS2^n: how much memory we can have in that space
+ *
+ */
+
+#ifdef CONFIG_X86_32
+# ifdef CONFIG_X86_PAE
+#  define SECTION_SIZE_BITS30
+#  define MAX_PHYSADDR_BITS36
+#  define MAX_PHYSMEM_BITS 36
+# else
+#  define SECTION_SIZE_BITS26
+#  define MAX_PHYSADDR_BITS32
+#  define MAX_PHYSMEM_BITS 32
+# endif
+#else /* CONFIG_X86_32 */
+# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
+# define MAX_PHYSADDR_BITS 40
+# define MAX_PHYSMEM_BITS  40
+#endif
+
+#endif /* CONFIG_SPARSEMEM */
+#endif
diff --git a/include/asm-x86/sparsemem_32.h b/include/asm-x86/sparsemem_32.h
deleted file mode 100644
index d89c321..000
--- a/include/asm-x86/sparsemem_32.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _I386_SPARSEMEM_H
-#define _I386_SPARSEMEM_H
-#ifdef CONFIG_SPARSEMEM
-
-/*
- * generic non-linear memory support:
- *
- * 1) we will not split memory into more chunks than will fit into the
- *flags field of the struct page
- */
-
-/*
- * SECTION_SIZE_BITS   2^N: how big each section will be
- * MAX_PHYSADDR_BITS   2^N: how much physical address space we have
- * MAX_PHYSMEM_BITS2^N: how much memory we can have in that space
- */
-#ifdef CONFIG_X86_PAE
-#define SECTION_SIZE_BITS   30
-#define MAX_PHYSADDR_BITS   36
-#define MAX_PHYSMEM_BITS   36
-#else
-#define SECTION_SIZE_BITS   26
-#define MAX_PHYSADDR_BITS   32
-#define MAX_PHYSMEM_BITS   32
-#endif
-
-#endif /* CONFIG_SPARSEMEM */
-#endif /* _I386_SPARSEMEM_H */
diff --git a/include/asm-x86/sparsemem_64.h b/include/asm-x86/sparsemem_64.h
deleted file mode 100644
index dabb167..000
--- a/include/asm-x86/sparsemem_64.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _ASM_X86_64_SPARSEMEM_H
-#define _ASM_X86_64_SPARSEMEM_H 1
-
-#ifdef CONFIG_SPARSEMEM
-
-/*
- * generic non-linear memory support:
- *
- * 1) we will not split memory into more chunks than will fit into the flags
- *field of the struct page
- *
- * SECTION_SIZE_BITS   2^n: size of each section
- * MAX_PHYSADDR_BITS   2^n: max size of physical address space
- * MAX_PHYSMEM_BITS2^n: how much memory we can have in that space
- *
- */
-
-#define SECTION_SIZE_BITS  27 /* matt - 128 is convenient right now */
-#define MAX_PHYSADDR_BITS  40
-#define MAX_PHYSMEM_BITS   40
-
-extern int early_pfn_to_nid(unsigned long pfn);
-
-#endif /* CONFIG_SPARSEMEM */
-
-#endif /* _ASM_X86_64_SPARSEMEM_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: cleanup numa_64.c

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e3cfe529dd87dd3354789546676fef2e808822e4
Commit: e3cfe529dd87dd3354789546676fef2e808822e4
Parent: e1d9197862ff4d950dab45669b7f37b5ec3219d8
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:37 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:37 2008 +0100

x86: cleanup numa_64.c

Clean it up before applying more patches.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/x86/mm/numa_64.c |  213 +---
 1 files changed, 111 insertions(+), 102 deletions(-)

diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index e7f3f4e..4faed6a 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -1,7 +1,7 @@
-/* 
+/*
  * Generic VM initialization for x86-64 NUMA setups.
  * Copyright 2002,2003 Andi Kleen, SuSE Labs.
- */ 
+ */
 #include linux/kernel.h
 #include linux/mm.h
 #include linux/string.h
@@ -24,6 +24,8 @@
 #endif
 
 struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
+EXPORT_SYMBOL(node_data);
+
 bootmem_data_t plat_node_bdata[MAX_NUMNODES];
 
 struct memnode memnode;
@@ -31,16 +33,19 @@ struct memnode memnode;
 unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
[0 ... NR_CPUS-1] = NUMA_NO_NODE
 };
+EXPORT_SYMBOL(cpu_to_node);
+
 unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
-   [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
+   [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
+
 cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
+EXPORT_SYMBOL(node_to_cpumask);
 
 int numa_off __initdata;
 unsigned long __initdata nodemap_addr;
 unsigned long __initdata nodemap_size;
 
-
 /*
  * Given a shift value, try to populate memnodemap[]
  * Returns :
@@ -48,12 +53,11 @@ unsigned long __initdata nodemap_size;
  * 0 if memnodmap[] too small (of shift too small)
  * -1 if node overlap or lost ram (shift too big)
  */
-static int __init
-populate_memnodemap(const struct bootnode *nodes, int numnodes, int shift)
+static int __init populate_memnodemap(const struct bootnode *nodes,
+ int numnodes, int shift)
 {
-   int i; 
-   int res = -1;
unsigned long addr, end;
+   int i, res = -1;
 
memset(memnodemap, 0xff, memnodemapsize);
for (i = 0; i  numnodes; i++) {
@@ -70,7 +74,7 @@ populate_memnodemap(const struct bootnode *nodes, int 
numnodes, int shift)
addr += (1UL  shift);
} while (addr  end);
res = 1;
-   } 
+   }
return res;
 }
 
@@ -105,8 +109,8 @@ static int __init allocate_cachealigned_memnodemap(void)
  * The LSB of all start and end addresses in the node map is the value of the
  * maximum possible shift.
  */
-static int __init
-extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes)
+static int __init extract_lsb_from_nodes(const struct bootnode *nodes,
+int numnodes)
 {
int i, nodes_used = 0;
unsigned long start, end;
@@ -141,10 +145,9 @@ int __init compute_hash_shift(struct bootnode *nodes, int 
numnodes)
shift);
 
if (populate_memnodemap(nodes, numnodes, shift) != 1) {
-   printk(KERN_INFO
-   Your memory is not aligned you need to rebuild your kernel 
-   with a bigger NODEMAPSIZE shift=%d\n,
-   shift);
+   printk(KERN_INFO Your memory is not aligned you need to 
+  rebuild your kernel with a bigger NODEMAPSIZE 
+  shift=%d\n, shift);
return -1;
}
return shift;
@@ -157,35 +160,37 @@ int early_pfn_to_nid(unsigned long pfn)
 }
 #endif
 
-static void * __init
-early_node_mem(int nodeid, unsigned long start, unsigned long end,
- unsigned long size)
+static void * __init early_node_mem(int nodeid, unsigned long start,
+   unsigned long end, unsigned long size)
 {
unsigned long mem = find_e820_area(start, end, size);
void *ptr;
+
if (mem != -1L)
return __va(mem);
ptr = __alloc_bootmem_nopanic(size,
SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS));
if (ptr == NULL) {
printk(KERN_ERR Cannot find %lu bytes in node %d\n,
-   size, nodeid);
+  size, nodeid);
return NULL;
}
return ptr;
 }
 
 /* Initialize bootmem allocator for a node */
-void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long 
end)
-{ 
-   unsigned long start_pfn, end_pfn, bootmap_pages, bootmap_size, 
bootmap_start; 
-   unsigned long nodedata_phys;
+void __init setup_node_bootmem(int nodeid, unsigned long start,
+   

x86: merge acpi_32/64.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0b80fc721bed2635c7f0b198e1c862a4596dc2cd
Commit: 0b80fc721bed2635c7f0b198e1c862a4596dc2cd
Parent: 8a999410135602d98bd007e835dc21c0c279ad72
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:36 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:36 2008 +0100

x86: merge acpi_32/64.h

Merge the files.

[ [EMAIL PROTECTED]: build fix ]

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/acpi.h|  148 +++--
 include/asm-x86/acpi_32.h |  132 
 include/asm-x86/acpi_64.h |  144 ---
 3 files changed, 143 insertions(+), 281 deletions(-)

diff --git a/include/asm-x86/acpi.h b/include/asm-x86/acpi.h
index f8a8979..c477e57 100644
--- a/include/asm-x86/acpi.h
+++ b/include/asm-x86/acpi.h
@@ -1,14 +1,123 @@
 #ifndef _ASM_X86_ACPI_H
 #define _ASM_X86_ACPI_H
 
-#ifdef CONFIG_X86_32
-# include acpi_32.h
-#else
-# include acpi_64.h
-#endif
+/*
+ *  Copyright (C) 2001 Paul Diefenbaugh [EMAIL PROTECTED]
+ *  Copyright (C) 2001 Patrick Mochel [EMAIL PROTECTED]
+ *
+ * ~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~
+ */
+#include acpi/pdc_intel.h
 
+#include asm/numa.h
 #include asm/processor.h
 
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE- Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE  - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE  - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_ASM_MACROS
+#define BREAKPOINT3
+#define ACPI_DISABLE_IRQS() local_irq_disable()
+#define ACPI_ENABLE_IRQS()  local_irq_enable()
+#define ACPI_FLUSH_CPU_CACHE() wbinvd()
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+   ((Acq) = __acpi_acquire_global_lock(facs-global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+   ((Acq) = __acpi_release_global_lock(facs-global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+   asm(divl %2;   \
+   :=a(q32), =d(r32)\
+   :r(d32),   \
+0(n_lo), 1(n_hi))
+
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+   asm(shrl   $1,%2   ;  \
+   rcrl   $1,%3; \
+   :=r(n_hi), =r(n_lo) \
+   :0(n_hi), 1(n_lo))
+
+#ifdef CONFIG_ACPI
+extern int acpi_lapic;
+extern int acpi_ioapic;
+extern int acpi_noirq;
+extern int acpi_strict;
+extern int acpi_disabled;
+extern int acpi_ht;
+extern int acpi_pci_disabled;
+extern int acpi_skip_timer_override;
+extern int acpi_use_timer_override;
+
+static inline void disable_acpi(void)
+{
+   acpi_disabled = 1;
+   acpi_ht = 0;
+   acpi_pci_disabled = 1;
+   acpi_noirq = 1;
+}
+
+/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
+#define FIX_ACPI_PAGES 4
+
+extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
+
+static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
+static inline void acpi_disable_pci(void)
+{
+   acpi_pci_disabled = 1;
+   acpi_noirq_set();
+}
+extern int acpi_irq_balance_set(char *str);
+
+/* routines for saving/restoring kernel state */
+extern int acpi_save_state_mem(void);
+extern void acpi_restore_state_mem(void);
+
+extern unsigned long acpi_wakeup_address;
+
+/* early initialization routine */
+extern void acpi_reserve_bootmem(void);
+
 /*
  * Check if the CPU can handle C2 and deeper
  */
@@ -29,4 +138,33 @@ static 

x86: adjust numa 32 namespace

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fe21a445b98c9d52f02f3412d7a2fd39784f3b22
Commit: fe21a445b98c9d52f02f3412d7a2fd39784f3b22
Parent: 7462894a7cb03b54b9139f31fab5928366752a78
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:38 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:38 2008 +0100

x86: adjust numa 32 namespace

Use the 64bit numa variable names for numa32 as well.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/x86/kernel/smpboot_32.c  |   16 
 include/asm-x86/topology_32.h |8 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index 753d7ac..239ada1 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -466,19 +466,19 @@ extern struct {
 #ifdef CONFIG_NUMA
 
 /* which logical CPUs are on which nodes */
-cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly =
+cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly =
{ [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
-EXPORT_SYMBOL(node_2_cpu_mask);
+EXPORT_SYMBOL(node_to_cpumask_map);
 /* which node each logical CPU is on */
-int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
-EXPORT_SYMBOL(cpu_2_node);
+int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
+EXPORT_SYMBOL(cpu_to_node_map);
 
 /* set up a mapping between cpu and node. */
 static inline void map_cpu_to_node(int cpu, int node)
 {
printk(Mapping cpu %d to node %d\n, cpu, node);
-   cpu_set(cpu, node_2_cpu_mask[node]);
-   cpu_2_node[cpu] = node;
+   cpu_set(cpu, node_to_cpumask_map[node]);
+   cpu_to_node_map[cpu] = node;
 }
 
 /* undo a mapping between cpu and node. */
@@ -488,8 +488,8 @@ static inline void unmap_cpu_to_node(int cpu)
 
printk(Unmapping cpu %d from all nodes\n, cpu);
for (node = 0; node  MAX_NUMNODES; node ++)
-   cpu_clear(cpu, node_2_cpu_mask[node]);
-   cpu_2_node[cpu] = 0;
+   cpu_clear(cpu, node_to_cpumask_map[node]);
+   cpu_to_node_map[cpu] = 0;
 }
 #else /* !CONFIG_NUMA */
 
diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h
index fdca80a..e28dbdc 100644
--- a/include/asm-x86/topology_32.h
+++ b/include/asm-x86/topology_32.h
@@ -39,13 +39,13 @@
 #include linux/cpumask.h
 
 /* Mappings between logical cpu number and node number */
-extern cpumask_t node_2_cpu_mask[];
-extern int cpu_2_node[];
+extern cpumask_t node_to_cpumask_map[];
+extern int cpu_to_node_map[];
 
 /* Returns the number of the node containing CPU 'cpu' */
 static inline int cpu_to_node(int cpu)
 { 
-   return cpu_2_node[cpu];
+   return cpu_to_node_map[cpu];
 }
 
 /* Returns the number of the node containing Node 'node'.  This architecture 
is flat, 
@@ -55,7 +55,7 @@ static inline int cpu_to_node(int cpu)
 /* Returns a bitmask of CPUs on Node 'node'. */
 static inline cpumask_t node_to_cpumask(int node)
 {
-   return node_2_cpu_mask[node];
+   return node_to_cpumask_map[node];
 }
 
 /* Returns the number of the first CPU on Node 'node'. */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: merge topology.h variants

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3367e56f26a3a8647784328ffa846fe8021a5b79
Commit: 3367e56f26a3a8647784328ffa846fe8021a5b79
Parent: b4ea9299df1fa04dbd51840f60918a63ff6a8a44
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:38 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:38 2008 +0100

x86: merge topology.h variants

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/topology.h|  149 +++--
 include/asm-x86/topology_32.h |  116 
 include/asm-x86/topology_64.h |   91 -
 3 files changed, 144 insertions(+), 212 deletions(-)

diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
dissimilarity index 60%
index b10fde9..9c25160 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -1,5 +1,144 @@
-#ifdef CONFIG_X86_32
-# include topology_32.h
-#else
-# include topology_64.h
-#endif
+/*
+ * Written by: Matthew Dobson, IBM Corporation
+ *
+ * Copyright (C) 2002, IBM Corp.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Send feedback to [EMAIL PROTECTED]
+ */
+#ifndef _ASM_X86_TOPOLOGY_H
+#define _ASM_X86_TOPOLOGY_H
+
+#ifdef CONFIG_NUMA
+#include linux/cpumask.h
+#include asm/mpspec.h
+
+/* Mappings between logical cpu number and node number */
+extern int cpu_to_node_map[];
+extern cpumask_t node_to_cpumask_map[];
+
+/* Returns the number of the node containing CPU 'cpu' */
+static inline int cpu_to_node(int cpu)
+{
+   return cpu_to_node_map[cpu];
+}
+
+/*
+ * Returns the number of the node containing Node 'node'. This
+ * architecture is flat, so it is a pretty simple function!
+ */
+#define parent_node(node) (node)
+
+/* Returns a bitmask of CPUs on Node 'node'. */
+static inline cpumask_t node_to_cpumask(int node)
+{
+   return node_to_cpumask_map[node];
+}
+
+/* Returns the number of the first CPU on Node 'node'. */
+static inline int node_to_first_cpu(int node)
+{
+   cpumask_t mask = node_to_cpumask(node);
+
+   return first_cpu(mask);
+}
+
+#define pcibus_to_node(bus) __pcibus_to_node(bus)
+#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
+
+#ifdef CONFIG_X86_32
+extern unsigned long node_start_pfn[];
+extern unsigned long node_end_pfn[];
+extern unsigned long node_remap_size[];
+#define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
+
+# ifdef CONFIG_X86_HT
+#  define ENABLE_TOPO_DEFINES
+# endif
+
+# define SD_CACHE_NICE_TRIES   1
+# define SD_IDLE_IDX   1
+# define SD_NEWIDLE_IDX2
+# define SD_FORKEXEC_IDX   0
+
+#else
+
+# ifdef CONFIG_SMP
+#  define ENABLE_TOPO_DEFINES
+# endif
+
+# define SD_CACHE_NICE_TRIES   2
+# define SD_IDLE_IDX   2
+# define SD_NEWIDLE_IDX0
+# define SD_FORKEXEC_IDX   1
+
+#endif
+
+/* sched_domains SD_NODE_INIT for NUMAQ machines */
+#define SD_NODE_INIT (struct sched_domain) {   \
+   .span   = CPU_MASK_NONE,\
+   .parent = NULL, \
+   .child  = NULL, \
+   .groups = NULL, \
+   .min_interval   = 8,\
+   .max_interval   = 32,   \
+   .busy_factor= 32,   \
+   .imbalance_pct  = 125,  \
+   .cache_nice_tries   = SD_CACHE_NICE_TRIES,  \
+   .busy_idx   = 3,\
+   .idle_idx   = SD_IDLE_IDX,  \
+   .newidle_idx= SD_NEWIDLE_IDX,   \
+   .wake_idx   = 1,\
+   .forkexec_idx   = SD_FORKEXEC_IDX,  \
+   .flags  = SD_LOAD_BALANCE   \
+   | SD_BALANCE_EXEC   \
+   | SD_BALANCE_FORK   \
+   | SD_SERIALIZE  \
+   | SD_WAKE_BALANCE,  \
+   .last_balance   = jiffies,  

x86: merge resume-trace.h variants

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3578facf737dc9a60ed19a83458bd9cfdc2af233
Commit: 3578facf737dc9a60ed19a83458bd9cfdc2af233
Parent: 3367e56f26a3a8647784328ffa846fe8021a5b79
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:38 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:38 2008 +0100

x86: merge resume-trace.h variants

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/asm.h |2 ++
 include/asm-x86/resume-trace.h|   25 -
 include/asm-x86/resume-trace_32.h |   13 -
 include/asm-x86/resume-trace_64.h |   13 -
 4 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h
index b5006eb..8661ae7 100644
--- a/include/asm-x86/asm.h
+++ b/include/asm-x86/asm.h
@@ -6,12 +6,14 @@
 
 # define _ASM_PTR   .long 
 # define _ASM_ALIGN .balign 4 
+# define _ASM_MOV_ULmovl 
 
 #else
 /* 64 bits */
 
 # define _ASM_PTR   .quad 
 # define _ASM_ALIGN .balign 8 
+# define _ASM_MOV_ULmovq 
 
 #endif /* CONFIG_X86_32 */
 
diff --git a/include/asm-x86/resume-trace.h b/include/asm-x86/resume-trace.h
dissimilarity index 92%
index 9b6dd09..46f725b 100644
--- a/include/asm-x86/resume-trace.h
+++ b/include/asm-x86/resume-trace.h
@@ -1,5 +1,20 @@
-#ifdef CONFIG_X86_32
-# include resume-trace_32.h
-#else
-# include resume-trace_64.h
-#endif
+#ifndef _ASM_X86_RESUME_TRACE_H
+#define _ASM_X86_RESUME_TRACE_H
+
+#include asm/asm.h
+
+#define TRACE_RESUME(user) do {\
+   if (pm_trace_enabled) { \
+   void *tracedata;\
+   asm volatile(_ASM_MOV_UL  $1f,%0\n\
+   .section .tracedata,\a\\n   \
+   1:\t.word %c1\n\t \
+   _ASM_PTR  %c2\n   \
+   .previous \
+   :=r (tracedata)   \
+   : i (__LINE__), i (__FILE__));  \
+   generate_resume_trace(tracedata, user); \
+   }   \
+} while (0)
+
+#endif
diff --git a/include/asm-x86/resume-trace_32.h 
b/include/asm-x86/resume-trace_32.h
deleted file mode 100644
index ec9cfd6..000
--- a/include/asm-x86/resume-trace_32.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define TRACE_RESUME(user) do {\
-   if (pm_trace_enabled) { \
-   void *tracedata;\
-   asm volatile(movl $1f,%0\n\
-   .section .tracedata,\a\\n   \
-   1:\t.word %c1\n   \
-   \t.long %c2\n \
-   .previous \
-   :=r (tracedata)   \
-   : i (__LINE__), i (__FILE__));  \
-   generate_resume_trace(tracedata, user); \
-   }   \
-} while (0)
diff --git a/include/asm-x86/resume-trace_64.h 
b/include/asm-x86/resume-trace_64.h
deleted file mode 100644
index 34bf998..000
--- a/include/asm-x86/resume-trace_64.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define TRACE_RESUME(user) do {\
-   if (pm_trace_enabled) { \
-   void *tracedata;\
-   asm volatile(movq $1f,%0\n\
-   .section .tracedata,\a\\n   \
-   1:\t.word %c1\n   \
-   \t.quad %c2\n \
-   .previous \
-   :=r (tracedata)   \
-   : i (__LINE__), i (__FILE__));  \
-   generate_resume_trace(tracedata, user); \
-   }   \
-} while (0)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: remove unused tsk_thread from asm-offsets_64.c

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5cabbd97b10229159919ff17f746b69742cec84d
Commit: 5cabbd97b10229159919ff17f746b69742cec84d
Parent: 7ebad705340f35276326ed93a43190e62f725f77
Author: Steven Rostedt [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: remove unused tsk_thread from asm-offsets_64.c

So this patch simply removes the thread from asm-offsets.c since I
can't find an owner for it.

Signed-off-by: Steven Rostedt [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/asm-offsets_64.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index d1b6ed9..40f4175 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -38,7 +38,6 @@ int main(void)
 #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
ENTRY(state);
ENTRY(flags); 
-   ENTRY(thread); 
ENTRY(pid);
BLANK();
 #undef ENTRY
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: cleanup kernel/setup_64.c

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=04e1ba852132c9ad006affcd5b8c8606295170b0
Commit: 04e1ba852132c9ad006affcd5b8c8606295170b0
Parent: 5cabbd97b10229159919ff17f746b69742cec84d
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: cleanup kernel/setup_64.c

Clean it up before applying more patches to it.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/x86/kernel/setup_64.c |  249 ++--
 1 files changed, 126 insertions(+), 123 deletions(-)

diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 1acb435..62db062 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -77,7 +77,7 @@ unsigned long saved_video_mode;
 
 int force_mwait __cpuinitdata;
 
-/* 
+/*
  * Early DMI memory
  */
 int dmi_alloc_index;
@@ -169,12 +169,12 @@ contig_initmem_init(unsigned long start_pfn, unsigned 
long end_pfn)
bootmap_size = bootmem_bootmap_pages(end_pfn)PAGE_SHIFT;
bootmap = find_e820_area(0, end_pfnPAGE_SHIFT, bootmap_size);
if (bootmap == -1L)
-   panic(Cannot find bootmem map of size %ld\n,bootmap_size);
+   panic(Cannot find bootmem map of size %ld\n, bootmap_size);
bootmap_size = init_bootmem(bootmap  PAGE_SHIFT, end_pfn);
e820_register_active_regions(0, start_pfn, end_pfn);
free_bootmem_with_active_regions(0, end_pfn);
reserve_bootmem(bootmap, bootmap_size);
-} 
+}
 #endif
 
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
@@ -208,7 +208,8 @@ static void __init reserve_crashkernel(void)
unsigned long long crash_size, crash_base;
int ret;
 
-   free_mem = ((unsigned long long)max_low_pfn - min_low_pfn)  
PAGE_SHIFT;
+   free_mem =
+   ((unsigned long long)max_low_pfn - min_low_pfn)  PAGE_SHIFT;
 
ret = parse_crashkernel(boot_command_line, free_mem,
crash_size, crash_base);
@@ -240,7 +241,7 @@ unsigned __initdata ebda_size;
 static void discover_ebda(void)
 {
/*
-* there is a real-mode segmented pointer pointing to the 
+* there is a real-mode segmented pointer pointing to the
 * 4K EBDA area at 0x40E
 */
ebda_addr = *(unsigned short *)__va(EBDA_ADDR_POINTER);
@@ -259,6 +260,8 @@ static void discover_ebda(void)
 
 void __init setup_arch(char **cmdline_p)
 {
+   unsigned i;
+
printk(KERN_INFO Command line: %s\n, boot_command_line);
 
ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
@@ -345,13 +348,13 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 #ifdef CONFIG_NUMA
-   numa_initmem_init(0, end_pfn); 
+   numa_initmem_init(0, end_pfn);
 #else
contig_initmem_init(0, end_pfn);
 #endif
 
/* Reserve direct mapping */
-   reserve_bootmem_generic(table_start  PAGE_SHIFT, 
+   reserve_bootmem_generic(table_start  PAGE_SHIFT,
(table_end - table_start)  PAGE_SHIFT);
 
/* reserve kernel */
@@ -379,14 +382,14 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 #ifdef CONFIG_ACPI_SLEEP
-   /*
-* Reserve low memory region for sleep support.
-*/
-   acpi_reserve_bootmem();
-#endif
/*
-* Find and reserve possible boot-time SMP configuration:
+* Reserve low memory region for sleep support.
 */
+   acpi_reserve_bootmem();
+#endif
+   /*
+   * Find and reserve possible boot-time SMP configuration:
+   */
find_smp_config();
 #ifdef CONFIG_BLK_DEV_INITRD
if (boot_params.hdr.type_of_loader  boot_params.hdr.ramdisk_image) {
@@ -437,16 +440,13 @@ void __init setup_arch(char **cmdline_p)
 
/*
 * We trust e820 completely. No explicit ROM probing in memory.
-*/
+*/
e820_reserve_resources(code_resource, data_resource, bss_resource);
e820_mark_nosave_regions();
 
-   {
-   unsigned i;
/* request I/O space for devices used on all i[345]86 PCs */
for (i = 0; i  ARRAY_SIZE(standard_io_resources); i++)
request_resource(ioport_resource, standard_io_resources[i]);
-   }
 
e820_setup_gap();
 
@@ -483,9 +483,10 @@ static void __cpuinit display_cacheinfo(struct cpuinfo_x86 
*c)
 
if (n = 0x8005) {
cpuid(0x8005, dummy, ebx, ecx, edx);
-   printk(KERN_INFO CPU: L1 I Cache: %dK (%d bytes/line), D cache 
%dK (%d bytes/line)\n,
-   edx24, edx0xFF, ecx24, ecx0xFF);
-   c-x86_cache_size=(ecx24)+(edx24);
+   printk(KERN_INFO CPU: L1 I Cache: %dK (%d bytes/line), 
+  D cache %dK (%d bytes/line)\n,
+  edx24, 

x86: clear IO_APIC before enabing apic error vector.

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1c69524c2e5b83e52a098ebdeb4a8b52169f6a03
Commit: 1c69524c2e5b83e52a098ebdeb4a8b52169f6a03
Parent: 04e1ba852132c9ad006affcd5b8c8606295170b0
Author: Yinghai Lu [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: clear IO_APIC before enabing apic error vector.

4 socket quad core, 8 socket quad core will do apic ID lifting for BSP.

But io-apic regs for ExtINT still use 0 as dest.

so when we enable apic error vector in BSP, we will get one APIC error.

CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU 0/4 - Node 0
CPU: Physical Processor ID: 1
CPU: Processor Core ID: 0
SMP alternatives: switching to UP code
ACPI: Core revision 20070126
enabled ExtINT on CPU#0
ESR value after enabling vector: , after 000c
APIC error on CPU0: 0c(08)
ENABLING IO-APIC IRQs
Synchronizing Arb IDs.

So move enable_IO_APIC from setup_IO_APIC into setup_local_APIC and call it
before enabling the ACPI error vector.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/apic_64.c|7 +++
 arch/x86/kernel/io_apic_64.c |7 +--
 include/asm-x86/hw_irq_64.h  |1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 915808b..994298b 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -774,6 +774,13 @@ void __cpuinit setup_local_APIC(void)
value = APIC_DM_NMI | APIC_LVT_MASKED;
apic_write(APIC_LVT1, value);
 
+   /*
+* Now enable IO-APICs, actually call clear_IO_APIC
+* We need clear_IO_APIC before enabling vector on BP
+*/
+   if (!smp_processor_id()  !skip_ioapic_setup  nr_ioapics)
+   enable_IO_APIC();
+
{
unsigned oldvalue;
maxlvt = lapic_get_maxlvt();
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 3e471d0..4ef85a3 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1172,7 +1172,7 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
-static void __init enable_IO_APIC(void)
+void __init enable_IO_APIC(void)
 {
union IO_APIC_reg_01 reg_01;
int i8259_apic, i8259_pin;
@@ -1789,7 +1789,10 @@ __setup(no_timer_check, notimercheck);
 
 void __init setup_IO_APIC(void)
 {
-   enable_IO_APIC();
+
+   /*
+* calling enable_IO_APIC() is moved to setup_local_APIC for BP
+*/
 
if (acpi_ioapic)
io_apic_irqs = ~0;  /* all IRQs go through IOAPIC */
diff --git a/include/asm-x86/hw_irq_64.h b/include/asm-x86/hw_irq_64.h
index a470d59..a346159 100644
--- a/include/asm-x86/hw_irq_64.h
+++ b/include/asm-x86/hw_irq_64.h
@@ -135,6 +135,7 @@ extern void init_8259A(int aeoi);
 extern void send_IPI_self(int vector);
 extern void init_VISWS_APIC_irqs(void);
 extern void setup_IO_APIC(void);
+extern void enable_IO_APIC(void);
 extern void disable_IO_APIC(void);
 extern void print_IO_APIC(void);
 extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: remove -maccumulate-outgoing-args on 32-bit

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8c4385d7f5b77415156c9b900016cc8161d49f17
Commit: 8c4385d7f5b77415156c9b900016cc8161d49f17
Parent: 1c69524c2e5b83e52a098ebdeb4a8b52169f6a03
Author: Adrian Bunk [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: remove -maccumulate-outgoing-args on 32-bit

Contrary to the comment newer gccs do it by default, newer gcc versions
default to -maccumulate-outgoing-args only with 
CONFIG_CC_OPTIMIZE_FOR_SIZE=n,
and then only with some CPU settings.

Measured with an i386 defconfig, gcc 4.2.1 and kernel 2.6.23-rc1 (orig is
the plain kernel, changed is with -maccumulate-outgoing-args removed):

$ ls -la vmlinux*
-rwxrwxr-x 1 bunk bunk 6269713 2007-07-24 22:19 vmlinux.changed
-rwxrwxr-x 1 bunk bunk 6425361 2007-07-24 22:19 vmlinux.orig
$ size vmlinux.*
   textdata bss dec hex filename
4493465  504108  614400 5611973  55a1c5 vmlinux.changed
4646160  504108  614400 5764668  57f63c vmlinux.orig
$

That's a 2.5% size increase that does for sure hurt small systems.

If the stack unwinder ever comes back and needs this as indicated in the
comment, adding it to the cflags when the user enabled the unwinder should 
be
a better option.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/Makefile_32 |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index f806cec..b152db7 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -48,10 +48,6 @@ include $(srctree)/arch/x86/Makefile_32.cpu
 # temporary until string.h is fixed
 cflags-y += -ffreestanding
 
-# this works around some issues with generating unwind tables in older gccs
-# newer gccs do it by default
-cflags-y += -maccumulate-outgoing-args
-
 # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
 # a lot more stack due to the lack of sharing of stacklots:
 KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call 
cc-option,-fno-unit-at-a-time); fi ;)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: store core id bits in cpuinfo_x8

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a860b63c41f241c685245127a3d32f352cb04c12
Commit: a860b63c41f241c685245127a3d32f352cb04c12
Parent: 8c4385d7f5b77415156c9b900016cc8161d49f17
Author: Yinghai Lu [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: store core id bits in cpuinfo_x8

We need to store core id bits to cpuinfo_x86 in early_identify_cpu. So we
use it to create acpiid_to_node array in k8topolgy.c

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Cc: Christoph Lameter [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Len Brown [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/setup_64.c |   72 ++--
 include/asm-x86/processor_64.h |1 +
 2 files changed, 48 insertions(+), 25 deletions(-)

diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 62db062..84f66b7 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -542,18 +542,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
int node = 0;
unsigned apicid = hard_smp_processor_id();
 #endif
-   unsigned ecx = cpuid_ecx(0x8008);
-
-   c-x86_max_cores = (ecx  0xff) + 1;
-
-   /* CPU telling us the core id bits shift? */
-   bits = (ecx  12)  0xF;
-
-   /* Otherwise recompute */
-   if (bits == 0) {
-   while ((1  bits)  c-x86_max_cores)
-   bits++;
-   }
+   bits = c-x86_coreid_bits;
 
/* Low order bits define the core id (index of core in socket) */
c-cpu_core_id = c-phys_proc_id  ((1  bits)-1);
@@ -591,6 +580,33 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
 #endif
 }
 
+static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
+{
+#ifdef CONFIG_SMP
+   unsigned bits, ecx;
+
+   /* Multi core CPU? */
+   if (c-extended_cpuid_level  0x8008)
+   return;
+
+   ecx = cpuid_ecx(0x8008);
+
+   c-x86_max_cores = (ecx  0xff) + 1;
+
+   /* CPU telling us the core id bits shift? */
+   bits = (ecx  12)  0xF;
+
+   /* Otherwise recompute */
+   if (bits == 0) {
+   while ((1  bits)  c-x86_max_cores)
+   bits++;
+   }
+
+   c-x86_coreid_bits = bits;
+
+#endif
+}
+
 #define ENABLE_C1E_MASK0x1800
 #define CPUID_PROCESSOR_SIGNATURE  1
 #define CPUID_XFAM 0x0ff0
@@ -858,7 +874,7 @@ struct cpu_model_info {
below. */
 static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
 {
-   u32 tfms;
+   u32 tfms, xlvl;
 
c-loops_per_jiffy = loops_per_jiffy;
c-x86_cache_size = -1;
@@ -869,6 +885,7 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 
*c)
c-x86_clflush_size = 64;
c-x86_cache_alignment = c-x86_clflush_size;
c-x86_max_cores = 1;
+   c-x86_coreid_bits = 0;
c-extended_cpuid_level = 0;
memset(c-x86_capability, 0, sizeof c-x86_capability);
 
@@ -905,18 +922,6 @@ static void __cpuinit early_identify_cpu(struct 
cpuinfo_x86 *c)
 #ifdef CONFIG_SMP
c-phys_proc_id = (cpuid_ebx(1)  24)  0xff;
 #endif
-}
-
-/*
- * This does the hard work of actually picking apart the CPU stuff...
- */
-void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
-{
-   int i;
-   u32 xlvl;
-
-   early_identify_cpu(c);
-
/* AMD-defined flags: level 0x8001 */
xlvl = cpuid_eax(0x8000);
c-extended_cpuid_level = xlvl;
@@ -937,6 +942,23 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
c-x86_capability[2] = cpuid_edx(0x80860001);
}
 
+   switch (c-x86_vendor) {
+   case X86_VENDOR_AMD:
+   early_init_amd(c);
+   break;
+   }
+
+}
+
+/*
+ * This does the hard work of actually picking apart the CPU stuff...
+ */
+void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
+{
+   int i;
+
+   early_identify_cpu(c);
+
init_scattered_cpuid_features(c);
 
c-apicid = phys_pkg_id(0);
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index 6c0d96a..2ae8ceb 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -61,6 +61,7 @@ struct cpuinfo_x86 {
int x86_tlbsize;/* number of 4K pages in DTLB/ITLB combined(in 
pages)*/
 __u8x86_virt_bits, x86_phys_bits;
__u8x86_max_cores;  /* cpuid returned max cores value */
+   __u8x86_coreid_bits; /* cpuid returned core id bits */
 __u32   x86_power; 
__u32   extended_cpuid_level;   /* Max extended CPUID 

x86: consolidate toloplogy_32/64.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b4ea9299df1fa04dbd51840f60918a63ff6a8a44
Commit: b4ea9299df1fa04dbd51840f60918a63ff6a8a44
Parent: fe21a445b98c9d52f02f3412d7a2fd39784f3b22
Author: Thomas Gleixner [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:38 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:38 2008 +0100

x86: consolidate toloplogy_32/64.h

Reorder defines and do white space / coding style cleanups
to get a readable diff.

Also convert the macros to inline functions. Move the pci
related inlines to pci.h

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 include/asm-x86/pci.h |   13 +
 include/asm-x86/topology_32.h |   55 +---
 include/asm-x86/topology_64.h |   60 -
 3 files changed, 80 insertions(+), 48 deletions(-)

diff --git a/include/asm-x86/pci.h b/include/asm-x86/pci.h
index 6983730..c61190c 100644
--- a/include/asm-x86/pci.h
+++ b/include/asm-x86/pci.h
@@ -92,6 +92,19 @@ static inline void early_quirks(void) { }
 /* generic pci stuff */
 #include asm-generic/pci.h
 
+#ifdef CONFIG_NUMA
+/* Returns the node based on pci bus */
+static inline int __pcibus_to_node(struct pci_bus *bus)
+{
+   struct pci_sysdata *sd = bus-sysdata;
+
+   return sd-node;
+}
 
+static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
+{
+   return node_to_cpumask(__pcibus_to_node(bus));
+}
+#endif
 
 #endif
diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h
index e28dbdc..35b0006 100644
--- a/include/asm-x86/topology_32.h
+++ b/include/asm-x86/topology_32.h
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2002, IBM Corp.
  *
- * All rights reserved.  
+ * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,34 +22,27 @@
  *
  * Send feedback to [EMAIL PROTECTED]
  */
-#ifndef _ASM_I386_TOPOLOGY_H
-#define _ASM_I386_TOPOLOGY_H
-
-#ifdef CONFIG_X86_HT
-#define topology_physical_package_id(cpu)  (cpu_data(cpu).phys_proc_id)
-#define topology_core_id(cpu)  (cpu_data(cpu).cpu_core_id)
-#define topology_core_siblings(cpu)(per_cpu(cpu_core_map, cpu))
-#define topology_thread_siblings(cpu)  (per_cpu(cpu_sibling_map, cpu))
-#endif
+#ifndef _ASM_X86_TOPOLOGY_H
+#define _ASM_X86_TOPOLOGY_H
 
 #ifdef CONFIG_NUMA
-
-#include asm/mpspec.h
-
 #include linux/cpumask.h
+#include asm/mpspec.h
 
 /* Mappings between logical cpu number and node number */
-extern cpumask_t node_to_cpumask_map[];
 extern int cpu_to_node_map[];
+extern cpumask_t node_to_cpumask_map[];
 
 /* Returns the number of the node containing CPU 'cpu' */
 static inline int cpu_to_node(int cpu)
-{ 
+{
return cpu_to_node_map[cpu];
 }
 
-/* Returns the number of the node containing Node 'node'.  This architecture 
is flat, 
-   so it is a pretty simple function! */
+/*
+ * Returns the number of the node containing Node 'node'. This
+ * architecture is flat, so it is a pretty simple function!
+ */
 #define parent_node(node) (node)
 
 /* Returns a bitmask of CPUs on Node 'node'. */
@@ -60,13 +53,14 @@ static inline cpumask_t node_to_cpumask(int node)
 
 /* Returns the number of the first CPU on Node 'node'. */
 static inline int node_to_first_cpu(int node)
-{ 
+{
cpumask_t mask = node_to_cpumask(node);
+
return first_cpu(mask);
 }
 
-#define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)-sysdata))-node
-#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus))
+#define pcibus_to_node(bus) __pcibus_to_node(bus)
+#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
 
 /* sched_domains SD_NODE_INIT for NUMAQ machines */
 #define SD_NODE_INIT (struct sched_domain) {   \
@@ -99,21 +93,24 @@ extern unsigned long node_remap_size[];
 
 #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
 
-#else /* !CONFIG_NUMA */
-/*
- * Other i386 platforms should define their own version of the 
- * above macros here.
- */
+#else /* CONFIG_NUMA */
 
 #include asm-generic/topology.h
 
-#endif /* CONFIG_NUMA */
+#endif
 
 extern cpumask_t cpu_coregroup_map(int cpu);
 
+#ifdef CONFIG_X86_HT
+#define topology_physical_package_id(cpu)  (cpu_data(cpu).phys_proc_id)
+#define topology_core_id(cpu)  (cpu_data(cpu).cpu_core_id)
+#define topology_core_siblings(cpu)(per_cpu(cpu_core_map, cpu))
+#define topology_thread_siblings(cpu)  (per_cpu(cpu_sibling_map, cpu))
+#endif
+
 #ifdef CONFIG_SMP
-#define mc_capable()   (boot_cpu_data.x86_max_cores  1)
-#define smt_capable()  (smp_num_siblings  1)
+#define mc_capable()   (boot_cpu_data.x86_max_cores  1)
+#define smt_capable()  

x86: untable __init references between IO data

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=739f33b38bf88312447e38ae8b7ac3acdbb72a6b
Commit: 739f33b38bf88312447e38ae8b7ac3acdbb72a6b
Parent: 3f6e5a12b8384ab9816ba6703f4b4be87ac94b5a
Author: Andi Kleen [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:40 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:40 2008 +0100

x86: untable __init references between IO data

Earlier patch added IO APIC setup into local APIC setup. This caused
modpost warnings. Fix them by untangling setup_local_APIC() and splitting
it into smaller functions. The IO APIC initialization is only called
for the BP init.

Also removed some outdated debugging code and minor cleanup.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/apic_64.c|   46 +-
 arch/x86/kernel/smpboot_64.c |8 +++
 include/asm-x86/apic.h   |1 +
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 994298b..d341f79 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -677,7 +677,7 @@ void __init init_bsp_APIC(void)
  */
 void __cpuinit setup_local_APIC(void)
 {
-   unsigned int value, maxlvt;
+   unsigned int value;
int i, j;
 
value = apic_read(APIC_LVR);
@@ -773,32 +773,23 @@ void __cpuinit setup_local_APIC(void)
else
value = APIC_DM_NMI | APIC_LVT_MASKED;
apic_write(APIC_LVT1, value);
+}
+
+void __cpuinit lapic_setup_esr(void)
+{
+   unsigned maxlvt = lapic_get_maxlvt();
 
+   apic_write(APIC_LVTERR, ERROR_APIC_VECTOR);
/*
-* Now enable IO-APICs, actually call clear_IO_APIC
-* We need clear_IO_APIC before enabling vector on BP
+* spec says clear errors after enabling vector.
 */
-   if (!smp_processor_id()  !skip_ioapic_setup  nr_ioapics)
-   enable_IO_APIC();
-
-   {
-   unsigned oldvalue;
-   maxlvt = lapic_get_maxlvt();
-   oldvalue = apic_read(APIC_ESR);
-   value = ERROR_APIC_VECTOR;  // enables sending errors
-   apic_write(APIC_LVTERR, value);
-   /*
-* spec says clear errors after enabling vector.
-*/
-   if (maxlvt  3)
-   apic_write(APIC_ESR, 0);
-   value = apic_read(APIC_ESR);
-   if (value != oldvalue)
-   apic_printk(APIC_VERBOSE,
-   ESR value after enabling vector: %08x, after %08x\n,
-   oldvalue, value);
-   }
+   if (maxlvt  3)
+   apic_write(APIC_ESR, 0);
+}
 
+void __cpuinit end_local_APIC_setup(void)
+{
+   lapic_setup_esr();
nmi_watchdog_default();
setup_apic_nmi_watchdog(NULL);
apic_pm_activate();
@@ -879,6 +870,15 @@ int __init APIC_init_uniprocessor(void)
 
setup_local_APIC();
 
+   /*
+* Now enable IO-APICs, actually call clear_IO_APIC
+* We need clear_IO_APIC before enabling vector on BP
+*/
+   if (!skip_ioapic_setup  nr_ioapics)
+   enable_IO_APIC();
+
+   end_local_APIC_setup();
+
if (smp_found_config  !skip_ioapic_setup  nr_ioapics)
setup_IO_APIC();
else
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 7552db9..ddefb38 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -210,6 +210,7 @@ void __cpuinit smp_callin(void)
 
Dprintk(CALLIN, before setup_local_APIC().\n);
setup_local_APIC();
+   end_local_APIC_setup();
 
/*
 * Get our bogomips.
@@ -884,6 +885,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 */
setup_local_APIC();
 
+   /*
+* Enable IO APIC before setting up error vector
+*/
+   if (!skip_ioapic_setup  nr_ioapics)
+   enable_IO_APIC();
+   end_local_APIC_setup();
+
if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
panic(Boot APIC ID in local APIC unexpected (%d vs %d),
  GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id);
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 18d932d..5e8192d 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -112,6 +112,7 @@ extern void cache_APIC_registers(void);
 extern void sync_Arb_IDs(void);
 extern void init_bsp_APIC(void);
 extern void setup_local_APIC(void);
+extern void end_local_APIC_setup(void);
 extern void init_apic_mappings(void);
 extern void setup_boot_APIC_clock(void);
 extern void setup_secondary_APIC_clock(void);
-
To unsubscribe from 

x86: use core id bits for apicid_to_node initialization

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f6e5a12b8384ab9816ba6703f4b4be87ac94b5a
Commit: 3f6e5a12b8384ab9816ba6703f4b4be87ac94b5a
Parent: a860b63c41f241c685245127a3d32f352cb04c12
Author: Yinghai Lu [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:39 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:39 2008 +0100

x86: use core id bits for apicid_to_node initialization

We shoud use core id bits instead of max cores, in case later with AMD
downcores Quad core Opteron.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Cc: Christoph Lameter [EMAIL PROTECTED]
Cc: Len Brown [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/mm/k8topology_64.c |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c
index a96006f..3695c9e 100644
--- a/arch/x86/mm/k8topology_64.c
+++ b/arch/x86/mm/k8topology_64.c
@@ -44,12 +44,14 @@ int __init k8_scan_nodes(unsigned long start, unsigned long 
end)
 { 
unsigned long prevbase;
struct bootnode nodes[8];
-   int nodeid, i, j, nb;
+   int nodeid, i, nb;
unsigned char nodeids[8];
int found = 0;
u32 reg;
unsigned numnodes;
-   unsigned num_cores;
+   unsigned cores;
+   unsigned bits;
+   int j;
 
if (!early_pci_allowed())
return -1;
@@ -60,9 +62,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long 
end)
 
printk(KERN_INFO Scanning NUMA topology in Northbridge %d\n, nb); 
 
-   num_cores = (cpuid_ecx(0x8008)  0xff) + 1;
-   printk(KERN_INFO CPU has %d num_cores\n, num_cores);
-
reg = read_pci_config(0, nb, 0, 0x60); 
numnodes = ((reg  4)  0xF) + 1;
if (numnodes = 1)
@@ -168,11 +167,15 @@ int __init k8_scan_nodes(unsigned long start, unsigned 
long end)
} 
printk(KERN_INFO Using node hash shift of %d\n, memnode_shift); 
 
+   /* use the coreid bits from early_identify_cpu */
+   bits = boot_cpu_data.x86_coreid_bits;
+   cores = (1bits);
+
for (i = 0; i  8; i++) {
if (nodes[i].start != nodes[i].end) { 
nodeid = nodeids[i];
-   for (j = 0; j  num_cores; j++)
-   apicid_to_node[(nodeid * num_cores) + j] = i;
+   for (j = 0; j  cores; j++)
+   apicid_to_node[(nodeid  bits) + j] = i;
setup_node_bootmem(i, nodes[i].start, nodes[i].end); 
} 
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: extended interrupt LVT support for AMD Barcelona

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b83dae7aa31db4f6d6e78c3c6d490a7ac58699c
Commit: 7b83dae7aa31db4f6d6e78c3c6d490a7ac58699c
Parent: 739f33b38bf88312447e38ae8b7ac3acdbb72a6b
Author: Robert Richter [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:40 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:40 2008 +0100

x86: extended interrupt LVT support for AMD Barcelona

Also macro definitions in apicdef.h has been updated.

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/apic_64.c   |   26 ++
 arch/x86/kernel/cpu/mcheck/mce_amd_64.c |   10 +-
 include/asm-x86/apic.h  |4 ++--
 include/asm-x86/apicdef.h   |   19 ---
 4 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index d341f79..0270042 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -187,17 +187,35 @@ static void __setup_APIC_LVTT(unsigned int clocks, int 
oneshot, int irqen)
 }
 
 /*
- * Setup extended LVT (K8 specific)
+ * Setup extended LVT, AMD specific (K8, family 10h)
+ *
+ * Vector mappings are hard coded. On K8 only offset 0 (APIC500) and
+ * MCE interrupts are supported. Thus MCE offset must be set to 0.
  */
-void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
-unsigned char msg_type, unsigned char mask)
+
+#define APIC_EILVT_LVTOFF_MCE 0
+#define APIC_EILVT_LVTOFF_IBS 1
+
+static void setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask)
 {
-   unsigned long reg = (lvt_off  4) + K8_APIC_EXT_LVT_BASE;
+   unsigned long reg = (lvt_off  4) + APIC_EILVT0;
unsigned int  v   = (mask  16) | (msg_type  8) | vector;
 
apic_write(reg, v);
 }
 
+u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask)
+{
+   setup_APIC_eilvt(APIC_EILVT_LVTOFF_MCE, vector, msg_type, mask);
+   return APIC_EILVT_LVTOFF_MCE;
+}
+
+u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask)
+{
+   setup_APIC_eilvt(APIC_EILVT_LVTOFF_IBS, vector, msg_type, mask);
+   return APIC_EILVT_LVTOFF_IBS;
+}
+
 /*
  * Program the next event, relative to now
  */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c 
b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 073afa7..5505025 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -118,6 +118,7 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
 {
unsigned int bank, block;
unsigned int cpu = smp_processor_id();
+   u8 lvt_off;
u32 low = 0, high = 0, address = 0;
 
for (bank = 0; bank  NR_BANKS; ++bank) {
@@ -153,14 +154,13 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
if (shared_bank[bank]  c-cpu_core_id)
break;
 #endif
+   lvt_off = setup_APIC_eilvt_mce(THRESHOLD_APIC_VECTOR,
+  APIC_EILVT_MSG_FIX, 0);
+
high = ~MASK_LVTOFF_HI;
-   high |= K8_APIC_EXT_LVT_ENTRY_THRESHOLD  20;
+   high |= lvt_off  20;
wrmsr(address, low, high);
 
-   setup_APIC_extended_lvt(K8_APIC_EXT_LVT_ENTRY_THRESHOLD,
-   THRESHOLD_APIC_VECTOR,
-   K8_APIC_EXT_INT_MSG_FIX, 0);
-
threshold_defaults.address = address;
threshold_restart_bank(threshold_defaults, 0, 0);
}
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 5e8192d..4230227 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -126,8 +126,8 @@ extern void enable_NMI_through_LVT0(void *dummy);
 extern void setup_apic_routing(void);
 #endif
 
-extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char 
vector,
-   unsigned char msg_type, unsigned char mask);
+extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
+extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
 
 extern int apic_is_clustered_box(void);
 
diff --git a/include/asm-x86/apicdef.h b/include/asm-x86/apicdef.h
index 5f7abe9..550af7a 100644
--- a/include/asm-x86/apicdef.h
+++ b/include/asm-x86/apicdef.h
@@ -116,13 +116,18 @@
 #defineAPIC_TDR_DIV_32 0x8
 #defineAPIC_TDR_DIV_64 0x9
 #defineAPIC_TDR_DIV_1280xA
-
-#define K8_APIC_EXT_LVT_BASE   0x500
-#define K8_APIC_EXT_INT_MSG_FIX0x0
-#define K8_APIC_EXT_INT_MSG_SMI0x2
-#define K8_APIC_EXT_INT_MSG_NMI0x4
-#define 

x86: randomize brk

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c1d171a002942ea2d93b4fbd0c9583c56fce0772
Commit: c1d171a002942ea2d93b4fbd0c9583c56fce0772
Parent: 7b83dae7aa31db4f6d6e78c3c6d490a7ac58699c
Author: Jiri Kosina [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:40 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:40 2008 +0100

x86: randomize brk

Randomize the location of the heap (brk) for i386 and x86_64.  The range is
randomized in the range starting at current brk location up to 0x0200
offset for both architectures.  This, together with
pie-executable-randomization.patch and
pie-executable-randomization-fix.patch, should make the address space
randomization on i386 and x86_64 complete.

Arjan says:

This is known to break older versions of some emacs variants, whose dumper
code assumed that the last variable declared in the program is equal to the
start of the dynamically allocated memory region.

(The dumper is the code where emacs effectively dumps core at the end of 
it's
compilation stage; this coredump is then loaded as the main program during
normal use)

iirc this was 5 years or so; we found this way back when I was at RH and we
first did the security stuff there (including this brk randomization).  It
wasn't all variants of emacs, and it got fixed as a result (I vaguely 
remember
that emacs already had code to deal with it for other archs/oses, just
ifdeffed wrongly).

It's a rare and wrong assumption as a general thing, just on x86 it mostly
happened to be true (but to be honest, it'll break too if gcc does
something fancy or if the linker does a non-standard order).  Still its
something we should at least document.

Note 2: afaik it only broke the emacs *build*.  I'm not 100% sure about that
(it IS 5 years ago) though.

[ [EMAIL PROTECTED]: deuglification ]

Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
Cc: Arjan van de Ven [EMAIL PROTECTED]
Cc: Roland McGrath [EMAIL PROTECTED]
Cc: Jakub Jelinek [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/process_32.c |7 +++
 arch/x86/kernel/process_64.c |7 +++
 fs/binfmt_elf.c  |6 ++
 include/asm-x86/elf.h|3 +++
 mm/mmap.c|3 ++-
 5 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a8cdd09..631af16 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -992,3 +992,10 @@ unsigned long arch_align_stack(unsigned long sp)
sp -= get_random_int() % 8192;
return sp  ~0xf;
 }
+
+unsigned long arch_randomize_brk(struct mm_struct *mm)
+{
+   unsigned long range_end = mm-brk + 0x0200;
+   return randomize_range(mm-brk, range_end, 0) ? : mm-brk;
+}
+
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 98d8595..aa9414e 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -914,3 +914,10 @@ unsigned long arch_align_stack(unsigned long sp)
sp -= get_random_int() % 8192;
return sp  ~0xf;
 }
+
+unsigned long arch_randomize_brk(struct mm_struct *mm)
+{
+   unsigned long range_end = mm-brk + 0x0200;
+   return randomize_range(mm-brk, range_end, 0) ? : mm-brk;
+}
+
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f0b3171..043a800 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1021,6 +1021,12 @@ static int load_elf_binary(struct linux_binprm *bprm, 
struct pt_regs *regs)
current-mm-end_data = end_data;
current-mm-start_stack = bprm-p;
 
+#ifdef arch_randomize_brk
+   if (current-flags  PF_RANDOMIZE)
+   current-mm-brk = current-mm-start_brk =
+   arch_randomize_brk(current-mm);
+#endif
+
if (current-personality  MMAP_PAGE_ZERO) {
/* Why this, you ask???  Well SVr4 maps page 0 as read-only,
   and some applications depend upon this behavior.
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
index ec42a4d..cd3204e 100644
--- a/include/asm-x86/elf.h
+++ b/include/asm-x86/elf.h
@@ -285,6 +285,9 @@ struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
   int executable_stack);
 
+extern unsigned long arch_randomize_brk(struct mm_struct *mm);
+#define arch_randomize_brk arch_randomize_brk
+
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/mm/mmap.c b/mm/mmap.c
index bfa389f..d2b6d44 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -251,7 +251,8 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
 * not page aligned -Ram Gupta
 

x86 vDSO: generate vdso-syms.lds

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5b93049337301d6fbd3cf55db99b34e6b0dbd3a3
Commit: 5b93049337301d6fbd3cf55db99b34e6b0dbd3a3
Parent: c1d171a002942ea2d93b4fbd0c9583c56fce0772
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:40 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:40 2008 +0100

x86 vDSO: generate vdso-syms.lds

This patch adds a new way of extracting symbols from the built vDSO image.
This is much simpler and less fragile than using ld -R; it removes the
need to control the DSO layout quite so exactly.  I was clearly unduly
distracted by clever ld uses when I did the original vDSO implementation.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile   |   14 ++
 arch/x86/vdso/vdso.lds.S |   10 ++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index e7bff0f..d8200ad 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -55,6 +55,20 @@ SYSCFLAGS_vdso-syms.o = -r -d
 $(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE
$(call if_changed,syscall)
 
+targets += vdso-syms.lds
+obj-y += vdso-syms.lds
+
+#
+# Match symbols in the DSO that look like VDSO*; produce a file of constants.
+#
+sed-vdsosym := -e 's/^00*/0/' \
+   -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
+quiet_cmd_vdsosym = VDSOSYM $@
+  cmd_vdsosym = $(NM) $ | sed -n $(sed-vdsosym) | LC_ALL=C sort  $@
+
+$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
+   $(call if_changed,vdsosym)
+
 quiet_cmd_vdso_install = INSTALL $@
   cmd_vdso_install = cp $(obj)/[EMAIL PROTECTED] $(MODLIB)/vdso/$@
 vdso.so:
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S
index 667d324..d40d0e9 100644
--- a/arch/x86/vdso/vdso.lds.S
+++ b/arch/x86/vdso/vdso.lds.S
@@ -8,6 +8,16 @@
 
 #define VDSO_PRELINK 0xff70
 
+/*
+ * Symbols we define here called VDSO* get their values into vdso-syms.lds
+ * and become visible to the kernel itself.
+ */
+VDSO64_PRELINK = VDSO_PRELINK;
+
+#define VEXTERN(x) VDSO64_ ## x = vdso_ ## x;
+#include vextern.h
+#undef VEXTERN
+
 SECTIONS
 {
   . = VDSO_PRELINK + SIZEOF_HEADERS;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: use vdso-syms.lds

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7f3646aa16f496201e045183402c6614fa27b0c7
Commit: 7f3646aa16f496201e045183402c6614fa27b0c7
Parent: 5b93049337301d6fbd3cf55db99b34e6b0dbd3a3
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:41 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:41 2008 +0100

x86 vDSO: use vdso-syms.lds

This patch changes the kernel's references to addresses in the vDSO image
to be based on the symbols defined by vdso-syms.lds instead of the old
vdso-syms.o symbols.  This is all wrapped up in a macro defined by the new
asm-x86/vdso.h header; that's the only place in the kernel source that has
to know the details of the scheme for getting vDSO symbol values.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile |3 +--
 arch/x86/vdso/vdso-start.S |2 --
 arch/x86/vdso/vma.c|   18 +++---
 include/asm-x86/vdso.h |   14 ++
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index d8200ad..d2ec170 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -3,8 +3,7 @@
 #
 
 # files to link into the vdso
-# vdso-start.o has to be first
-vobjs-y := vdso-start.o vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
+vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
 
 # files to link into kernel
 obj-y := vma.o vdso.o vdso-syms.o
diff --git a/arch/x86/vdso/vdso-start.S b/arch/x86/vdso/vdso-start.S
deleted file mode 100644
index 2dc2cdb..000
--- a/arch/x86/vdso/vdso-start.S
+++ /dev/null
@@ -1,2 +0,0 @@
-   .globl vdso_kernel_start
-vdso_kernel_start:
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index ff9333e..3fdd514 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -11,23 +11,20 @@
 #include asm/vsyscall.h
 #include asm/vgtod.h
 #include asm/proto.h
-#include voffset.h
+#include asm/vdso.h
 
-int vdso_enabled = 1;
-
-#define VEXTERN(x) extern typeof(__ ## x) *vdso_ ## x;
-#include vextern.h
+#include vextern.h   /* Just for VMAGIC.  */
 #undef VEXTERN
 
-extern char vdso_kernel_start[], vdso_start[], vdso_end[];
+int vdso_enabled = 1;
+
+extern char vdso_start[], vdso_end[];
 extern unsigned short vdso_sync_cpuid;
 
 struct page **vdso_pages;
 
-static inline void *var_ref(void *vbase, char *var, char *name)
+static inline void *var_ref(void *p, char *name)
 {
-   unsigned offset = var - vdso_kernel_start[0] + VDSO_TEXT_OFFSET;
-   void *p = vbase + offset;
if (*(void **)p != (void *)VMAGIC) {
printk(VDSO: variable %s broken\n, name);
vdso_enabled = 0;
@@ -62,9 +59,8 @@ static int __init init_vdso_vars(void)
vdso_enabled = 0;
}
 
-#define V(x) *(typeof(x) *) var_ref(vbase, (char *)RELOC_HIDE(x, 0), #x)
 #define VEXTERN(x) \
-   V(vdso_ ## x) = __ ## x;
+   *(typeof(__ ## x) **) var_ref(VDSO64_SYMBOL(vbase, x), #x) = __ ## x;
 #include vextern.h
 #undef VEXTERN
return 0;
diff --git a/include/asm-x86/vdso.h b/include/asm-x86/vdso.h
new file mode 100644
index 000..9379ec0
--- /dev/null
+++ b/include/asm-x86/vdso.h
@@ -0,0 +1,14 @@
+#ifndef _ASM_X86_VDSO_H
+#define _ASM_X86_VDSO_H1
+
+extern const char VDSO64_PRELINK[];
+
+/*
+ * Given a pointer to the vDSO image, find the pointer to VDSO64_name
+ * as that symbol is defined in the vDSO sources or linker script.
+ */
+#define VDSO64_SYMBOL(base, name) ({   \
+   extern const char VDSO64_##name[];  \
+   (void *) (VDSO64_##name - VDSO64_PRELINK + (unsigned long) (base)); })
+
+#endif /* asm-x86/vdso.h */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: remove vdso-syms.o

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b9c97e16101e8dc2b0810d6f932d475a051d785
Commit: 2b9c97e16101e8dc2b0810d6f932d475a051d785
Parent: 7f3646aa16f496201e045183402c6614fa27b0c7
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:41 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:41 2008 +0100

x86 vDSO: remove vdso-syms.o

Get rid of vdso-syms.o from the kernel link.  We don't need it any more.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile |   15 ++-
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index d2ec170..6a665dd 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -6,13 +6,13 @@
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
 
 # files to link into kernel
-obj-y := vma.o vdso.o vdso-syms.o
+obj-y := vma.o vdso.o
 
 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
-targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) vdso-syms.o
+targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 
 # The DSO images are built using a special linker script.
 quiet_cmd_syscall = SYSCALL $@
@@ -43,17 +43,6 @@ CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 
-fasynchronous-unwind-tables -m
 $(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
 $(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
 
-# We also create a special relocatable object that should mirror the symbol
-# table and layout of the linked DSO.  With ld -R we can then refer to
-# these symbols in the kernel code rather than hand-coded addresses.
-extra-y += vdso-syms.o
-$(obj)/built-in.o: $(obj)/vdso-syms.o
-$(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
-
-SYSCFLAGS_vdso-syms.o = -r -d
-$(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE
-   $(call if_changed,syscall)
-
 targets += vdso-syms.lds
 obj-y += vdso-syms.lds
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: new layout

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f6b46ebf904f69a73907a5e6b1ed2228e3f03d9e
Commit: f6b46ebf904f69a73907a5e6b1ed2228e3f03d9e
Parent: 2b9c97e16101e8dc2b0810d6f932d475a051d785
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:41 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:41 2008 +0100

x86 vDSO: new layout

This revamps the vDSO linker script to lay things out with the best
packing of the data and good, separate alignment of the code.  The
rigid layout using VDSO_TEXT_OFFSET no longer matters to the kernel.
I've moved the layout parts of the linker script into a new include
file, vdso-layout.lds.S; this is in preparation for sharing the script
for the 32-bit vDSO builds too.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/vdso-layout.lds.S |   64 
 arch/x86/vdso/vdso.lds.S|  126 +++---
 arch/x86/vdso/voffset.h |1 -
 3 files changed, 101 insertions(+), 90 deletions(-)

diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S
new file mode 100644
index 000..634a2cf
--- /dev/null
+++ b/arch/x86/vdso/vdso-layout.lds.S
@@ -0,0 +1,64 @@
+/*
+ * Linker script for vDSO.  This is an ELF shared object prelinked to
+ * its virtual address, and with only one read-only segment.
+ * This script controls its layout.
+ */
+
+SECTIONS
+{
+   . = VDSO_PRELINK + SIZEOF_HEADERS;
+
+   .hash   : { *(.hash) }  :text
+   .gnu.hash   : { *(.gnu.hash) }
+   .dynsym : { *(.dynsym) }
+   .dynstr : { *(.dynstr) }
+   .gnu.version: { *(.gnu.version) }
+   .gnu.version_d  : { *(.gnu.version_d) }
+   .gnu.version_r  : { *(.gnu.version_r) }
+
+   .note   : { *(.note.*) }:text   :note
+
+   .eh_frame_hdr   : { *(.eh_frame_hdr) }  :text   :eh_frame_hdr
+   .eh_frame   : { KEEP (*(.eh_frame)) }   :text
+
+   .dynamic: { *(.dynamic) }   :text   :dynamic
+
+   .rodata : { *(.rodata*) }   :text
+   .data   : {
+ *(.data*)
+ *(.sdata*)
+ *(.got.plt) *(.got)
+ *(.gnu.linkonce.d.*)
+ *(.bss*)
+ *(.dynbss*)
+ *(.gnu.linkonce.b.*)
+   }
+
+   .altinstructions: { *(.altinstructions) }
+   .altinstr_replacement   : { *(.altinstr_replacement) }
+
+   /*
+* Align the actual code well away from the non-instruction data.
+* This is the best thing for the I-cache.
+*/
+   . = ALIGN(0x100);
+
+   .text   : { *(.text*) } :text   =0x90909090
+}
+
+/*
+ * Very old versions of ld do not recognize this name token; use the constant.
+ */
+#define PT_GNU_EH_FRAME0x6474e550
+
+/*
+ * We must supply the ELF program headers explicitly to get just one
+ * PT_LOAD segment, and set the flags explicitly to make segments read-only.
+ */
+PHDRS
+{
+   textPT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
+   dynamic PT_DYNAMIC  FLAGS(4);   /* PF_R */
+   notePT_NOTE FLAGS(4);   /* PF_R */
+   eh_frame_hdrPT_GNU_EH_FRAME;
+}
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S
dissimilarity index 92%
index d40d0e9..4e5dd3b 100644
--- a/arch/x86/vdso/vdso.lds.S
+++ b/arch/x86/vdso/vdso.lds.S
@@ -1,89 +1,37 @@
-/*
- * Linker script for vsyscall DSO.  The vsyscall page is an ELF shared
- * object prelinked to its virtual address, and with only one read-only
- * segment (that fits in one page).  This script controls its layout.
- */
-#include asm/asm-offsets.h
-#include voffset.h
-
-#define VDSO_PRELINK 0xff70
-
-/*
- * Symbols we define here called VDSO* get their values into vdso-syms.lds
- * and become visible to the kernel itself.
- */
-VDSO64_PRELINK = VDSO_PRELINK;
-
-#define VEXTERN(x) VDSO64_ ## x = vdso_ ## x;
-#include vextern.h
-#undef VEXTERN
-
-SECTIONS
-{
-  . = VDSO_PRELINK + SIZEOF_HEADERS;
-
-  .hash   : { *(.hash) }   :text
-  .gnu.hash   : { *(.gnu.hash) }
-  .dynsym : { *(.dynsym) }
-  .dynstr : { *(.dynstr) }
-  .gnu.version: { *(.gnu.version) }
-  .gnu.version_d  : { *(.gnu.version_d) }
-  .gnu.version_r  : { *(.gnu.version_r) }
-
-  /* This linker script is used both with -r and with -shared.
- For the layouts to match, we need to skip more than enough
- space for the dynamic symbol table et al.  If this amount
-   

x86 vDSO: arch/x86/vdso/vdso32

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0c2f51a7d2546f65e4198cccd6a56e2a8b857677
Commit: 0c2f51a7d2546f65e4198cccd6a56e2a8b857677
Parent: 108b545137b03ec1d6a5765017d57f86056bf57c
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: arch/x86/vdso/vdso32

This moves the i386 vDSO sources into arch/x86/vdso/vdso32/, a
new directory.  This patch is a pure renaming, but paves the way
for consolidating the vDSO build logic.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/vsyscall-sigreturn.S  |3 +-
 arch/x86/kernel/Makefile_32 |3 +
 arch/x86/kernel/vsyscall-int80_32.S |   53 ---
 arch/x86/kernel/vsyscall-note_32.S  |   45 --
 arch/x86/kernel/vsyscall-sigreturn_32.S |  143 ---
 arch/x86/kernel/vsyscall-sysenter_32.S  |  122 --
 arch/x86/vdso/vdso32/int80.S|   53 +++
 arch/x86/vdso/vdso32/note.S |   45 ++
 arch/x86/vdso/vdso32/sigreturn.S|  143 +++
 arch/x86/vdso/vdso32/sysenter.S |  122 ++
 10 files changed, 367 insertions(+), 365 deletions(-)

diff --git a/arch/x86/ia32/vsyscall-sigreturn.S 
b/arch/x86/ia32/vsyscall-sigreturn.S
index b383be0..295eecf 100644
--- a/arch/x86/ia32/vsyscall-sigreturn.S
+++ b/arch/x86/ia32/vsyscall-sigreturn.S
@@ -139,5 +139,4 @@ __kernel_rt_sigreturn:
.align 4
 .LENDFDE3:
 
-#include ../../x86/kernel/vsyscall-note_32.S
-
+#include ../vdso/vdso32/note.S
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index eb2da53..f7c1c1c 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -56,6 +56,9 @@ $(obj)/vsyscall_32.o: $(obj)/vsyscall-int80_32.so 
$(obj)/vsyscall-sysenter_32.so
 targets += $(foreach F,int80 sysenter,vsyscall-$F_32.o vsyscall-$F_32.so)
 targets += vsyscall-note_32.o vsyscall_32.lds
 
+$(obj)/vsyscall-%_32.o: $(src)/../vdso/vdso32/%.S
+   $(call if_changed_dep,as_o_S)
+
 # The DSO images are built using a special linker script.
 quiet_cmd_syscall = SYSCALL $@
   cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
diff --git a/arch/x86/kernel/vsyscall-int80_32.S 
b/arch/x86/kernel/vsyscall-int80_32.S
deleted file mode 100644
index 103cab6..000
--- a/arch/x86/kernel/vsyscall-int80_32.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Code for the vsyscall page.  This version uses the old int $0x80 method.
- *
- * NOTE:
- * 1) __kernel_vsyscall _must_ be first in this page.
- * 2) there are alignment constraints on this stub, see vsyscall-sigreturn.S
- *for details.
- */
-
-   .text
-   .globl __kernel_vsyscall
-   .type __kernel_vsyscall,@function
-__kernel_vsyscall:
-.LSTART_vsyscall:
-   int $0x80
-   ret
-.LEND_vsyscall:
-   .size __kernel_vsyscall,.-.LSTART_vsyscall
-   .previous
-
-   .section .eh_frame,a,@progbits
-.LSTARTFRAMEDLSI:
-   .long .LENDCIEDLSI-.LSTARTCIEDLSI
-.LSTARTCIEDLSI:
-   .long 0 /* CIE ID */
-   .byte 1 /* Version number */
-   .string zR/* NUL-terminated augmentation string */
-   .uleb128 1  /* Code alignment factor */
-   .sleb128 -4 /* Data alignment factor */
-   .byte 8 /* Return address register column */
-   .uleb128 1  /* Augmentation value length */
-   .byte 0x1b  /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
-   .byte 0x0c  /* DW_CFA_def_cfa */
-   .uleb128 4
-   .uleb128 4
-   .byte 0x88  /* DW_CFA_offset, column 0x8 */
-   .uleb128 1
-   .align 4
-.LENDCIEDLSI:
-   .long .LENDFDEDLSI-.LSTARTFDEDLSI /* Length FDE */
-.LSTARTFDEDLSI:
-   .long .LSTARTFDEDLSI-.LSTARTFRAMEDLSI /* CIE pointer */
-   .long .LSTART_vsyscall-./* PC-relative start address */
-   .long .LEND_vsyscall-.LSTART_vsyscall
-   .uleb128 0
-   .align 4
-.LENDFDEDLSI:
-   .previous
-
-/*
- * Get the common code for the sigreturn entry points.
- */
-#include vsyscall-sigreturn_32.S
diff --git a/arch/x86/kernel/vsyscall-note_32.S 
b/arch/x86/kernel/vsyscall-note_32.S
deleted file mode 100644
index fcf376a..000
--- a/arch/x86/kernel/vsyscall-note_32.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
- * Here we can supply some information useful to userland.
- */
-
-#include linux/version.h
-#include linux/elfnote.h
-

x86 vDSO: vdso32 build

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0249c9c1e7505c2b020bcc6deaf1e0415de9943e
Commit: 0249c9c1e7505c2b020bcc6deaf1e0415de9943e
Parent: 0c2f51a7d2546f65e4198cccd6a56e2a8b857677
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: vdso32 build

This builds the 32-bit vDSO images in the arch/x86/vdso subdirectory.
Nothing uses the images yet, but this paves the way for consolidating
the vDSO build logic all in one place.  The new images use a linker
script sharing the layout parts from vdso-layout.lds.S with the 64-bit
vDSO.  A new vdso32-syms.lds is generated in the style of vdso-syms.lds.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile|   78 +++-
 arch/x86/vdso/vdso32/vdso32.lds.S |   37 +
 2 files changed, 112 insertions(+), 3 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 6a665dd..a02e1ca 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -1,7 +1,15 @@
 #
-# x86-64 vDSO.
+# Building vDSO images for x86.
 #
 
+VDSO64-$(CONFIG_X86_64):= y
+VDSO32-$(CONFIG_X86_32):= y
+VDSO32-$(CONFIG_COMPAT):= y
+
+vdso-install-$(VDSO64-y)   += vdso.so
+vdso-install-$(VDSO32-y)   += $(vdso32-y:=.so)
+
+
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
 
@@ -57,10 +65,74 @@ quiet_cmd_vdsosym = VDSOSYM $@
 $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
$(call if_changed,vdsosym)
 
+#
+# Build multiple 32-bit vDSO images to choose from at boot time.
+#
+vdso32.so-$(CONFIG_X86_32) += int80
+vdso32.so-$(VDSO32-y)  += sysenter
+
+CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
+VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
+
+# This makes sure the $(obj) subdirectory exists even though vdso32/
+# is not a kbuild sub-make subdirectory.
+override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
+
+targets += vdso32/vdso32.lds
+targets += $(vdso32.so-y:%=vdso32-%.so.dbg) $(vdso32.so-y:%=vdso32-%.so)
+targets += vdso32/note.o $(vdso32.so-y:%=vdso32/%.o)
+
+extra-y+= $(vdso32.so-y:%=vdso32-%.so)
+
+KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
+$(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
+$(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): asflags-$(CONFIG_X86_64) += -m32
+
+$(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
+$(obj)/vdso32/vdso32.lds \
+$(obj)/vdso32/note.o \
+$(obj)/vdso32/%.o
+   $(call if_changed,vdso)
+
+# Make vdso32-*-syms.lds from each image, and then make sure they match.
+# The only difference should be that some do not define VDSO32_SYSENTER_RETURN.
+
+targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds)
+
+quiet_cmd_vdso32sym = VDSOSYM $@
+define cmd_vdso32sym
+   if LC_ALL=C sort -u $(filter-out FORCE,$^)  $(@D)/.tmp_$(@F)  \
+  $(foreach H,$(filter-out FORCE,$^),\
+if grep -q VDSO32_SYSENTER_RETURN $H; \
+then diff -u $(@D)/.tmp_$(@F) $H; \
+else sed /VDSO32_SYSENTER_RETURN/d $(@D)/.tmp_$(@F) | \
+ diff -u - $H; fi ) : ;\
+   then mv -f $(@D)/.tmp_$(@F) $@; \
+   else rm -f $(@D)/.tmp_$(@F); exit 1; \
+   fi
+endef
+
+$(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
+   $(call if_changed,vdso32sym)
+
+#
+# The DSO images are built using a special linker script.
+#
+quiet_cmd_vdso = VDSO$@
+  cmd_vdso = $(CC) -nostdlib -o $@ \
+  $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
+  -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^)
+
+VDSO_LDFLAGS = -fPIC -shared $(call ld-option, -Wl$(comma)--hash-style=sysv)
+
+#
+# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+#
 quiet_cmd_vdso_install = INSTALL $@
   cmd_vdso_install = cp $(obj)/[EMAIL PROTECTED] $(MODLIB)/vdso/$@
-vdso.so:
+$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
@mkdir -p $(MODLIB)/vdso
$(call cmd,vdso_install)
 
-vdso_install: vdso.so
+PHONY += vdso_install $(vdso-install-y)
+vdso_install: $(vdso-install-y)
diff --git a/arch/x86/vdso/vdso32/vdso32.lds.S 
b/arch/x86/vdso/vdso32/vdso32.lds.S
new file mode 100644
index 000..976124b
--- /dev/null
+++ b/arch/x86/vdso/vdso32/vdso32.lds.S
@@ -0,0 +1,37 @@
+/*
+ * Linker script for 32-bit vDSO.
+ * We #include the file to 

x86 vDSO: i386 vdso32

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6c3652efcafa6a6d795093362cb4290c84994b5c
Commit: 6c3652efcafa6a6d795093362cb4290c84994b5c
Parent: 0249c9c1e7505c2b020bcc6deaf1e0415de9943e
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: i386 vdso32

This makes the i386 kernel use the new vDSO build in arch/x86/vdso/vdso32/
to replace the old one from arch/x86/kernel/.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/Makefile_32  |3 +-
 arch/x86/kernel/Makefile_32   |   43 +---
 arch/x86/kernel/asm-offsets_32.c  |2 -
 arch/x86/kernel/signal_32.c   |5 ++-
 arch/x86/kernel/sysenter_32.c |6 +--
 arch/x86/kernel/vsyscall_32.S |   15 
 arch/x86/kernel/vsyscall_32.lds.S |   67 -
 arch/x86/vdso/Makefile|8 +++-
 arch/x86/vdso/vdso32.S|   15 
 arch/x86/vdso/vdso32/note.S   |3 +-
 arch/x86/vdso/vdso32/sysenter.S   |3 +-
 arch/x86/xen/setup.c  |5 +--
 include/asm-x86/elf.h |   13 ++-
 include/asm-x86/vdso.h|   14 
 14 files changed, 50 insertions(+), 152 deletions(-)

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index b152db7..9214224 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -110,7 +110,8 @@ libs-y  += arch/x86/lib/
 core-y += arch/x86/kernel/ \
   arch/x86/mm/ \
   $(mcore-y)/ \
-  arch/x86/crypto/
+  arch/x86/crypto/ \
+  arch/x86/vdso/
 drivers-$(CONFIG_MATH_EMULATION)   += arch/x86/math-emu/
 drivers-$(CONFIG_PCI)  += arch/x86/pci/
 # must be linked after kernel/
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index f7c1c1c..0eef822 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -33,7 +33,7 @@ obj-$(CONFIG_X86_NUMAQ)   += numaq_32.o
 obj-$(CONFIG_X86_SUMMIT_NUMA)  += summit_32.o
 obj-$(CONFIG_KPROBES)  += kprobes_32.o
 obj-$(CONFIG_MODULES)  += module_32.o
-obj-y  += sysenter_32.o vsyscall_32.o
+obj-y  += sysenter_32.o
 obj-$(CONFIG_ACPI_SRAT)+= srat_32.o
 obj-$(CONFIG_EFI)  += efi_32.o efi_stub_32.o
 obj-$(CONFIG_DOUBLEFAULT)  += doublefault_32.o
@@ -48,44 +48,3 @@ obj-$(CONFIG_PARAVIRT)   += paravirt_32.o
 obj-y  += pcspeaker.o
 
 obj-$(CONFIG_SCx200)   += scx200_32.o
-
-# vsyscall_32.o contains the vsyscall DSO images as __initdata.
-# We must build both images before we can assemble it.
-# Note: kbuild does not track this dependency due to usage of .incbin
-$(obj)/vsyscall_32.o: $(obj)/vsyscall-int80_32.so 
$(obj)/vsyscall-sysenter_32.so
-targets += $(foreach F,int80 sysenter,vsyscall-$F_32.o vsyscall-$F_32.so)
-targets += vsyscall-note_32.o vsyscall_32.lds
-
-$(obj)/vsyscall-%_32.o: $(src)/../vdso/vdso32/%.S
-   $(call if_changed_dep,as_o_S)
-
-# The DSO images are built using a special linker script.
-quiet_cmd_syscall = SYSCALL $@
-  cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
- -Wl,-T,$(filter-out FORCE,$^) -o $@
-
-export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
-
-vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
-$(call ld-option, -Wl$(comma)--hash-style=sysv)
-SYSCFLAGS_vsyscall-sysenter_32.so  = $(vsyscall-flags)
-SYSCFLAGS_vsyscall-int80_32.so = $(vsyscall-flags)
-
-$(obj)/vsyscall-int80_32.so $(obj)/vsyscall-sysenter_32.so: \
-$(obj)/vsyscall-%.so: $(src)/vsyscall_32.lds \
- $(obj)/vsyscall-%.o $(obj)/vsyscall-note_32.o FORCE
-   $(call if_changed,syscall)
-
-# We also create a special relocatable object that should mirror the symbol
-# table and layout of the linked DSO.  With ld -R we can then refer to
-# these symbols in the kernel code rather than hand-coded addresses.
-extra-y += vsyscall-syms.o
-$(obj)/built-in.o: $(obj)/vsyscall-syms.o
-$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
-
-SYSCFLAGS_vsyscall-syms.o = -r
-$(obj)/vsyscall-syms.o: $(src)/vsyscall_32.lds \
-   $(obj)/vsyscall-sysenter_32.o $(obj)/vsyscall-note_32.o 
FORCE
-   $(call if_changed,syscall)
-
-
diff --git 

x86 vDSO: absolute relocs

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4707c4717a5a6f375f3300bbccff1d46dcf75b25
Commit: 4707c4717a5a6f375f3300bbccff1d46dcf75b25
Parent: 6c3652efcafa6a6d795093362cb4290c84994b5c
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: absolute relocs

This updates the exceptions for absolute relocs for the new symbol name
convention used for symbols extracted from the vDSO images.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/boot/compressed/relocs.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/compressed/relocs.c 
b/arch/x86/boot/compressed/relocs.c
index 7a0d00b..d01ea42 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -27,11 +27,6 @@ static unsigned long *relocs;
  * absolute relocations present w.r.t these symbols.
  */
 static const char* safe_abs_relocs[] = {
-   __kernel_vsyscall,
-   __kernel_rt_sigreturn,
-   __kernel_sigreturn,
-   SYSENTER_RETURN,
-   VDSO_NOTE_MASK,
xen_irq_disable_direct_reloc,
xen_save_fl_direct_reloc,
 };
@@ -45,6 +40,8 @@ static int is_safe_abs_reloc(const char* sym_name)
/* Match found */
return 1;
}
+   if (strncmp(sym_name, VDSO, 4) == 0)
+   return 1;
if (strncmp(sym_name, __crc_, 6) == 0)
return 1;
return 0;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: i386 vdso32 install

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85a93b95dcd24023e0590ba4852ebff29208491a
Commit: 85a93b95dcd24023e0590ba4852ebff29208491a
Parent: 4707c4717a5a6f375f3300bbccff1d46dcf75b25
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: i386 vdso32 install

This enables 'make vdso_install' for i386 as on x86_64 and powerpc.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/Makefile_32 |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 9214224..5c6724d 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -149,9 +149,13 @@ zdisk bzdisk: vmlinux
 fdimage fdimage144 fdimage288 isoimage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
 
-install:
+install: vdso_install
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
 
+PHONY += vdso_install
+vdso_install:
+   $(Q)$(MAKE) $(build)=arch/x86/vdso $@
+
 archclean:
$(Q)rm -rf $(objtree)/arch/i386
$(Q)rm -rf $(objtree)/arch/x86_64
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: vdso32 setup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f288f32dc51042fd3a493b85b226e63f1ad3edcc
Commit: f288f32dc51042fd3a493b85b226e63f1ad3edcc
Parent: 85a93b95dcd24023e0590ba4852ebff29208491a
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:42 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:42 2008 +0100

x86 vDSO: vdso32 setup

This moves arch/x86/kernel/sysenter_32.c to arch/x86/vdso/vdso32-setup.c,
keeping all the code relating only to vDSO magic in the vdso/ subdirectory.
This is a pure renaming, but it paves the way to consolidating the code for
dealing with 32-bit vDSOs across CONFIG_X86_32 and CONFIG_IA32_EMULATION.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/Makefile_32   |1 -
 arch/x86/kernel/sysenter_32.c |  344 -
 arch/x86/vdso/Makefile|2 +-
 arch/x86/vdso/vdso32-setup.c  |  344 +
 4 files changed, 345 insertions(+), 346 deletions(-)

diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index 0eef822..2c9596b 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -33,7 +33,6 @@ obj-$(CONFIG_X86_NUMAQ)   += numaq_32.o
 obj-$(CONFIG_X86_SUMMIT_NUMA)  += summit_32.o
 obj-$(CONFIG_KPROBES)  += kprobes_32.o
 obj-$(CONFIG_MODULES)  += module_32.o
-obj-y  += sysenter_32.o
 obj-$(CONFIG_ACPI_SRAT)+= srat_32.o
 obj-$(CONFIG_EFI)  += efi_32.o efi_stub_32.o
 obj-$(CONFIG_DOUBLEFAULT)  += doublefault_32.o
diff --git a/arch/x86/kernel/sysenter_32.c b/arch/x86/kernel/sysenter_32.c
deleted file mode 100644
index 85c52d2..000
--- a/arch/x86/kernel/sysenter_32.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * (C) Copyright 2002 Linus Torvalds
- * Portions based on the vdso-randomization code from exec-shield:
- * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
- *
- * This file contains the needed initializations to support sysenter.
- */
-
-#include linux/init.h
-#include linux/smp.h
-#include linux/thread_info.h
-#include linux/sched.h
-#include linux/gfp.h
-#include linux/string.h
-#include linux/elf.h
-#include linux/mm.h
-#include linux/err.h
-#include linux/module.h
-
-#include asm/cpufeature.h
-#include asm/msr.h
-#include asm/pgtable.h
-#include asm/unistd.h
-#include asm/elf.h
-#include asm/tlbflush.h
-#include asm/vdso.h
-
-enum {
-   VDSO_DISABLED = 0,
-   VDSO_ENABLED = 1,
-   VDSO_COMPAT = 2,
-};
-
-#ifdef CONFIG_COMPAT_VDSO
-#define VDSO_DEFAULT   VDSO_COMPAT
-#else
-#define VDSO_DEFAULT   VDSO_ENABLED
-#endif
-
-/*
- * Should the kernel map a VDSO page into processes and pass its
- * address down to glibc upon exec()?
- */
-unsigned int __read_mostly vdso_enabled = VDSO_DEFAULT;
-
-EXPORT_SYMBOL_GPL(vdso_enabled);
-
-static int __init vdso_setup(char *s)
-{
-   vdso_enabled = simple_strtoul(s, NULL, 0);
-
-   return 1;
-}
-
-__setup(vdso=, vdso_setup);
-
-extern asmlinkage void sysenter_entry(void);
-
-static __init void reloc_symtab(Elf32_Ehdr *ehdr,
-   unsigned offset, unsigned size)
-{
-   Elf32_Sym *sym = (void *)ehdr + offset;
-   unsigned nsym = size / sizeof(*sym);
-   unsigned i;
-
-   for(i = 0; i  nsym; i++, sym++) {
-   if (sym-st_shndx == SHN_UNDEF ||
-   sym-st_shndx == SHN_ABS)
-   continue;  /* skip */
-
-   if (sym-st_shndx  SHN_LORESERVE) {
-   printk(KERN_INFO VDSO: unexpected st_shndx %x\n,
-  sym-st_shndx);
-   continue;
-   }
-
-   switch(ELF_ST_TYPE(sym-st_info)) {
-   case STT_OBJECT:
-   case STT_FUNC:
-   case STT_SECTION:
-   case STT_FILE:
-   sym-st_value += VDSO_HIGH_BASE;
-   }
-   }
-}
-
-static __init void reloc_dyn(Elf32_Ehdr *ehdr, unsigned offset)
-{
-   Elf32_Dyn *dyn = (void *)ehdr + offset;
-
-   for(; dyn-d_tag != DT_NULL; dyn++)
-   switch(dyn-d_tag) {
-   case DT_PLTGOT:
-   case DT_HASH:
-   case DT_STRTAB:
-   case DT_SYMTAB:
-   case DT_RELA:
-   case DT_INIT:
-   case DT_FINI:
-   case DT_REL:
-   case DT_DEBUG:
-   case DT_JMPREL:
-   case DT_VERSYM:
-   case DT_VERDEF:
-   case DT_VERNEED:
-   case DT_ADDRRNGLO ... DT_ADDRRNGHI:
-   /* definitely 

x86 vDSO: ia32_sysenter_target

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0aa97fb22624f18e5925d702ab0364d3838cfd91
Commit: 0aa97fb22624f18e5925d702ab0364d3838cfd91
Parent: f288f32dc51042fd3a493b85b226e63f1ad3edcc
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:43 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:43 2008 +0100

x86 vDSO: ia32_sysenter_target

This harmonizes the name for the entry point from the 32-bit sysenter
instruction across 32-bit and 64-bit kernels.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/entry_32.S   |   10 +-
 arch/x86/vdso/vdso32-setup.c |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index d63609d..153bb87 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -283,7 +283,7 @@ END(resume_kernel)
the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
 
# sysenter call handler stub
-ENTRY(sysenter_entry)
+ENTRY(ia32_sysenter_target)
CFI_STARTPROC simple
CFI_SIGNAL_FRAME
CFI_DEF_CFA esp, 0
@@ -360,7 +360,7 @@ sysenter_past_esp:
.align 4
.long 1b,2b
 .popsection
-ENDPROC(sysenter_entry)
+ENDPROC(ia32_sysenter_target)
 
# system call handler stub
 ENTRY(system_call)
@@ -768,7 +768,7 @@ label:  \
 
 KPROBE_ENTRY(debug)
RING0_INT_FRAME
-   cmpl $sysenter_entry,(%esp)
+   cmpl $ia32_sysenter_target,(%esp)
jne debug_stack_correct
FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
 debug_stack_correct:
@@ -799,7 +799,7 @@ KPROBE_ENTRY(nmi)
popl %eax
CFI_ADJUST_CFA_OFFSET -4
je nmi_espfix_stack
-   cmpl $sysenter_entry,(%esp)
+   cmpl $ia32_sysenter_target,(%esp)
je nmi_stack_fixup
pushl %eax
CFI_ADJUST_CFA_OFFSET 4
@@ -812,7 +812,7 @@ KPROBE_ENTRY(nmi)
popl %eax
CFI_ADJUST_CFA_OFFSET -4
jae nmi_stack_correct
-   cmpl $sysenter_entry,12(%esp)
+   cmpl $ia32_sysenter_target,12(%esp)
je nmi_debug_stack_check
 nmi_stack_correct:
/* We have a RING0_INT_FRAME here */
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 85c52d2..fb71a93 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -54,7 +54,7 @@ static int __init vdso_setup(char *s)
 
 __setup(vdso=, vdso_setup);
 
-extern asmlinkage void sysenter_entry(void);
+extern asmlinkage void ia32_sysenter_target(void);
 
 static __init void reloc_symtab(Elf32_Ehdr *ehdr,
unsigned offset, unsigned size)
@@ -187,7 +187,7 @@ void enable_sep_cpu(void)
tss-x86_tss.esp1 = sizeof(struct tss_struct) + (unsigned long) tss;
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
wrmsr(MSR_IA32_SYSENTER_ESP, tss-x86_tss.esp1, 0);
-   wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
+   wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
put_cpu();  
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: ia32 sysenter_return

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=36197c92a20c142fc2a068e0366053d770fa0096
Commit: 36197c92a20c142fc2a068e0366053d770fa0096
Parent: 0aa97fb22624f18e5925d702ab0364d3838cfd91
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:43 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:43 2008 +0100

x86 vDSO: ia32 sysenter_return

This changes the 64-bit kernel's support for the 32-bit sysenter
instruction to use stored fields rather than constants for the
user-mode return address, as the 32-bit kernel does.  This adds a
sysenter_return field to struct thread_info, as 32-bit has.  There
is no observable effect from this yet.  It makes the assembly code
independent of the 32-bit vDSO mapping address, paving the way for
making the vDSO address vary as it does on the 32-bit kernel.

[ [EMAIL PROTECTED]: build fix on !CONFIG_IA32_EMULATION ]

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ia32entry.S|7 +++
 arch/x86/ia32/syscall32.c|4 
 arch/x86/kernel/asm-offsets_64.c |3 +++
 include/asm-x86/thread_info_64.h |3 +++
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index df588f0..2499a32 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -12,7 +12,6 @@
 #include asm/ia32_unistd.h   
 #include asm/thread_info.h   
 #include asm/segment.h
-#include asm/vsyscall32.h
 #include asm/irqflags.h
 #include linux/linkage.h
 
@@ -104,7 +103,7 @@ ENTRY(ia32_sysenter_target)
pushfq
CFI_ADJUST_CFA_OFFSET 8
/*CFI_REL_OFFSET rflags,0*/
-   movl$VSYSCALL32_SYSEXIT, %r10d
+   movl8*3-THREAD_SIZE+threadinfo_sysenter_return(%rsp), %r10d
CFI_REGISTER rip,r10
pushq   $__USER32_CS
CFI_ADJUST_CFA_OFFSET 8
@@ -142,6 +141,8 @@ sysenter_do_call:
andl$~TS_COMPAT,threadinfo_status(%r10)
/* clear IF, that popfq doesn't enable interrupts early */
andl  $~0x200,EFLAGS-R11(%rsp) 
+   movlRIP-R11(%rsp),%edx  /* User %eip */
+   CFI_REGISTER rip,rdx
RESTORE_ARGS 1,24,1,1,1,1
popfq
CFI_ADJUST_CFA_OFFSET -8
@@ -149,8 +150,6 @@ sysenter_do_call:
popq%rcx/* User %esp */
CFI_ADJUST_CFA_OFFSET -8
CFI_REGISTER rsp,rcx
-   movl$VSYSCALL32_SYSEXIT,%edx/* User %eip */
-   CFI_REGISTER rip,rdx
TRACE_IRQS_ON
swapgs
sti /* sti only takes effect after the next instruction */
diff --git a/arch/x86/ia32/syscall32.c b/arch/x86/ia32/syscall32.c
index d751d96..98ff99f 100644
--- a/arch/x86/ia32/syscall32.c
+++ b/arch/x86/ia32/syscall32.c
@@ -46,6 +46,10 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int 
exstack)
  VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
  VM_ALWAYSDUMP,
  syscall32_pages);
+   if (ret == 0) {
+   current-mm-context.vdso = (void __user *)VSYSCALL32_BASE;
+   current_thread_info()-sysenter_return = VSYSCALL32_SYSEXIT;
+   }
up_write(mm-mmap_sem);
return ret;
 }
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 40f4175..c27c646 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -46,6 +46,9 @@ int main(void)
ENTRY(addr_limit);
ENTRY(preempt_count);
ENTRY(status);
+#ifdef CONFIG_IA32_EMULATION
+   ENTRY(sysenter_return);
+#endif
BLANK();
 #undef ENTRY
 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index 1ac23c1..c8e7736 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -33,6 +33,9 @@ struct thread_info {
 
mm_segment_taddr_limit; 
struct restart_blockrestart_block;
+#ifdef CONFIG_IA32_EMULATION
+   void __user *sysenter_return;
+#endif
 };
 #endif
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: ia32 vdso32-syscall build

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=00f8b1bc0e44ba94fb33e1fbd8ac82841d7cc570
Commit: 00f8b1bc0e44ba94fb33e1fbd8ac82841d7cc570
Parent: 36197c92a20c142fc2a068e0366053d770fa0096
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:43 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:43 2008 +0100

x86 vDSO: ia32 vdso32-syscall build

This puts the syscall version of the 32-bit vDSO in arch/x86/vdso/vdso32/
for 64-bit IA32 support.  This is not used yet, but it paves the way for
consolidating the 32-bit vDSO source and build logic all in one place.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile   |1 +
 arch/x86/vdso/vdso32/sigreturn.S |9 +++--
 arch/x86/vdso/vdso32/syscall.S   |   69 ++
 3 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 1efe785..1127c71 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -71,6 +71,7 @@ $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
 #
 obj-$(VDSO32-y)+= vdso32-syms.lds
 vdso32.so-$(CONFIG_X86_32) += int80
+vdso32.so-$(CONFIG_COMPAT) += syscall
 vdso32.so-$(VDSO32-y)  += sysenter
 
 CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
index 778f464..8d65a0a 100644
--- a/arch/x86/vdso/vdso32/sigreturn.S
+++ b/arch/x86/vdso/vdso32/sigreturn.S
@@ -6,9 +6,12 @@
  * routines are constant for all vsyscall implementations.
  */
 
-#include asm/unistd.h
+#include asm/unistd_32.h
 #include asm/asm-offsets.h
 
+#ifndef SYSCALL_ENTER_KERNEL
+#defineSYSCALL_ENTER_KERNELint $0x80
+#endif
 
 /* XXX
Should these be named _sigtramp or something?
@@ -22,7 +25,7 @@ __kernel_sigreturn:
 .LSTART_sigreturn:
popl %eax   /* XXX does this mean it needs unwind info? */
movl $__NR_sigreturn, %eax
-   int $0x80
+   SYSCALL_ENTER_KERNEL
 .LEND_sigreturn:
.size __kernel_sigreturn,.-.LSTART_sigreturn
 
@@ -32,7 +35,7 @@ __kernel_sigreturn:
 __kernel_rt_sigreturn:
 .LSTART_rt_sigreturn:
movl $__NR_rt_sigreturn, %eax
-   int $0x80
+   SYSCALL_ENTER_KERNEL
 .LEND_rt_sigreturn:
.size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
.balign 32
diff --git a/arch/x86/vdso/vdso32/syscall.S b/arch/x86/vdso/vdso32/syscall.S
new file mode 100644
index 000..333bfb5
--- /dev/null
+++ b/arch/x86/vdso/vdso32/syscall.S
@@ -0,0 +1,69 @@
+/*
+ * Code for the vsyscall page.  This version uses the syscall instruction.
+ */
+
+#include asm/asm-offsets.h
+#include asm/segment.h
+
+   .text
+   .globl __kernel_vsyscall
+   .type __kernel_vsyscall,@function
+__kernel_vsyscall:
+.LSTART_vsyscall:
+   push%ebp
+.Lpush_ebp:
+   movl%ecx, %ebp
+   syscall
+   movl$__USER32_DS, %ecx
+   movl%ecx, %ss
+   movl%ebp, %ecx
+   popl%ebp
+.Lpop_ebp:
+   ret
+.LEND_vsyscall:
+   .size __kernel_vsyscall,.-.LSTART_vsyscall
+
+   .section .eh_frame,a,@progbits
+.LSTARTFRAME:
+   .long .LENDCIE-.LSTARTCIE
+.LSTARTCIE:
+   .long 0 /* CIE ID */
+   .byte 1 /* Version number */
+   .string zR/* NUL-terminated augmentation string */
+   .uleb128 1  /* Code alignment factor */
+   .sleb128 -4 /* Data alignment factor */
+   .byte 8 /* Return address register column */
+   .uleb128 1  /* Augmentation value length */
+   .byte 0x1b  /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+   .byte 0x0c  /* DW_CFA_def_cfa */
+   .uleb128 4
+   .uleb128 4
+   .byte 0x88  /* DW_CFA_offset, column 0x8 */
+   .uleb128 1
+   .align 4
+.LENDCIE:
+
+   .long .LENDFDE1-.LSTARTFDE1 /* Length FDE */
+.LSTARTFDE1:
+   .long .LSTARTFDE1-.LSTARTFRAME  /* CIE pointer */
+   .long .LSTART_vsyscall-./* PC-relative start address */
+   .long .LEND_vsyscall-.LSTART_vsyscall
+   .uleb128 0  /* Augmentation length */
+   /* What follows are the instructions for the table generation.
+  We have to record all changes of the stack pointer.  */
+   .byte 0x40 + .Lpush_ebp-.LSTART_vsyscall /* DW_CFA_advance_loc */
+   .byte 0x0e  /* DW_CFA_def_cfa_offset */
+   .uleb128 8
+   .byte 0x85, 0x02/* DW_CFA_offset %ebp -8 */
+   .byte 0x40 + .Lpop_ebp-.Lpush_ebp /* DW_CFA_advance_loc */
+   .byte 0xc5  

x86 vDSO: consolidate vdso32

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=af65d64845a90c8f2fc90b97e2148ff74672e979
Commit: af65d64845a90c8f2fc90b97e2148ff74672e979
Parent: 00f8b1bc0e44ba94fb33e1fbd8ac82841d7cc570
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:43 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:43 2008 +0100

x86 vDSO: consolidate vdso32

This makes x86_64's ia32 emulation support share the sources used in the
32-bit kernel for the 32-bit vDSO and much of its setup code.

The 32-bit vDSO mapping now behaves the same on x86_64 as on native 32-bit.
The abi.syscall32 sysctl on x86_64 now takes the same values that
vm.vdso_enabled takes on the 32-bit kernel.  That is, 1 means a randomized
vDSO location, 2 means the fixed old address.  The CONFIG_COMPAT_VDSO
option is now available to make this the default setting, the same meaning
it has for the 32-bit kernel.  (This does not affect the 64-bit vDSO.)

The argument vdso32=[012] can be used on both 32-bit and 64-bit kernels to
set this paramter at boot time.  The vdso=[012] argument still does this
same thing on the 32-bit kernel.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 Documentation/kernel-parameters.txt |5 ++
 arch/x86/Kconfig|4 +-
 arch/x86/ia32/Makefile  |2 +-
 arch/x86/ia32/ia32_binfmt.c |9 +--
 arch/x86/ia32/ia32_signal.c |   22 ---
 arch/x86/vdso/Makefile  |2 +-
 arch/x86/vdso/vdso32-setup.c|  119 +++
 arch/x86/vdso/vdso32.S  |   16 +++--
 arch/x86/xen/setup.c|4 +-
 include/asm-x86/elf.h   |   23 ---
 10 files changed, 146 insertions(+), 60 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index b427b7c..b3f20be 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1988,6 +1988,11 @@ and is between 256 and 4096 characters. It is defined in 
the file
vdso=1: enable VDSO (default)
vdso=0: disable VDSO mapping
 
+   vdso32= [X86-32,X86-64]
+   vdso32=2: enable compat VDSO (default with COMPAT_VDSO)
+   vdso32=1: enable 32-bit VDSO (default)
+   vdso32=0: disable 32-bit VDSO mapping
+
vector= [IA-64,SMP]
vector=percpu: enable percpu vector domain
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 80b7ba4..2f4d88b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1191,9 +1191,9 @@ config HOTPLUG_CPU
 config COMPAT_VDSO
bool Compat VDSO support
default y
-   depends on X86_32
+   depends on X86_32 || IA32_EMULATION
help
- Map the VDSO to the predictable old-style address too.
+ Map the 32-bit VDSO to the predictable old-style address too.
---help---
  Say N here if you are running a sufficiently recent glibc
  version (2.3.3 or later), to remove the high-mapped
diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index a3c997e..1f58a21 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -3,7 +3,7 @@
 #
 
 obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
-   ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o
+   ia32_binfmt.o fpu32.o ptrace32.o
 
 sysv-$(CONFIG_SYSVIPC) := ipc32.o
 obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
diff --git a/arch/x86/ia32/ia32_binfmt.c b/arch/x86/ia32/ia32_binfmt.c
index 55822d2..e32974c 100644
--- a/arch/x86/ia32/ia32_binfmt.c
+++ b/arch/x86/ia32/ia32_binfmt.c
@@ -26,7 +26,7 @@
 #include asm/i387.h
 #include asm/uaccess.h
 #include asm/ia32.h
-#include asm/vsyscall32.h
+#include asm/vdso.h
 
 #undef ELF_ARCH
 #undef ELF_CLASS
@@ -47,14 +47,13 @@
 #define AT_SYSINFO 32
 #define AT_SYSINFO_EHDR33
 
-int sysctl_vsyscall32 = 1;
+extern int sysctl_vsyscall32;
 
 #undef ARCH_DLINFO
 #define ARCH_DLINFO do {  \
if (sysctl_vsyscall32) { \
-   current-mm-context.vdso = (void *)VSYSCALL32_BASE;\
-   NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
-   NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE);\
+   NEW_AUX_ENT(AT_SYSINFO, (u32)VDSO_ENTRY);   \
+   NEW_AUX_ENT(AT_SYSINFO_EHDR, (u32)VDSO_CURRENT_BASE);   \
}   \
 } while(0)
 
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 0fc5d85..39356a7 100644
--- 

x86 vDSO: ia32 vsyscall removal

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16f4bc738d616962a844e80f7b1fcb52c626542a
Commit: 16f4bc738d616962a844e80f7b1fcb52c626542a
Parent: af65d64845a90c8f2fc90b97e2148ff74672e979
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:44 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:44 2008 +0100

x86 vDSO: ia32 vsyscall removal

This removes all the old vsyscall code from arch/x86/ia32/ that is
no longer used because arch/x86/vdso/ code has replaced it.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/Makefile_64   |3 -
 arch/x86/ia32/Makefile |   65 -
 arch/x86/ia32/syscall32.c  |   90 ---
 arch/x86/ia32/syscall32_syscall.S  |   17 
 arch/x86/ia32/vsyscall-sigreturn.S |  142 
 arch/x86/ia32/vsyscall-syscall.S   |   69 -
 arch/x86/ia32/vsyscall-sysenter.S  |   95 
 arch/x86/ia32/vsyscall.lds |   80 
 include/asm-x86/Kbuild |1 -
 include/asm-x86/vsyscall32.h   |   20 -
 10 files changed, 14 insertions(+), 568 deletions(-)

diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64
index 93cf177..d35a0c5 100644
--- a/arch/x86/Makefile_64
+++ b/arch/x86/Makefile_64
@@ -117,9 +117,6 @@ install: vdso_install
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 
 
 vdso_install:
-ifeq ($(CONFIG_IA32_EMULATION),y)
-   $(Q)$(MAKE) $(build)=arch/x86/ia32 $@
-endif
$(Q)$(MAKE) $(build)=arch/x86/vdso $@
 
 archclean:
diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
dissimilarity index 74%
index 1f58a21..8c19b76 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -1,51 +1,14 @@
-#
-# Makefile for the ia32 kernel emulation subsystem.
-#
-
-obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
-   ia32_binfmt.o fpu32.o ptrace32.o
-
-sysv-$(CONFIG_SYSVIPC) := ipc32.o
-obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
-
-obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
-
-audit-class-$(CONFIG_AUDIT) := audit.o
-obj-$(CONFIG_IA32_EMULATION) += $(audit-class-y)
-
-$(obj)/syscall32_syscall.o: \
-   $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so)
-
-# Teach kbuild about targets
-targets := $(foreach F,$(addprefix vsyscall-,sysenter syscall),\
-$F.o $F.so $F.so.dbg)
-
-# The DSO images are built using a special linker script
-quiet_cmd_syscall = SYSCALL $@
-  cmd_syscall = $(CC) -m32 -nostdlib -shared \
- $(call ld-option, -Wl$(comma)--hash-style=sysv) \
-  -Wl,-soname=linux-gate.so.1 -o $@ \
-  -Wl,-T,$(filter-out FORCE,$^)
-
-$(obj)/%.so: OBJCOPYFLAGS := -S
-$(obj)/%.so: $(obj)/%.so.dbg FORCE
-   $(call if_changed,objcopy)
-
-$(obj)/vsyscall-sysenter.so.dbg $(obj)/vsyscall-syscall.so.dbg: \
-$(obj)/vsyscall-%.so.dbg: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
-   $(call if_changed,syscall)
-
-AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32
-AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32
-
-vdsos := vdso32-sysenter.so vdso32-syscall.so
-
-quiet_cmd_vdso_install = INSTALL $@
-  cmd_vdso_install = cp $(@:vdso32-%.so=$(obj)/vsyscall-%.so.dbg) \
-   $(MODLIB)/vdso/$@
-
-$(vdsos):
-   @mkdir -p $(MODLIB)/vdso
-   $(call cmd,vdso_install)
-
-vdso_install: $(vdsos)
+#
+# Makefile for the ia32 kernel emulation subsystem.
+#
+
+obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
+   ia32_binfmt.o fpu32.o ptrace32.o
+
+sysv-$(CONFIG_SYSVIPC) := ipc32.o
+obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
+
+obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
+
+audit-class-$(CONFIG_AUDIT) := audit.o
+obj-$(CONFIG_IA32_EMULATION) += $(audit-class-y)
diff --git a/arch/x86/ia32/syscall32.c b/arch/x86/ia32/syscall32.c
deleted file mode 100644
index 98ff99f..000
--- a/arch/x86/ia32/syscall32.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2002,2003 Andi Kleen, SuSE Labs
- *
- * vsyscall handling for 32bit processes. Map a stub page into it on
- * demand because 32bit cannot reach the kernel's fixmaps
- */
-#include linux/mm.h
-#include linux/string.h
-#include linux/kernel.h
-#include linux/gfp.h
-#include linux/init.h
-#include linux/stringify.h
-#include linux/security.h
-#include asm/proto.h
-#include asm/tlbflush.h
-#include asm/ia32_unistd.h
-#include asm/vsyscall32.h
-
-extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
-extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
-extern int sysctl_vsyscall32;
-

x86 vDSO: reorder vdso32 code

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=69d0627a7f6e891189124d784d2fa90cae7c449a
Commit: 69d0627a7f6e891189124d784d2fa90cae7c449a
Parent: 16f4bc738d616962a844e80f7b1fcb52c626542a
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:44 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:44 2008 +0100

x86 vDSO: reorder vdso32 code

This reorders the code in the 32-bit vDSO images to put the signal
trampolines first and __kernel_vsyscall after them.  The order does
not matter to userland, it just uses what AT_SYSINFO or e_entry
says.  Since the signal trampolines are the same size in both
versions of the vDSO, putting them first is the simplest way to get
the addresses to line up.  This makes it work to use a more compact
layout for the vDSO.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/vdso32/int80.S |   21 -
 arch/x86/vdso/vdso32/sigreturn.S |   20 +---
 arch/x86/vdso/vdso32/syscall.S   |   22 +++---
 arch/x86/vdso/vdso32/sysenter.S  |   21 +++--
 4 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/arch/x86/vdso/vdso32/int80.S b/arch/x86/vdso/vdso32/int80.S
index 3c8e4c6..be4b7a9 100644
--- a/arch/x86/vdso/vdso32/int80.S
+++ b/arch/x86/vdso/vdso32/int80.S
@@ -1,15 +1,15 @@
 /*
- * Code for the vsyscall page.  This version uses the old int $0x80 method.
+ * Code for the vDSO.  This version uses the old int $0x80 method.
  *
- * NOTE:
- * 1) __kernel_vsyscall _must_ be first in this page.
- * 2) there are alignment constraints on this stub, see vsyscall-sigreturn.S
- *for details.
+ * First get the common code for the sigreturn entry points.
+ * This must come first.
  */
+#include sigreturn.S
 
.text
.globl __kernel_vsyscall
.type __kernel_vsyscall,@function
+   ALIGN
 __kernel_vsyscall:
 .LSTART_vsyscall:
int $0x80
@@ -47,7 +47,10 @@ __kernel_vsyscall:
 .LENDFDEDLSI:
.previous
 
-/*
- * Get the common code for the sigreturn entry points.
- */
-#include sigreturn.S
+   /*
+* Pad out the segment to match the size of the sysenter.S version.
+*/
+VDSO32_vsyscall_eh_frame_size = 0x44
+   .section .data,aw,@progbits
+   .space VDSO32_vsyscall_eh_frame_size-(.LENDFDEDLSI-.LSTARTFRAMEDLSI), 0
+   .previous
diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
index 8d65a0a..cade275 100644
--- a/arch/x86/vdso/vdso32/sigreturn.S
+++ b/arch/x86/vdso/vdso32/sigreturn.S
@@ -1,11 +1,12 @@
 /*
- * Common code for the sigreturn entry points on the vsyscall page.
+ * Common code for the sigreturn entry points in vDSO images.
  * So far this code is the same for both int80 and sysenter versions.
- * This file is #include'd by vsyscall-*.S to define them after the
- * vsyscall entry point.  The kernel assumes that the addresses of these
- * routines are constant for all vsyscall implementations.
+ * This file is #include'd by int80.S et al to define them first thing.
+ * The kernel assumes that the addresses of these routines are constant
+ * for all vDSO implementations.
  */
 
+#include linux/linkage.h
 #include asm/unistd_32.h
 #include asm/asm-offsets.h
 
@@ -13,32 +14,29 @@
 #defineSYSCALL_ENTER_KERNELint $0x80
 #endif
 
-/* XXX
-   Should these be named _sigtramp or something?
-*/
-
.text
-   .org __kernel_vsyscall+32,0x90
.globl __kernel_sigreturn
.type __kernel_sigreturn,@function
+   ALIGN
 __kernel_sigreturn:
 .LSTART_sigreturn:
popl %eax   /* XXX does this mean it needs unwind info? */
movl $__NR_sigreturn, %eax
SYSCALL_ENTER_KERNEL
 .LEND_sigreturn:
+   nop
.size __kernel_sigreturn,.-.LSTART_sigreturn
 
-   .balign 32
.globl __kernel_rt_sigreturn
.type __kernel_rt_sigreturn,@function
+   ALIGN
 __kernel_rt_sigreturn:
 .LSTART_rt_sigreturn:
movl $__NR_rt_sigreturn, %eax
SYSCALL_ENTER_KERNEL
 .LEND_rt_sigreturn:
+   nop
.size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
-   .balign 32
.previous
 
.section .eh_frame,a,@progbits
diff --git a/arch/x86/vdso/vdso32/syscall.S b/arch/x86/vdso/vdso32/syscall.S
index 333bfb5..fe88d34 100644
--- a/arch/x86/vdso/vdso32/syscall.S
+++ b/arch/x86/vdso/vdso32/syscall.S
@@ -1,13 +1,18 @@
 /*
- * Code for the vsyscall page.  This version uses the syscall instruction.
+ * Code for the vDSO.  This version uses the syscall instruction.
+ *
+ * First get the common code for the sigreturn entry points.
+ * This must come first.
  

x86 vDSO: makefile cleanup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16e48e7e7929d841273d87027079660bca5e37bd
Commit: 16e48e7e7929d841273d87027079660bca5e37bd
Parent: 69d0627a7f6e891189124d784d2fa90cae7c449a
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:44 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:44 2008 +0100

x86 vDSO: makefile cleanup

This cleans up the arch/x86/vdso/Makefile rules for vdso.so to
share more code with the vdso32-*.so rules and remove old cruft.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/Makefile |   19 ---
 1 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 47bc276..58708f6 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -23,25 +23,15 @@ $(obj)/vdso.o: $(obj)/vdso.so
 
 targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 
-# The DSO images are built using a special linker script.
-quiet_cmd_syscall = SYSCALL $@
-  cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
- -Wl,-T,$(filter-out FORCE,$^) -o $@
-
 export CPPFLAGS_vdso.lds += -P -C
 
-vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
-$(call ld-option, -Wl$(comma)--hash-style=sysv) \
-   -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
-SYSCFLAGS_vdso.so = $(vdso-flags)
-SYSCFLAGS_vdso.so.dbg = $(vdso-flags)
+VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \
+   -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
 
 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
 
-$(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
-
 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
-   $(call if_changed,syscall)
+   $(call if_changed,vdso)
 
 $(obj)/%.so: OBJCOPYFLAGS := -S
 $(obj)/%.so: $(obj)/%.so.dbg FORCE
@@ -49,8 +39,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
 
 CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables 
-m64
 
-$(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
-$(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
+$(vobjs): KBUILD_CFLAGS = $(CFL)
 
 targets += vdso-syms.lds
 obj-$(VDSO64-y)+= vdso-syms.lds
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86 vDSO: canonicalize sysenter .eh_frame

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cadd516422d9382313144aa58f9e46ee7a2c0a28
Commit: cadd516422d9382313144aa58f9e46ee7a2c0a28
Parent: 16e48e7e7929d841273d87027079660bca5e37bd
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:44 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:44 2008 +0100

x86 vDSO: canonicalize sysenter .eh_frame

Some assembler versions automagically optimize .eh_frame contents,
changing their size.  The CFI in sysenter.S was not using optimal
formatting, so it would be changed by newer/smarter assemblers.
This ran afoul of the wired constant for padding out the other vDSO
images to match its size.  This changes the original hand-coded
source to use the optimal format encoding for its operations.  That
leaves nothing more for a fancy assembler to do, so the sizes will
match the wired-in expected size regardless of the assembler version.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/vdso/vdso32/int80.S|2 +-
 arch/x86/vdso/vdso32/syscall.S  |2 +-
 arch/x86/vdso/vdso32/sysenter.S |   18 ++
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/x86/vdso/vdso32/int80.S b/arch/x86/vdso/vdso32/int80.S
index be4b7a9..b15b7c0 100644
--- a/arch/x86/vdso/vdso32/int80.S
+++ b/arch/x86/vdso/vdso32/int80.S
@@ -50,7 +50,7 @@ __kernel_vsyscall:
/*
 * Pad out the segment to match the size of the sysenter.S version.
 */
-VDSO32_vsyscall_eh_frame_size = 0x44
+VDSO32_vsyscall_eh_frame_size = 0x40
.section .data,aw,@progbits
.space VDSO32_vsyscall_eh_frame_size-(.LENDFDEDLSI-.LSTARTFRAMEDLSI), 0
.previous
diff --git a/arch/x86/vdso/vdso32/syscall.S b/arch/x86/vdso/vdso32/syscall.S
index fe88d34..5415b56 100644
--- a/arch/x86/vdso/vdso32/syscall.S
+++ b/arch/x86/vdso/vdso32/syscall.S
@@ -71,7 +71,7 @@ __kernel_vsyscall:
/*
 * Pad out the segment to match the size of the sysenter.S version.
 */
-VDSO32_vsyscall_eh_frame_size = 0x44
+VDSO32_vsyscall_eh_frame_size = 0x40
.section .data,aw,@progbits
.space VDSO32_vsyscall_eh_frame_size-(.LENDFDE1-.LSTARTFRAME), 0
.previous
diff --git a/arch/x86/vdso/vdso32/sysenter.S b/arch/x86/vdso/vdso32/sysenter.S
index 902d5fc..e2800af 100644
--- a/arch/x86/vdso/vdso32/sysenter.S
+++ b/arch/x86/vdso/vdso32/sysenter.S
@@ -84,31 +84,25 @@ VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c 
via vdso32-syms.h */
.uleb128 0
/* What follows are the instructions for the table generation.
   We have to record all changes of the stack pointer.  */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lpush_ecx-.LSTART_vsyscall
+   .byte 0x40 + (.Lpush_ecx-.LSTART_vsyscall) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x08  /* RA at offset 8 now */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lpush_edx-.Lpush_ecx
+   .byte 0x40 + (.Lpush_edx-.Lpush_ecx) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x0c  /* RA at offset 12 now */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lenter_kernel-.Lpush_edx
+   .byte 0x40 + (.Lenter_kernel-.Lpush_edx) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x10  /* RA at offset 16 now */
.byte 0x85, 0x04/* DW_CFA_offset %ebp -16 */
/* Finally the epilogue.  */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lpop_ebp-.Lenter_kernel
+   .byte 0x40 + (.Lpop_ebp-.Lenter_kernel) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x0c  /* RA at offset 12 now */
.byte 0xc5  /* DW_CFA_restore %ebp */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lpop_edx-.Lpop_ebp
+   .byte 0x40 + (.Lpop_edx-.Lpop_ebp) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x08  /* RA at offset 8 now */
-   .byte 0x04  /* DW_CFA_advance_loc4 */
-   .long .Lpop_ecx-.Lpop_edx
+   .byte 0x40 + (.Lpop_ecx-.Lpop_edx) /* DW_CFA_advance_loc */
.byte 0x0e  /* DW_CFA_def_cfa_offset */
.byte 0x04  /* RA at offset 4 now */
.align 4
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: get_desc_base

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=859c0a5b9ca8eba2d65fa42f02505d76f8a712c7
Commit: 859c0a5b9ca8eba2d65fa42f02505d76f8a712c7
Parent: cadd516422d9382313144aa58f9e46ee7a2c0a28
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:44 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:44 2008 +0100

x86: get_desc_base

This defines the get_desc_base function in asm-x86/desc_64.h to match the
one in desc_32.h.  If these two files ever get merged together, this
function could be the same in both.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/desc_64.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index 7d48df7..230ac6e 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -215,6 +215,16 @@ static inline void load_LDT(mm_context_t *pc)
 
 extern struct desc_ptr idt_descr;
 
+static inline unsigned long get_desc_base(const void *ptr)
+{
+   const u32 *desc = ptr;
+   unsigned long base;
+   base = ((desc[0]  16)   0x) |
+   ((desc[1]  16)  0x00ff) |
+   (desc[1]  0xff00);
+   return base;
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: ptrace fs/gs_base

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df5d438e33d7fc914ba9b6e0d6b019a8966c5fcc
Commit: df5d438e33d7fc914ba9b6e0d6b019a8966c5fcc
Parent: 91394eb0975b3771dde7071a0825c6df6c20ff8a
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:45 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:45 2008 +0100

x86: ptrace fs/gs_base

The fs_base and gs_base fields are available in user_regs_struct.
But reading these via ptrace (PTRACE_GETREGS or PTRACE_PEEKUSR) does
not give a reliably useful value.  The thread_struct fields are 0
when do_arch_prctl decided to use a GDT slot instead of MSR_FS_BASE,
which it does for a value under 132.

This changes ptrace access to fs_base and gs_base to work like
PTRACE_ARCH_PRCTL does.  That is, it reads the base address that
user-mode memory access using the fs/gs instruction prefixes will
use, regardless of how it's being implemented in the kernel.  The
MSR vs GDT is an implementation detail that is pretty much hidden
from userland in the actual using, and there is no reason that
ptrace should give the internal implementation picture rather than
the user-mode semantic picture.  In the case of setting the value,
this can implicitly change the fsindex/gsindex value (also
separately in user_regs_struct), which is what happens when the
thread calls arch_prctl itself.  In a PTRACE_SETREGS, the fs_base
change will come after the fsindex change due to the order of the
struct, and so a change the debugger made to fs_base will have the
effect intended, another part of the user_regs_struct will now
differ when read back from what the debugger wrote.

This makes PTRACE_ARCH_PRCTL obsolete.  We could consider declaring
it deprecated and removing it one day, though there is no hurry.
For the foreseeable future, debuggers have to assume an old kernel
that does not report reliable fs_base/gs_base values in user_regs_struct
and stick to PTRACE_ARCH_PRCTL anyway.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_64.c |   35 +++
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 607085f..1edece3 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -22,6 +22,7 @@
 #include asm/pgtable.h
 #include asm/system.h
 #include asm/processor.h
+#include asm/prctl.h
 #include asm/i387.h
 #include asm/debugreg.h
 #include asm/ldt.h
@@ -260,12 +261,22 @@ static int putreg(struct task_struct *child,
case offsetof(struct user_regs_struct,fs_base):
if (value = TASK_SIZE_OF(child))
return -EIO;
-   child-thread.fs = value;
+   /*
+* When changing the segment base, use do_arch_prctl
+* to set either thread.fs or thread.fsindex and the
+* corresponding GDT slot.
+*/
+   if (child-thread.fs != value)
+   return do_arch_prctl(child, ARCH_SET_FS, value);
return 0;
case offsetof(struct user_regs_struct,gs_base):
+   /*
+* Exactly the same here as the %fs handling above.
+*/
if (value = TASK_SIZE_OF(child))
return -EIO;
-   child-thread.gs = value;
+   if (child-thread.gs != value)
+   return do_arch_prctl(child, ARCH_SET_GS, value);
return 0;
case offsetof(struct user_regs_struct, eflags):
value = FLAG_MASK;
@@ -296,9 +307,25 @@ static unsigned long getreg(struct task_struct *child, 
unsigned long regno)
case offsetof(struct user_regs_struct, es):
return child-thread.es; 
case offsetof(struct user_regs_struct, fs_base):
-   return child-thread.fs;
+   /*
+* do_arch_prctl may have used a GDT slot instead of
+* the MSR.  To userland, it appears the same either
+* way, except the %fs segment selector might not be 0.
+*/
+   if (child-thread.fs != 0)
+   return child-thread.fs;
+   if (child-thread.fsindex != FS_TLS_SEL)
+  

x86: desc_empty

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=12c3cbbb7e3218b1c3ed4c97b3496fc3f94ea967
Commit: 12c3cbbb7e3218b1c3ed4c97b3496fc3f94ea967
Parent: df5d438e33d7fc914ba9b6e0d6b019a8966c5fcc
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:45 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:45 2008 +0100

x86: desc_empty

This replaces the desc_empty macro with an inline.  It now handles
easily any of the four different types used between 32/64 code to
refer to these 8 bytes.  It's identical in both asm-x86/processor_64.h
and asm-x86/processor_32.h, so if these files ever get merged this
function can be in the common code.

This also removes the desc_equal macro because nothing uses it.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/processor_32.h |9 +
 include/asm-x86/processor_64.h |   10 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index 3b51a18..2540bf8 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -28,11 +28,12 @@ struct desc_struct {
unsigned long a,b;
 };
 
-#define desc_empty(desc) \
-   (!((desc)-a | (desc)-b))
+static inline int desc_empty(const void *ptr)
+{
+   const u32 *desc = ptr;
+   return !(desc[0] | desc[1]);
+}
 
-#define desc_equal(desc1, desc2) \
-   (((desc1)-a == (desc2)-a)  ((desc1)-b == (desc2)-b))
 /*
  * Default implementation of macro that returns current
  * instruction pointer (program counter).
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index 2ae8ceb..20d8935 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -30,11 +30,11 @@
 #define VIP_MASK   0x0010  /* virtual interrupt pending */
 #define ID_MASK0x0020
 
-#define desc_empty(desc) \
-   (!((desc)-a | (desc)-b))
-
-#define desc_equal(desc1, desc2) \
-   (((desc1)-a == (desc2)-a)  ((desc1)-b == (desc2)-b))
+static inline int desc_empty(const void *ptr)
+{
+   const u32 *desc = ptr;
+   return !(desc[0] | desc[1]);
+}
 
 /*
  * Default implementation of macro that returns current
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: tls32 moved

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=13abd0e50433092c41551bc13c32268028b6d663
Commit: 13abd0e50433092c41551bc13c32268028b6d663
Parent: 12c3cbbb7e3218b1c3ed4c97b3496fc3f94ea967
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:45 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:45 2008 +0100

x86: tls32 moved

This renames arch/x86/ia32/tls32.c to arch/x86/kernel/tls.c, which does
nothing now but paves the way to consolidate this code for 32-bit too.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Zachary Amsden [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/Makefile  |2 +-
 arch/x86/ia32/tls32.c   |  158 ---
 arch/x86/kernel/Makefile_64 |1 +
 arch/x86/kernel/tls.c   |  158 +++
 4 files changed, 160 insertions(+), 159 deletions(-)

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index 8c19b76..ea60886 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the ia32 kernel emulation subsystem.
 #
 
-obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
+obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o \
ia32_binfmt.o fpu32.o ptrace32.o
 
 sysv-$(CONFIG_SYSVIPC) := ipc32.o
diff --git a/arch/x86/ia32/tls32.c b/arch/x86/ia32/tls32.c
deleted file mode 100644
index cac4b26..000
--- a/arch/x86/ia32/tls32.c
+++ /dev/null
@@ -1,158 +0,0 @@
-#include linux/kernel.h
-#include linux/errno.h
-#include linux/sched.h
-#include linux/user.h
-
-#include asm/uaccess.h
-#include asm/desc.h
-#include asm/system.h
-#include asm/ldt.h
-#include asm/processor.h
-#include asm/proto.h
-
-/*
- * sys_alloc_thread_area: get a yet unused TLS descriptor index.
- */
-static int get_free_idx(void)
-{
-   struct thread_struct *t = current-thread;
-   int idx;
-
-   for (idx = 0; idx  GDT_ENTRY_TLS_ENTRIES; idx++)
-   if (desc_empty((struct n_desc_struct *)(t-tls_array) + idx))
-   return idx + GDT_ENTRY_TLS_MIN;
-   return -ESRCH;
-}
-
-/*
- * Set a given TLS descriptor:
- * When you want addresses  32bit use arch_prctl() 
- */
-int do_set_thread_area(struct thread_struct *t, struct user_desc __user 
*u_info)
-{
-   struct user_desc info;
-   struct n_desc_struct *desc;
-   int cpu, idx;
-
-   if (copy_from_user(info, u_info, sizeof(info)))
-   return -EFAULT;
-
-   idx = info.entry_number;
-
-   /*
-* index -1 means the kernel should try to find and
-* allocate an empty descriptor:
-*/
-   if (idx == -1) {
-   idx = get_free_idx();
-   if (idx  0)
-   return idx;
-   if (put_user(idx, u_info-entry_number))
-   return -EFAULT;
-   }
-
-   if (idx  GDT_ENTRY_TLS_MIN || idx  GDT_ENTRY_TLS_MAX)
-   return -EINVAL;
-
-   desc = ((struct n_desc_struct *)t-tls_array) + idx - GDT_ENTRY_TLS_MIN;
-
-   /*
-* We must not get preempted while modifying the TLS.
-*/
-   cpu = get_cpu();
-
-   if (LDT_empty(info)) {
-   desc-a = 0;
-   desc-b = 0;
-   } else {
-   desc-a = LDT_entry_a(info);
-   desc-b = LDT_entry_b(info);
-   }
-   if (t == current-thread)
-   load_TLS(t, cpu);
-
-   put_cpu();
-   return 0;
-}
-
-asmlinkage long sys32_set_thread_area(struct user_desc __user *u_info)
-{ 
-   return do_set_thread_area(current-thread, u_info); 
-} 
-
-
-/*
- * Get the current Thread-Local Storage area:
- */
-
-#define GET_LIMIT(desc) ( \
-   ((desc)-a  0x0) | \
-((desc)-b  0xf) )
-   
-#define GET_32BIT(desc)(((desc)-b  22)  1)
-#define GET_CONTENTS(desc) (((desc)-b  10)  3)
-#define GET_WRITABLE(desc) (((desc)-b   9)  1)
-#define GET_LIMIT_PAGES(desc)  (((desc)-b  23)  1)
-#define GET_PRESENT(desc)  (((desc)-b  15)  1)
-#define GET_USEABLE(desc)  (((desc)-b  20)  1)
-#define GET_LONGMODE(desc) (((desc)-b  21)  1)
-
-int do_get_thread_area(struct thread_struct *t, struct user_desc __user 
*u_info)
-{
-   struct user_desc info;
-   struct n_desc_struct *desc;
-   int idx;
-
-   if (get_user(idx, u_info-entry_number))
-   return -EFAULT;
-   if (idx  GDT_ENTRY_TLS_MIN || idx  GDT_ENTRY_TLS_MAX)
-   return -EINVAL;
-
-   desc = ((struct n_desc_struct *)t-tls_array) + idx - GDT_ENTRY_TLS_MIN;
-
-   memset(info, 0, sizeof(struct user_desc));
-   info.entry_number = idx;
-   

x86: TLS cleanup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=efd1ca52d04d2f6df337a3332cee56cd60e6d4c4
Commit: efd1ca52d04d2f6df337a3332cee56cd60e6d4c4
Parent: 13abd0e50433092c41551bc13c32268028b6d663
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:46 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:46 2008 +0100

x86: TLS cleanup

This consolidates the four different places that implemented the same
encoding magic for the GDT-slot 32-bit TLS support.  The old tls32.c was
renamed and is now only slightly modified to be the shared implementation.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: Zachary Amsden [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ia32entry.S|4 +-
 arch/x86/kernel/Makefile_32  |1 +
 arch/x86/kernel/process_32.c |  141 ++
 arch/x86/kernel/process_64.c |3 +-
 arch/x86/kernel/ptrace_32.c  |   91 +++-
 arch/x86/kernel/ptrace_64.c  |   26 +++-
 arch/x86/kernel/tls.c|   96 +++-
 include/asm-x86/ia32.h   |6 --
 include/asm-x86/ptrace.h |   11 +++
 9 files changed, 77 insertions(+), 302 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 2499a32..0db0a62 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -643,8 +643,8 @@ ia32_sys_call_table:
.quad compat_sys_futex  /* 240 */
.quad compat_sys_sched_setaffinity
.quad compat_sys_sched_getaffinity
-   .quad sys32_set_thread_area
-   .quad sys32_get_thread_area
+   .quad sys_set_thread_area
+   .quad sys_get_thread_area
.quad compat_sys_io_setup   /* 245 */
.quad sys_io_destroy
.quad compat_sys_io_getevents
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index 2c9596b..9a6577a 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -10,6 +10,7 @@ obj-y := process_32.o signal_32.o entry_32.o traps_32.o 
irq_32.o \
pci-dma_32.o i386_ksyms_32.o i387_32.o bootflag.o e820_32.o\
quirks.o i8237.o topology.o alternative.o i8253.o tsc_32.o 
io_delay.o rtc.o
 
+obj-y  += tls.o
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
 obj-y  += cpu/
 obj-y  += acpi/
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 631af16..4d66a56 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -501,32 +501,15 @@ int copy_thread(int nr, unsigned long clone_flags, 
unsigned long esp,
set_tsk_thread_flag(p, TIF_IO_BITMAP);
}
 
+   err = 0;
+
/*
 * Set a new TLS for the child thread?
 */
-   if (clone_flags  CLONE_SETTLS) {
-   struct desc_struct *desc;
-   struct user_desc info;
-   int idx;
-
-   err = -EFAULT;
-   if (copy_from_user(info, (void __user *)childregs-esi, 
sizeof(info)))
-   goto out;
-   err = -EINVAL;
-   if (LDT_empty(info))
-   goto out;
-
-   idx = info.entry_number;
-   if (idx  GDT_ENTRY_TLS_MIN || idx  GDT_ENTRY_TLS_MAX)
-   goto out;
-
-   desc = p-thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
-   desc-a = LDT_entry_a(info);
-   desc-b = LDT_entry_b(info);
-   }
+   if (clone_flags  CLONE_SETTLS)
+   err = do_set_thread_area(p, -1,
+   (struct user_desc __user *)childregs-esi, 0);
 
-   err = 0;
- out:
if (err  p-thread.io_bitmap_ptr) {
kfree(p-thread.io_bitmap_ptr);
p-thread.io_bitmap_max = 0;
@@ -872,120 +855,6 @@ unsigned long get_wchan(struct task_struct *p)
return 0;
 }
 
-/*
- * sys_alloc_thread_area: get a yet unused TLS descriptor index.
- */
-static int get_free_idx(void)
-{
-   struct thread_struct *t = current-thread;
-   int idx;
-
-   for (idx = 0; idx  GDT_ENTRY_TLS_ENTRIES; idx++)
-   if (desc_empty(t-tls_array + idx))
-   return idx + GDT_ENTRY_TLS_MIN;
-   return -ESRCH;
-}
-
-/*
- * Set a given TLS descriptor:
- */
-asmlinkage int sys_set_thread_area(struct user_desc __user *u_info)
-{
-   struct thread_struct *t = current-thread;
-   struct user_desc info;
-   struct desc_struct *desc;
-   int cpu, idx;
-
-   if (copy_from_user(info, u_info, sizeof(info)))
-   return -EFAULT;
-   idx = info.entry_number;
-
-   /*
-* index -1 

x86: use get_desc_base

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=91394eb0975b3771dde7071a0825c6df6c20ff8a
Commit: 91394eb0975b3771dde7071a0825c6df6c20ff8a
Parent: 859c0a5b9ca8eba2d65fa42f02505d76f8a712c7
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:45 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:45 2008 +0100

x86: use get_desc_base

This changes a couple of places to use the get_desc_base function.
They were duplicating the same calculation with different equivalent code.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/tls32.c|7 +--
 arch/x86/kernel/process_64.c |6 +-
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/x86/ia32/tls32.c b/arch/x86/ia32/tls32.c
index 1cc4340..cac4b26 100644
--- a/arch/x86/ia32/tls32.c
+++ b/arch/x86/ia32/tls32.c
@@ -85,11 +85,6 @@ asmlinkage long sys32_set_thread_area(struct user_desc 
__user *u_info)
  * Get the current Thread-Local Storage area:
  */
 
-#define GET_BASE(desc) ( \
-   (((desc)-a  16)  0x) | \
-   (((desc)-b  16)  0x00ff) | \
-   ( (desc)-b 0xff00)   )
-
 #define GET_LIMIT(desc) ( \
((desc)-a  0x0) | \
 ((desc)-b  0xf) )
@@ -117,7 +112,7 @@ int do_get_thread_area(struct thread_struct *t, struct 
user_desc __user *u_info)
 
memset(info, 0, sizeof(struct user_desc));
info.entry_number = idx;
-   info.base_addr = GET_BASE(desc);
+   info.base_addr = get_desc_base(desc);
info.limit = GET_LIMIT(desc);
info.seg_32bit = GET_32BIT(desc);
info.contents = GET_CONTENTS(desc);
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index aa9414e..9ea1d75 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -464,11 +464,7 @@ static inline void set_32bit_tls(struct task_struct *t, 
int tls, u32 addr)
 
 static inline u32 read_32bit_tls(struct task_struct *t, int tls)
 {
-   struct desc_struct *desc = (void *)t-thread.tls_array;
-   desc += tls;
-   return desc-base0 | 
-   (((u32)desc-base1)  16) | 
-   (((u32)desc-base2)  24);
+   return get_desc_base(t-thread.tls_array[tls]);
 }
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: sanitize user specified e820 memmap values

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b3ca74a2bfc66262d21443b160815eb26d6699e6
Commit: b3ca74a2bfc66262d21443b160815eb26d6699e6
Parent: efd1ca52d04d2f6df337a3332cee56cd60e6d4c4
Author: Vladimir Berezniker [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:46 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:46 2008 +0100

x86: sanitize user specified e820 memmap values

Sanitize user specified e820 memory ranges, using the same logic that is
applied to the values returned by the BIOS.  This ensures consistent
handling regardless of the source of the memory mappings.

Allows overriding portions of the memory map without specifying one in
it's entirety (memmap=exactmap).

E.g. marking a range of bad RAM as reserved with memmap=48M$528M

BIOS supplied range

BIOS-e820: 0010 - 7fe8 (usable)

becomes

user: 0010 - 2100 (usable)
user: 2100 - 2400 (reserved)
user: 2400 - 7fe8 (usable)

Previously this did not work, as the original BIOS range was left
untouched while the user defined range was appended to the end of the
memory map.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Vladimir Berezniker [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/e820_64.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 1512368..8e73211 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -691,6 +691,8 @@ static int __init parse_memmap_opt(char *p)
mem_size = memparse(p, p);
if (p == oldp)
return -EINVAL;
+
+   userdef = 1;
if (*p == '@') {
start_at = memparse(p+1, p);
add_memory_region(start_at, mem_size, E820_RAM);
@@ -710,6 +712,12 @@ early_param(memmap, parse_memmap_opt);
 void __init finish_e820_parsing(void)
 {
if (userdef) {
+   char nr = e820.nr_map;
+
+   if (sanitize_e820_map(e820.map, nr)  0)
+   early_panic(Invalid user supplied memory map);
+   e820.nr_map = nr;
+
printk(KERN_INFO user-defined physical RAM map:\n);
e820_print_map(user);
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: set cpu_index to nr_cpus instead of 0

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=949ec325c79add68af13705b68a885a1efb84234
Commit: 949ec325c79add68af13705b68a885a1efb84234
Parent: b3ca74a2bfc66262d21443b160815eb26d6699e6
Author: Yinghai Lu [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:46 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:46 2008 +0100

x86: set cpu_index to nr_cpus instead of 0

Some BIOSes that support two/four dualcore/quadcore systems, will get:

ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
Processor #0 15:1 APIC version 16
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x01] enabled)
Processor #1 15:1 APIC version 16
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x02] enabled)
Processor #2 15:1 APIC version 16
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x03] enabled)
Processor #3 15:1 APIC version 16
ACPI: LAPIC (acpi_id[0x05] lapic_id[0x84] disabled)
ACPI: LAPIC (acpi_id[0x06] lapic_id[0x85] disabled)
ACPI: LAPIC (acpi_id[0x07] lapic_id[0x86] disabled)
ACPI: LAPIC (acpi_id[0x08] lapic_id[0x87] disabled)
ACPI: LAPIC (acpi_id[0x09] lapic_id[0x88] disabled)
ACPI: LAPIC (acpi_id[0x0a] lapic_id[0x89] disabled)
ACPI: LAPIC (acpi_id[0x0b] lapic_id[0x8a] disabled)
ACPI: LAPIC (acpi_id[0x0c] lapic_id[0x8b] disabled)
ACPI: LAPIC (acpi_id[0x0d] lapic_id[0x8c] disabled)
ACPI: LAPIC (acpi_id[0x0e] lapic_id[0x8d] disabled)
ACPI: LAPIC (acpi_id[0x0f] lapic_id[0x8e] disabled)
ACPI: LAPIC (acpi_id[0x10] lapic_id[0x8f] disabled)

SMP: Allowing 16 CPUs, 12 hotplug CPUs

the /proc/cpuinfo will show a bunch of NULL cpus with cpu_index=0

so assign impossible cpu_index value at first instead of 0.

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/smpboot_64.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index ddefb38..8ac8eb6 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -861,6 +861,18 @@ void __init smp_set_apicids(void)
x86_cpu_to_apicid_ptr = NULL;
 }
 
+static void __init smp_cpu_index_default(void)
+{
+   int i;
+   struct cpuinfo_x86 *c;
+
+   for_each_cpu_mask(i, cpu_possible_map) {
+   c = cpu_data(i);
+   /* mark all to hotplug */
+   c-cpu_index = NR_CPUS;
+   }
+}
+
 /*
  * Prepare for SMP bootup.  The MP table or ACPI has been read
  * earlier.  Just do some sanity checking here and enable APIC mode.
@@ -868,6 +880,7 @@ void __init smp_set_apicids(void)
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
nmi_watchdog_default();
+   smp_cpu_index_default();
current_cpu_data = boot_cpu_data;
current_thread_info()-cpu = 0;  /* needed? */
smp_set_apicids();
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: do not set boot cpu in cpu_online_map at x86_64_start_kernel()

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9de819fe72fc6979ddd18aa04ef9e2af5aa8bc5f
Commit: 9de819fe72fc6979ddd18aa04ef9e2af5aa8bc5f
Parent: 949ec325c79add68af13705b68a885a1efb84234
Author: Yinghai Lu [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:46 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:46 2008 +0100

x86: do not set boot cpu in cpu_online_map at x86_64_start_kernel()

In init/main.c boot_cpu_init() does that later.

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Cc: Zachary Amsden [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/head64.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 6643f3f..4a1c135 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -69,8 +69,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
 
pda_init(0);
copy_bootdata(__va(real_mode_data));
-#ifdef CONFIG_SMP
-   cpu_set(0, cpu_online_map);
-#endif
+
start_kernel();
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: vmlinux_32.lds.S: remove repeated comment from the x86-32 linker script

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ebd1290ba12121d66285cc06987ca97bcdfc55b
Commit: 4ebd1290ba12121d66285cc06987ca97bcdfc55b
Parent: 9de819fe72fc6979ddd18aa04ef9e2af5aa8bc5f
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:46 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:46 2008 +0100

x86: vmlinux_32.lds.S: remove repeated comment from the x86-32 linker script

Remove repeated comment from the linker script for the x86-32 target.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/vmlinux_32.lds.S |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 84c913f..ec07258 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -8,12 +8,6 @@
  * put it inside the section definition.
  */
 
-/* Don't define absolute symbols until and unless you know that symbol
- * value is should remain constant even if kernel image is relocated
- * at run time. Absolute symbols are not relocated. If symbol value should
- * change if kernel is relocated, make the symbol section relative and
- * put it inside the section definition.
- */
 #define LOAD_OFFSET __PAGE_OFFSET
 
 #include asm-generic/vmlinux.lds.h
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: 64-bit, make sparsemem vmemmap the only memory model

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b263295dbffd33b0fbff670720fa178c30e3392a
Commit: b263295dbffd33b0fbff670720fa178c30e3392a
Parent: 4ebd1290ba12121d66285cc06987ca97bcdfc55b
Author: Christoph Lameter [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:47 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:47 2008 +0100

x86: 64-bit, make sparsemem vmemmap the only memory model

Use sparsemem as the only memory model for UP, SMP and NUMA.  Measurements
indicate that DISCONTIGMEM has a higher overhead than sparsemem.  And
FLATMEMs benefits are minimal.  So I think its best to simply standardize
on sparsemem.

Results of page allocator tests (test can be had via git from slab git
tree branch tests)

Measurements in cycle counts. 1000 allocations were performed and then the
average cycle count was calculated.

Order   FlatMem Discontig   SparseMem
0 639 665 641
1 567 647 593
2 679 774 692
3 763 967 781
4 9611501 962
5135623441392
6222439822336
7486972255074
8   12500   14048   12732
9   27926   28223   28165
10  58578   58714   58682

(Note that FlatMem is an SMP config and the rest NUMA configurations)

Memory use:

SMP Sparsemem
-

Kernel size:

   textdata bss dec hex filename
3849268  397739 1264856 5511863  541ab7 vmlinux

 total   used   free sharedbuffers cached
Mem:   8242252  411648201088  0352  11512
-/+ buffers/cache:  293008212952
Swap:  9775512  09775512

SMP Flatmem
---

Kernel size:

   textdata bss dec hex filename
3844612  397739 1264536 5506887  540747 vmlinux

So 4.5k growth in text size vs. FLATMEM.

 total   used   free sharedbuffers cached
Mem:   8244052  405448203508  0352  11484
-/+ buffers/cache:  287088215344

2k growth in overall memory use after boot.

NUMA discontig:

   textdata bss dec hex filename
3888124  470659 1276504 5635287  55fcd7 vmlinux

 total   used   free sharedbuffers cached
Mem:   8256256  569088199348  0352  11496
-/+ buffers/cache:  450608211196
Swap:  9775512  09775512

NUMA sparse:

   textdata bss dec hex filename
3896428  470659 1276824 5643911  561e87 vmlinux

8k text growth. Given that we fully inline virt_to_page and friends now
that is rather good.

 total   used   free sharedbuffers cached
Mem:   8264720  572408207480  0352  11516
-/+ buffers/cache:  453728219348
Swap:  9775512  09775512

The total available memory is increased by 8k.

This patch makes sparsemem the default and removes discontig and
flatmem support from x86.

[ [EMAIL PROTECTED]: allnoconfig build fix ]

Acked-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/Kconfig   |   22 ++
 arch/x86/configs/x86_64_defconfig  |9 --
 arch/x86/kernel/machine_kexec_64.c |5 ---
 arch/x86/mm/init_64.c  |   28 -
 arch/x86/mm/ioremap_64.c   |   17 ---
 arch/x86/mm/numa_64.c  |   21 -
 arch/x86/mm/srat_64.c  |   57 
 include/asm-x86/mmzone_64.h|6 
 include/asm-x86/page_64.h  |3 --
 9 files changed, 9 insertions(+), 159 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 2f4d88b..da98368 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -891,25 +891,29 @@ config HAVE_ARCH_ALLOC_REMAP
 
 config ARCH_FLATMEM_ENABLE
def_bool y
-   depends on (X86_32  ARCH_SELECT_MEMORY_MODEL  X86_PC) || (X86_64  
!NUMA)
+   depends on X86_32  ARCH_SELECT_MEMORY_MODEL  X86_PC
 
 config ARCH_DISCONTIGMEM_ENABLE
def_bool y
-   depends on NUMA
+   depends on NUMA  X86_32
 
 config ARCH_DISCONTIGMEM_DEFAULT
def_bool y
-   depends on NUMA
+   depends on NUMA  X86_32
+
+config ARCH_SPARSEMEM_DEFAULT
+   def_bool y
+   depends on 

mips, x86: optimize the i8259 code a bit

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5f627f8e122a163ce53908d55e088247db31f1d7
Commit: 5f627f8e122a163ce53908d55e088247db31f1d7
Parent: b263295dbffd33b0fbff670720fa178c30e3392a
Author: Ralf Baechle [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:47 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:47 2008 +0100

mips, x86: optimize the i8259 code a bit

The timer code always calls the clock_event_device set_net_event and
set_mode methods with interrupts disabled, so no need to use
spin_lock_irqsave / spin_unlock_irqrestore for those.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]
Acked-by:Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/mips/kernel/i8253.c |   12 
 arch/x86/kernel/i8253.c  |   12 
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index c2d497c..fc4aa07 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -24,9 +24,7 @@ DEFINE_SPINLOCK(i8253_lock);
 static void init_pit_timer(enum clock_event_mode mode,
   struct clock_event_device *evt)
 {
-   unsigned long flags;
-
-   spin_lock_irqsave(i8253_lock, flags);
+   spin_lock(i8253_lock);
 
switch(mode) {
case CLOCK_EVT_MODE_PERIODIC:
@@ -55,7 +53,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */
break;
}
-   spin_unlock_irqrestore(i8253_lock, flags);
+   spin_unlock(i8253_lock);
 }
 
 /*
@@ -65,12 +63,10 @@ static void init_pit_timer(enum clock_event_mode mode,
  */
 static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
 {
-   unsigned long flags;
-
-   spin_lock_irqsave(i8253_lock, flags);
+   spin_lock(i8253_lock);
outb_p(delta  0xff , PIT_CH0); /* LSB */
outb(delta  8 , PIT_CH0); /* MSB */
-   spin_unlock_irqrestore(i8253_lock, flags);
+   spin_unlock(i8253_lock);
 
return 0;
 }
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index 377c3f8..c76fef1 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -38,9 +38,7 @@ struct clock_event_device *global_clock_event;
 static void init_pit_timer(enum clock_event_mode mode,
   struct clock_event_device *evt)
 {
-   unsigned long flags;
-
-   spin_lock_irqsave(i8253_lock, flags);
+   spin_lock(i8253_lock);
 
switch(mode) {
case CLOCK_EVT_MODE_PERIODIC:
@@ -71,7 +69,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */
break;
}
-   spin_unlock_irqrestore(i8253_lock, flags);
+   spin_unlock(i8253_lock);
 }
 
 /*
@@ -81,12 +79,10 @@ static void init_pit_timer(enum clock_event_mode mode,
  */
 static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
 {
-   unsigned long flags;
-
-   spin_lock_irqsave(i8253_lock, flags);
+   spin_lock(i8253_lock);
outb_p(delta  0xff , PIT_CH0); /* LSB */
outb(delta  8 , PIT_CH0); /* MSB */
-   spin_unlock_irqrestore(i8253_lock, flags);
+   spin_unlock(i8253_lock);
 
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: fall back on interrupt disable in cmpxchg8b on 80386 and 80486

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2c0b8a7578f7653e1e5312a5232e8ead563cf477
Commit: 2c0b8a7578f7653e1e5312a5232e8ead563cf477
Parent: 5f627f8e122a163ce53908d55e088247db31f1d7
Author: Mathieu Desnoyers [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:47 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:47 2008 +0100

x86: fall back on interrupt disable in cmpxchg8b on 80386 and 80486

Actually, on 386, cmpxchg and cmpxchg_local fall back on
cmpxchg_386_u8/16/32: it disables interruptions around non atomic
updates to mimic the cmpxchg behavior.

The comment:
/* Poor man's cmpxchg for 386. Unsuitable for SMP */

already present in cmpxchg_386_u32 tells much about how this cmpxchg
implementation should not be used in a SMP context. However, the 
cmpxchg_local
can perfectly use this fallback, since it only needs to be atomic wrt the 
local
cpu.

This patch adds a cmpxchg_486_u64 and uses it as a fallback for cmpxchg64
and cmpxchg64_local on 80386 and 80486.

Q:
but why is it called cmpxchg_486 when the other functions are called

A:
Because the standard cmpxchg is missing only on 386, but cmpxchg8b is
missing both on 386 and 486.

Citing Intel's Instruction set reference:

cmpxchg:
This instruction is not supported on Intel processors earlier than the
Intel486 processors.

cmpxchg8b:
This instruction encoding is not supported on Intel processors earlier
than the Pentium processors.

Q:
What's the reason to have cmpxchg64_local on 32 bit architectures?
Without that need all this would just be a few simple defines.

A:
cmpxchg64_local on 32 bits architectures takes unsigned long long
parameters, but cmpxchg_local only takes longs. Since we have cmpxchg8b
to execute a 8 byte cmpxchg atomically on pentium and +, it makes sense
to provide a flavor of cmpxchg and cmpxchg_local using this instruction.

Also, for 32 bits architectures lacking the 64 bits atomic cmpxchg, it
makes sense _not_ to define cmpxchg64 while cmpxchg could still be
available.

Moreover, the fallback for cmpxchg8b on i386 for 386 and 486 is a

However, cmpxchg64_local will be emulated by disabling interrupts on all
architectures where it is not supported atomically.

Therefore, we *could* turn cmpxchg64_local into a cmpxchg_local, but it
would make the 386/486 fallbacks ugly, make its design different from
cmpxchg/cmpxchg64 (which really depends on atomic operations and cannot
be emulated) and require the __cmpxchg_local to be expressed as a macro
rather than an inline function so the parameters would not be fixed to
unsigned long long in every case.

So I think cmpxchg64_local makes sense there, but I am open to
suggestions.

Q:
Are there any callers?

A:
I am actually using it in LTTng in my timestamping code. I use it to
work around CPUs with asynchronous TSCs. I need to update 64 bits
values atomically on this 32 bits architecture.

Changelog:
- Ran though checkpatch.

Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/cpu/intel.c  |   17 ++
 include/asm-x86/cmpxchg_32.h |  122 +++---
 2 files changed, 96 insertions(+), 43 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index cc8c501..867ff94 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -342,5 +342,22 @@ unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, 
u32 new)
 EXPORT_SYMBOL(cmpxchg_386_u32);
 #endif
 
+#ifndef CONFIG_X86_CMPXCHG64
+unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new)
+{
+   u64 prev;
+   unsigned long flags;
+
+   /* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */
+   local_irq_save(flags);
+   prev = *(u64 *)ptr;
+   if (prev == old)
+   *(u64 *)ptr = new;
+   local_irq_restore(flags);
+   return prev;
+}
+EXPORT_SYMBOL(cmpxchg_486_u64);
+#endif
+
 // arch_initcall(intel_cpu_init);
 
diff --git a/include/asm-x86/cmpxchg_32.h b/include/asm-x86/cmpxchg_32.h
index f86ede2..cea1dae 100644
--- a/include/asm-x86/cmpxchg_32.h
+++ b/include/asm-x86/cmpxchg_32.h
@@ -105,15 +105,24 @@ static inline unsigned long __xchg(unsigned long x, 
volatile void * ptr, int siz
 
 #ifdef CONFIG_X86_CMPXCHG
 #define __HAVE_ARCH_CMPXCHG 1
-#define cmpxchg(ptr,o,n)\
-   ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
-   (unsigned long)(n),sizeof(*(ptr

ptrace: arch_has_single_step

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb7fa8f1741c91f6c6e958762155abe9339476ca
Commit: fb7fa8f1741c91f6c6e958762155abe9339476ca
Parent: 022eb43419f896a3647f769cdc3b5e13a8fb8ee7
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:47 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:47 2008 +0100

ptrace: arch_has_single_step

This defines the new macro arch_has_single_step() in linux/ptrace.h, a
default for when asm/ptrace.h does not define it.  It declares the new
user_enable_single_step and user_disable_single_step functions.
This is not used yet, but paves the way to harmonize on this interface
for the arch-specific calls on all machines.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/linux/ptrace.h |   46 ++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 3ea5750..8f06c6f 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -129,6 +129,52 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long 
addr, long data);
 #define force_successful_syscall_return() do { } while (0)
 #endif
 
+/*
+ * asm/ptrace.h should define the following things inside #ifdef __KERNEL__.
+ *
+ * These do-nothing inlines are used when the arch does not
+ * implement single-step.  The kerneldoc comments are here
+ * to document the interface for all arch definitions.
+ */
+
+#ifndef arch_has_single_step
+/**
+ * arch_has_single_step - does this CPU support user-mode single-step?
+ *
+ * If this is defined, then there must be function declarations or
+ * inlines for user_enable_single_step() and user_disable_single_step().
+ * arch_has_single_step() should evaluate to nonzero iff the machine
+ * supports instruction single-step for user mode.
+ * It can be a constant or it can test a CPU feature bit.
+ */
+#define arch_has_single_step() (0)
+
+/**
+ * user_enable_single_step - single-step in user-mode task
+ * @task: either current or a task stopped in %TASK_TRACED
+ *
+ * This can only be called when arch_has_single_step() has returned nonzero.
+ * Set @task so that when it returns to user mode, it will trap after the
+ * next single instruction executes.
+ */
+static inline void user_enable_single_step(struct task_struct *task)
+{
+   BUG();  /* This can never be called.  */
+}
+
+/**
+ * user_disable_single_step - cancel user-mode single-step
+ * @task: either current or a task stopped in %TASK_TRACED
+ *
+ * Clear @task of the effects of user_enable_single_step().  This can
+ * be called whether or not user_enable_single_step() was ever called
+ * on @task, and even if arch_has_single_step() returned zero.
+ */
+static inline void user_disable_single_step(struct task_struct *task)
+{
+}
+#endif /* arch_has_single_step */
+
 #endif
 
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: kmap_atomic() debugging

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=022eb43419f896a3647f769cdc3b5e13a8fb8ee7
Commit: 022eb43419f896a3647f769cdc3b5e13a8fb8ee7
Parent: 2c0b8a7578f7653e1e5312a5232e8ead563cf477
Author: Andrew Morton [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:47 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:47 2008 +0100

x86: kmap_atomic() debugging

[ [EMAIL PROTECTED]: cleanups and made dependent on CONFIG_DEBUG_HIGHMEM.

  this caught a handful of bugs already, so lets apply it. If it gets
  things wrong we'll disable it. ]

Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/mm/highmem_32.c |   47 +-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 1c3bf95..3d936f2 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -18,6 +18,49 @@ void kunmap(struct page *page)
kunmap_high(page);
 }
 
+static void debug_kmap_atomic_prot(enum km_type type)
+{
+#ifdef CONFIG_DEBUG_HIGHMEM
+   static unsigned warn_count = 10;
+
+   if (unlikely(warn_count == 0))
+   return;
+
+   if (unlikely(in_interrupt())) {
+   if (in_irq()) {
+   if (type != KM_IRQ0  type != KM_IRQ1 
+   type != KM_BIO_SRC_IRQ  type != KM_BIO_DST_IRQ 
+   type != KM_BOUNCE_READ) {
+   WARN_ON(1);
+   warn_count--;
+   }
+   } else if (!irqs_disabled()) {  /* softirq */
+   if (type != KM_IRQ0  type != KM_IRQ1 
+   type != KM_SOFTIRQ0  type != KM_SOFTIRQ1 
+   type != KM_SKB_SUNRPC_DATA 
+   type != KM_SKB_DATA_SOFTIRQ 
+   type != KM_BOUNCE_READ) {
+   WARN_ON(1);
+   warn_count--;
+   }
+   }
+   }
+
+   if (type == KM_IRQ0 || type == KM_IRQ1 || type == KM_BOUNCE_READ ||
+   type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ) {
+   if (!irqs_disabled()) {
+   WARN_ON(1);
+   warn_count--;
+   }
+   } else if (type == KM_SOFTIRQ0 || type == KM_SOFTIRQ1) {
+   if (irq_count() == 0  !irqs_disabled()) {
+   WARN_ON(1);
+   warn_count--;
+   }
+   }
+#endif
+}
+
 /*
  * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
  * no global lock is needed and because the kmap code must perform a global TLB
@@ -30,8 +73,10 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, 
pgprot_t prot)
 {
enum fixed_addresses idx;
unsigned long vaddr;
-
/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
+
+   debug_kmap_atomic_prot(type);
+
pagefault_disable();
 
if (!PageHighMem(page))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: segment selector macros

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2608a6584a0a32d3251dfafad31d9f8b2c784466
Commit: 2608a6584a0a32d3251dfafad31d9f8b2c784466
Parent: fb7fa8f1741c91f6c6e958762155abe9339476ca
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:48 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:48 2008 +0100

x86: segment selector macros

This copies into asm-x86/segment_64.h some macros from asm-x86/segment_32.h
for dissecting segment selectors.  This lets other code use these macros
uniformly on 32/64-bit rather than duplicating the constants elsewhere.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/segment_64.h |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/segment_64.h b/include/asm-x86/segment_64.h
index 04b8ab2..dce7421 100644
--- a/include/asm-x86/segment_64.h
+++ b/include/asm-x86/segment_64.h
@@ -50,4 +50,15 @@
 #define GDT_SIZE (GDT_ENTRIES * 8)
 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) 
 
+/* Bottom two bits of selector give the ring privilege level */
+#define SEGMENT_RPL_MASK   0x3
+/* Bit 2 is table indicator (LDT/GDT) */
+#define SEGMENT_TI_MASK0x4
+
+/* User mode is privilege level 3 */
+#define USER_RPL   0x3
+/* LDT segment has TI set, GDT has it cleared */
+#define SEGMENT_LDT0x4
+#define SEGMENT_GDT0x0
+
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: remove TRAP_FLAG

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=77c03dcd448aa4c7be45f4edb97381ef463e3911
Commit: 77c03dcd448aa4c7be45f4edb97381ef463e3911
Parent: 2608a6584a0a32d3251dfafad31d9f8b2c784466
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:48 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:48 2008 +0100

x86: remove TRAP_FLAG

This gets rid of the local constant macro TRAP_FLAG.
It's redundant with the public constant macro X86_EFLAGS_TF.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_32.c |9 +++--
 arch/x86/kernel/ptrace_64.c |9 +++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 09227cf..4619bda 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -37,9 +37,6 @@
  */
 #define FLAG_MASK 0x00050dd5
 
-/* set's the trap flag. */
-#define TRAP_FLAG 0x100
-
 /*
  * Offset of eflags on child stack..
  */
@@ -235,11 +232,11 @@ static void set_singlestep(struct task_struct *child)
/*
 * If TF was already set, don't do anything else
 */
-   if (regs-eflags  TRAP_FLAG)
+   if (regs-eflags  X86_EFLAGS_TF)
return;
 
/* Set TF on the kernel stack.. */
-   regs-eflags |= TRAP_FLAG;
+   regs-eflags |= X86_EFLAGS_TF;
 
/*
 * ..but if TF is changed by the instruction we will trace,
@@ -260,7 +257,7 @@ static void clear_singlestep(struct task_struct *child)
/* But touch TF only if it was set by us.. */
if (child-ptrace  PT_DTRACE) {
struct pt_regs *regs = get_child_regs(child);
-   regs-eflags = ~TRAP_FLAG;
+   regs-eflags = ~X86_EFLAGS_TF;
child-ptrace = ~PT_DTRACE;
}
 }
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 375fadc..8e433b3 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -42,9 +42,6 @@
  */
 #define FLAG_MASK 0x54dd5UL
 
-/* set's the trap flag. */
-#define TRAP_FLAG 0x100UL
-
 /*
  * eflags and offset of eflags on child stack..
  */
@@ -187,11 +184,11 @@ static void set_singlestep(struct task_struct *child)
/*
 * If TF was already set, don't do anything else
 */
-   if (regs-eflags  TRAP_FLAG)
+   if (regs-eflags  X86_EFLAGS_TF)
return;
 
/* Set TF on the kernel stack.. */
-   regs-eflags |= TRAP_FLAG;
+   regs-eflags |= X86_EFLAGS_TF;
 
/*
 * ..but if TF is changed by the instruction we will trace,
@@ -212,7 +209,7 @@ static void clear_singlestep(struct task_struct *child)
/* But touch TF only if it was set by us.. */
if (child-ptrace  PT_DTRACE) {
struct pt_regs *regs = task_pt_regs(child);
-   regs-eflags = ~TRAP_FLAG;
+   regs-eflags = ~X86_EFLAGS_TF;
child-ptrace = ~PT_DTRACE;
}
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: arch_has_single_step

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7f232343e0ea37ffc0a552cdbd4825482c949281
Commit: 7f232343e0ea37ffc0a552cdbd4825482c949281
Parent: 77c03dcd448aa4c7be45f4edb97381ef463e3911
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:48 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:48 2008 +0100

x86: arch_has_single_step

This defines the new standard arch_has_single_step macro.  It makes the
existing set_singlestep and clear_singlestep entry points global, and
renames them to the new standard names user_enable_single_step and
user_disable_single_step, respectively.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_32.c |   12 ++--
 arch/x86/kernel/ptrace_64.c |   12 ++--
 include/asm-x86/ptrace.h|7 +++
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 4619bda..1402a54 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -218,7 +218,7 @@ static inline int is_setting_trap_flag(struct task_struct 
*child, struct pt_regs
return 0;
 }
 
-static void set_singlestep(struct task_struct *child)
+void user_enable_single_step(struct task_struct *child)
 {
struct pt_regs *regs = get_child_regs(child);
 
@@ -249,7 +249,7 @@ static void set_singlestep(struct task_struct *child)
child-ptrace |= PT_DTRACE;
 }
 
-static void clear_singlestep(struct task_struct *child)
+void user_disable_single_step(struct task_struct *child)
 {
/* Always clear TIF_SINGLESTEP... */
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -269,7 +269,7 @@ static void clear_singlestep(struct task_struct *child)
  */
 void ptrace_disable(struct task_struct *child)
 { 
-   clear_singlestep(child);
+   user_disable_single_step(child);
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 }
 
@@ -403,7 +403,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
}
child-exit_code = data;
/* make sure the single step bit is not set. */
-   clear_singlestep(child);
+   user_disable_single_step(child);
wake_up_process(child);
ret = 0;
break;
@@ -419,7 +419,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
break;
child-exit_code = SIGKILL;
/* make sure the single step bit is not set. */
-   clear_singlestep(child);
+   user_disable_single_step(child);
wake_up_process(child);
break;
 
@@ -435,7 +435,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   set_singlestep(child);
+   user_enable_single_step(child);
child-exit_code = data;
/* give it a chance to run. */
wake_up_process(child);
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 8e433b3..7373a99 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -170,7 +170,7 @@ static int is_setting_trap_flag(struct task_struct *child, 
struct pt_regs *regs)
return 0;
 }
 
-static void set_singlestep(struct task_struct *child)
+void user_enable_single_step(struct task_struct *child)
 {
struct pt_regs *regs = task_pt_regs(child);
 
@@ -201,7 +201,7 @@ static void set_singlestep(struct task_struct *child)
child-ptrace |= PT_DTRACE;
 }
 
-static void clear_singlestep(struct task_struct *child)
+void user_disable_single_step(struct task_struct *child)
 {
/* Always clear TIF_SINGLESTEP... */
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -221,7 +221,7 @@ static void clear_singlestep(struct task_struct *child)
  */
 void ptrace_disable(struct task_struct *child)
 { 
-   clear_singlestep(child);
+   user_disable_single_step(child);
 }
 
 static int putreg(struct task_struct *child,
@@ -461,7 +461,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
child-exit_code = data;
/* make sure the single step bit is not set. */
-   clear_singlestep(child);
+   user_disable_single_step(child);
wake_up_process(child);
ret = 0;
break;
@@ -504,7 +504,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)

x86: single_step 0xf0

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5f76cb1f6c42e7575256595f85b8b97d84ec669e
Commit: 5f76cb1f6c42e7575256595f85b8b97d84ec669e
Parent: 3f80c1adc900769f2070432419da3b5ddbf066fc
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:50 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:50 2008 +0100

x86: single_step 0xf0

This fixes the 64-bit single-step handling code's instruction
decoder to grok the 0xf0 (lock) prefix, which the 32-bit code
already does correctly.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/step.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 3b70f20..6a93b93 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -66,7 +66,7 @@ static int is_setting_trap_flag(struct task_struct *child, 
struct pt_regs *regs)
case 0x26: case 0x2e:
case 0x36: case 0x3e:
case 0x64: case 0x65:
-   case 0xf2: case 0xf3:
+   case 0xf0: case 0xf2: case 0xf3:
continue;
 
case 0x40 ... 0x4f:
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: single_step moved

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fa1e03eae2f38e7b38095301b043da9c274d2284
Commit: fa1e03eae2f38e7b38095301b043da9c274d2284
Parent: 7f232343e0ea37ffc0a552cdbd4825482c949281
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:50 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:50 2008 +0100

x86: single_step moved

This moves the single-step support code from ptrace_64.c into a new file
step.c, verbatim.  This paves the way for consolidating this code between
64-bit and 32-bit versions.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/Makefile_64 |2 +
 arch/x86/kernel/ptrace_64.c |  134 -
 arch/x86/kernel/step.c  |  140 +++
 3 files changed, 142 insertions(+), 134 deletions(-)

diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index e1ba82e..d908f01 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -13,6 +13,8 @@ obj-y := process_64.o signal_64.o entry_64.o traps_64.o 
irq_64.o \
pci-dma_64.o pci-nommu_64.o alternative.o hpet.o tsc_64.o 
bugs_64.o \
i8253.o io_delay.o rtc.o
 
+obj-y  += step.o
+
 obj-$(CONFIG_IA32_EMULATION)   += tls.o
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
 obj-y  += cpu/
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 7373a99..4abfbce 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -80,140 +80,6 @@ static inline long put_stack_long(struct task_struct *task, 
int offset,
return 0;
 }
 
-#define LDT_SEGMENT 4
-
-unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs 
*regs)
-{
-   unsigned long addr, seg;
-
-   addr = regs-rip;
-   seg = regs-cs  0x;
-
-   /*
-* We'll assume that the code segments in the GDT
-* are all zero-based. That is largely true: the
-* TLS segments are used for data, and the PNPBIOS
-* and APM bios ones we just ignore here.
-*/
-   if (seg  LDT_SEGMENT) {
-   u32 *desc;
-   unsigned long base;
-
-   seg = ~7UL;
-
-   mutex_lock(child-mm-context.lock);
-   if (unlikely((seg  3) = child-mm-context.size))
-   addr = -1L; /* bogus selector, access would fault */
-   else {
-   desc = child-mm-context.ldt + seg;
-   base = ((desc[0]  16) |
-   ((desc[1]  0xff)  16) |
-   (desc[1]  0xff00));
-
-   /* 16-bit code segment? */
-   if (!((desc[1]  22)  1))
-   addr = 0x;
-   addr += base;
-   }
-   mutex_unlock(child-mm-context.lock);
-   }
-
-   return addr;
-}
-
-static int is_setting_trap_flag(struct task_struct *child, struct pt_regs 
*regs)
-{
-   int i, copied;
-   unsigned char opcode[15];
-   unsigned long addr = convert_rip_to_linear(child, regs);
-
-   copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
-   for (i = 0; i  copied; i++) {
-   switch (opcode[i]) {
-   /* popf and iret */
-   case 0x9d: case 0xcf:
-   return 1;
-
-   /* CHECKME: 64 65 */
-
-   /* opcode and address size prefixes */
-   case 0x66: case 0x67:
-   continue;
-   /* irrelevant prefixes (segment overrides and repeats) */
-   case 0x26: case 0x2e:
-   case 0x36: case 0x3e:
-   case 0x64: case 0x65:
-   case 0xf2: case 0xf3:
-   continue;
-
-   case 0x40 ... 0x4f:
-   if (regs-cs != __USER_CS)
-   /* 32-bit mode: register increment */
-   return 0;
-   /* 64-bit mode: REX prefix */
-   continue;
-
-   /* CHECKME: f2, f3 */
-
-   /*
-* pushf: NOTE! We should probably not let
-* the user see the TF bit being set. But
-* it's more pain than it's worth to avoid
-* it, and a debugger could emulate this
-* all in user space if it _really_ cares.
-*/
-   case 0x9c:
-   default:
-   return 0;
-   }
-   }
-   return 0;
-}
-
-void user_enable_single_step(struct task_struct *child)
-{
-   struct pt_regs 

x86: single_step segment macros

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f80c1adc900769f2070432419da3b5ddbf066fc
Commit: 3f80c1adc900769f2070432419da3b5ddbf066fc
Parent: fa1e03eae2f38e7b38095301b043da9c274d2284
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:50 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:50 2008 +0100

x86: single_step segment macros

This cleans up the single-step code to use the asm/segment.h macros
for segment selector magic bits, rather than its own constant.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/step.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index cb3c8bc..3b70f20 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -5,8 +5,6 @@
 #include linux/mm.h
 #include linux/ptrace.h
 
-#define LDT_SEGMENT 4
-
 unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs 
*regs)
 {
unsigned long addr, seg;
@@ -20,7 +18,7 @@ unsigned long convert_rip_to_linear(struct task_struct 
*child, struct pt_regs *r
 * TLS segments are used for data, and the PNPBIOS
 * and APM bios ones we just ignore here.
 */
-   if (seg  LDT_SEGMENT) {
+   if ((seg  SEGMENT_TI_MASK) == SEGMENT_LDT) {
u32 *desc;
unsigned long base;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: single_step: share code

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7122ec8158b0f88befd94f4da8feae2c8d08d1b4
Commit: 7122ec8158b0f88befd94f4da8feae2c8d08d1b4
Parent: 5f76cb1f6c42e7575256595f85b8b97d84ec669e
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:50 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:50 2008 +0100

x86: single_step: share code

This removes the single-step code from ptrace_32.c and uses the step.c code
shared with the 64-bit kernel.  The two versions of the code were nearly
identical already, so the shared code has only a couple of simple #ifdef's.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/Makefile_32 |1 +
 arch/x86/kernel/ptrace_32.c |  125 ---
 arch/x86/kernel/step.c  |   14 +
 3 files changed, 15 insertions(+), 125 deletions(-)

diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index 9a6577a..20e23c4 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -11,6 +11,7 @@ obj-y := process_32.o signal_32.o entry_32.o traps_32.o 
irq_32.o \
quirks.o i8237.o topology.o alternative.o i8253.o tsc_32.o 
io_delay.o rtc.o
 
 obj-y  += tls.o
+obj-y  += step.o
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
 obj-y  += cpu/
 obj-y  += acpi/
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 1402a54..b739608 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -137,131 +137,6 @@ static unsigned long getreg(struct task_struct *child,
return retval;
 }
 
-#define LDT_SEGMENT 4
-
-static unsigned long convert_eip_to_linear(struct task_struct *child, struct 
pt_regs *regs)
-{
-   unsigned long addr, seg;
-
-   addr = regs-eip;
-   seg = regs-xcs  0x;
-   if (regs-eflags  VM_MASK) {
-   addr = (addr  0x) + (seg  4);
-   return addr;
-   }
-
-   /*
-* We'll assume that the code segments in the GDT
-* are all zero-based. That is largely true: the
-* TLS segments are used for data, and the PNPBIOS
-* and APM bios ones we just ignore here.
-*/
-   if (seg  LDT_SEGMENT) {
-   u32 *desc;
-   unsigned long base;
-
-   seg = ~7UL;
-
-   mutex_lock(child-mm-context.lock);
-   if (unlikely((seg  3) = child-mm-context.size))
-   addr = -1L; /* bogus selector, access would fault */
-   else {
-   desc = child-mm-context.ldt + seg;
-   base = ((desc[0]  16) |
-   ((desc[1]  0xff)  16) |
-   (desc[1]  0xff00));
-
-   /* 16-bit code segment? */
-   if (!((desc[1]  22)  1))
-   addr = 0x;
-   addr += base;
-   }
-   mutex_unlock(child-mm-context.lock);
-   }
-   return addr;
-}
-
-static inline int is_setting_trap_flag(struct task_struct *child, struct 
pt_regs *regs)
-{
-   int i, copied;
-   unsigned char opcode[15];
-   unsigned long addr = convert_eip_to_linear(child, regs);
-
-   copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
-   for (i = 0; i  copied; i++) {
-   switch (opcode[i]) {
-   /* popf and iret */
-   case 0x9d: case 0xcf:
-   return 1;
-   /* opcode and address size prefixes */
-   case 0x66: case 0x67:
-   continue;
-   /* irrelevant prefixes (segment overrides and repeats) */
-   case 0x26: case 0x2e:
-   case 0x36: case 0x3e:
-   case 0x64: case 0x65:
-   case 0xf0: case 0xf2: case 0xf3:
-   continue;
-
-   /*
-* pushf: NOTE! We should probably not let
-* the user see the TF bit being set. But
-* it's more pain than it's worth to avoid
-* it, and a debugger could emulate this
-* all in user space if it _really_ cares.
-*/
-   case 0x9c:
-   default:
-   return 0;
-   }
-   }
-   return 0;
-}
-
-void user_enable_single_step(struct task_struct *child)
-{
-   struct pt_regs *regs = get_child_regs(child);
-
-   /*
-* Always set TIF_SINGLESTEP - this guarantees that 
-* we single-step system calls etc..  This will also
-* cause us to set TF when returning to user mode.
- 

x86 single_step: TIF_FORCED_TF

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e1f287735c1e58c653b516931b5d3dd899edcb77
Commit: e1f287735c1e58c653b516931b5d3dd899edcb77
Parent: 7122ec8158b0f88befd94f4da8feae2c8d08d1b4
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:50 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:50 2008 +0100

x86 single_step: TIF_FORCED_TF

This changes the single-step support to use a new thread_info flag
TIF_FORCED_TF instead of the PT_DTRACE flag in task_struct.ptrace.
This keeps arch implementation uses out of this non-arch field.

This changes the ptrace access to eflags to mask TF and maintain
the TIF_FORCED_TF flag directly if userland sets TF, instead of
relying on ptrace_signal_deliver.  The 64-bit and 32-bit kernels
are harmonized on this same behavior.  The ptrace_signal_deliver
approach works now, but this change makes the low-level register
access code reliable when called from different contexts than a
ptrace stop, which will be possible in the future.

The 64-bit do_debug exception handler is also changed not to clear TF
from user-mode registers.  This matches the 32-bit kernel's behavior.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ptrace32.c |   20 ++--
 arch/x86/kernel/process_32.c |3 ---
 arch/x86/kernel/process_64.c |5 -
 arch/x86/kernel/ptrace_32.c  |   17 +
 arch/x86/kernel/ptrace_64.c  |   20 
 arch/x86/kernel/signal_32.c  |   12 +---
 arch/x86/kernel/signal_64.c  |   14 +-
 arch/x86/kernel/step.c   |9 +++--
 arch/x86/kernel/traps_64.c   |   23 +--
 include/asm-x86/signal.h |   11 ++-
 include/asm-x86/thread_info_32.h |2 ++
 include/asm-x86/thread_info_64.h |2 ++
 12 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/arch/x86/ia32/ptrace32.c b/arch/x86/ia32/ptrace32.c
index 9d754b6..5dee334 100644
--- a/arch/x86/ia32/ptrace32.c
+++ b/arch/x86/ia32/ptrace32.c
@@ -89,6 +89,15 @@ static int putreg32(struct task_struct *child, unsigned 
regno, u32 val)
__u64 *flags = stack[offsetof(struct pt_regs, eflags)/8];
 
val = FLAG_MASK;
+   /*
+* If the user value contains TF, mark that
+* it was not us (the debugger) that set it.
+* If not, make sure it stays set if we had.
+*/
+   if (val  X86_EFLAGS_TF)
+   clear_tsk_thread_flag(child, TIF_FORCED_TF);
+   else if (test_tsk_thread_flag(child, TIF_FORCED_TF))
+   val |= X86_EFLAGS_TF;
*flags = val | (*flags  ~FLAG_MASK);
break;
}
@@ -179,9 +188,17 @@ static int getreg32(struct task_struct *child, unsigned 
regno, u32 *val)
R32(eax, rax);
R32(orig_eax, orig_rax);
R32(eip, rip);
-   R32(eflags, eflags);
R32(esp, rsp);
 
+   case offsetof(struct user32, regs.eflags):
+   /*
+* If the debugger set TF, hide it from the readout.
+*/
+   *val = stack[offsetof(struct pt_regs, eflags)/8];
+   if (test_tsk_thread_flag(child, TIF_FORCED_TF))
+   *val = ~X86_EFLAGS_TF;
+   break;
+
case offsetof(struct user32, u_debugreg[0]):
*val = child-thread.debugreg0;
break;
@@ -425,4 +442,3 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 
addr, u32 data)
put_task_struct(child);
return ret;
 }
-
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 4d66a56..d9905c9 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -817,9 +817,6 @@ asmlinkage int sys_execve(struct pt_regs regs)
(char __user * __user *) regs.edx,
regs);
if (error == 0) {
-   task_lock(current);
-   current-ptrace = ~PT_DTRACE;
-   task_unlock(current);
/* Make sure we don't return using sysenter.. */
set_thread_flag(TIF_IRET);
}
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index ccc9d68..f7356e5 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -709,11 +709,6 @@ long sys_execve(char __user *name, char __user * __user 
*argv,
if (IS_ERR(filename)) 
return error;
error = do_execve(filename, argv, envp, regs); 
-   if (error == 0) {
-   task_lock(current);
-   current-ptrace = ~PT_DTRACE;
-   

ptrace: generic resume

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=36df29d7994180cf7f0ccc5d46495855d56d2721
Commit: 36df29d7994180cf7f0ccc5d46495855d56d2721
Parent: e1f287735c1e58c653b516931b5d3dd899edcb77
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:51 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:51 2008 +0100

ptrace: generic resume

This makes ptrace_request handle all the ptrace requests that wake
up the traced task.  These do low-level ptrace implementation magic
that is not arch-specific and should be kept out of arch code.  The
implementations on each arch usually do the same thing.  The new
generic code makes use of the arch_has_single_step macro and generic
entry points to handle PTRACE_SINGLESTEP.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 kernel/ptrace.c |   61 +++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index c719bb9..fad5f1e 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -366,6 +366,50 @@ static int ptrace_setsiginfo(struct task_struct *child, 
siginfo_t __user * data)
return error;
 }
 
+
+#ifdef PTRACE_SINGLESTEP
+#define is_singlestep(request) ((request) == PTRACE_SINGLESTEP)
+#else
+#define is_singlestep(request) 0
+#endif
+
+#ifdef PTRACE_SYSEMU
+#define is_sysemu_singlestep(request)  ((request) == PTRACE_SYSEMU_SINGLESTEP)
+#else
+#define is_sysemu_singlestep(request)  0
+#endif
+
+static int ptrace_resume(struct task_struct *child, long request, long data)
+{
+   if (!valid_signal(data))
+   return -EIO;
+
+   if (request == PTRACE_SYSCALL)
+   set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+   else
+   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+
+#ifdef TIF_SYSCALL_EMU
+   if (request == PTRACE_SYSEMU || request == PTRACE_SYSEMU_SINGLESTEP)
+   set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+   else
+   clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+#endif
+
+   if (is_singlestep(request) || is_sysemu_singlestep(request)) {
+   if (unlikely(!arch_has_single_step()))
+   return -EIO;
+   user_enable_single_step(child);
+   }
+   else
+   user_disable_single_step(child);
+
+   child-exit_code = data;
+   wake_up_process(child);
+
+   return 0;
+}
+
 int ptrace_request(struct task_struct *child, long request,
   long addr, long data)
 {
@@ -390,6 +434,23 @@ int ptrace_request(struct task_struct *child, long request,
case PTRACE_DETACH:  /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
+
+#ifdef PTRACE_SINGLESTEP
+   case PTRACE_SINGLESTEP:
+#endif
+#ifdef PTRACE_SYSEMU
+   case PTRACE_SYSEMU:
+   case PTRACE_SYSEMU_SINGLESTEP:
+#endif
+   case PTRACE_SYSCALL:
+   case PTRACE_CONT:
+   return ptrace_resume(child, request, data);
+
+   case PTRACE_KILL:
+   if (child-exit_state)  /* already dead */
+   return 0;
+   return ptrace_resume(child, request, SIGKILL);
+
default:
break;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86-32: ptrace generic resume

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=227195d4a6185e81855f56ed9bc815cad9a39398
Commit: 227195d4a6185e81855f56ed9bc815cad9a39398
Parent: 18982c158f9c255d437713e63a93270d07408674
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:51 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:51 2008 +0100

x86-32: ptrace generic resume

This removes the handling for PTRACE_CONT et al from the 32-bit
ptrace code, so it uses the new generic code via ptrace_request.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_32.c |   57 ---
 1 files changed, 0 insertions(+), 57 deletions(-)

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index bc7fd80..bd3668c 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -277,63 +277,6 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
  }
  break;
 
-   case PTRACE_SYSEMU: /* continue and stop at next syscall, which will 
not be executed */
-   case PTRACE_SYSCALL:/* continue and stop at next (return from) 
syscall */
-   case PTRACE_CONT:   /* restart after signal. */
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-   if (request == PTRACE_SYSEMU) {
-   set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   } else if (request == PTRACE_SYSCALL) {
-   set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-   } else {
-   clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   }
-   child-exit_code = data;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   ret = 0;
-   break;
-
-/*
- * make the child exit.  Best I can do is send it a sigkill. 
- * perhaps it should be put in the status that it wants to 
- * exit.
- */
-   case PTRACE_KILL:
-   ret = 0;
-   if (child-exit_state == EXIT_ZOMBIE)   /* already dead */
-   break;
-   child-exit_code = SIGKILL;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   break;
-
-   case PTRACE_SYSEMU_SINGLESTEP: /* Same as SYSEMU, but singlestep if not 
syscall */
-   case PTRACE_SINGLESTEP: /* set the trap flag. */
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-
-   if (request == PTRACE_SYSEMU_SINGLESTEP)
-   set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-   else
-   clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-
-   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   user_enable_single_step(child);
-   child-exit_code = data;
-   /* give it a chance to run. */
-   wake_up_process(child);
-   ret = 0;
-   break;
-
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
ret = -EIO;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


powerpc: arch_has_single_step

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2a84b0d71973692b291f03a870c4d0d13f722d79
Commit: 2a84b0d71973692b291f03a870c4d0d13f722d79
Parent: 227195d4a6185e81855f56ed9bc815cad9a39398
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:51 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:51 2008 +0100

powerpc: arch_has_single_step

This defines the new standard arch_has_single_step macro.  It makes the
existing set_single_step and clear_single_step entry points global, and
renames them to the new standard names user_enable_single_step and
user_disable_single_step, respectively.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/powerpc/kernel/ptrace.c |   12 ++--
 include/asm-powerpc/ptrace.h |7 +++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 3e17d15..b970d79 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -256,7 +256,7 @@ static int set_evrregs(struct task_struct *task, unsigned 
long *data)
 #endif /* CONFIG_SPE */
 
 
-static void set_single_step(struct task_struct *task)
+void user_enable_single_step(struct task_struct *task)
 {
struct pt_regs *regs = task-thread.regs;
 
@@ -271,7 +271,7 @@ static void set_single_step(struct task_struct *task)
set_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
-static void clear_single_step(struct task_struct *task)
+void user_disable_single_step(struct task_struct *task)
 {
struct pt_regs *regs = task-thread.regs;
 
@@ -313,7 +313,7 @@ static int ptrace_set_debugreg(struct task_struct *task, 
unsigned long addr,
 void ptrace_disable(struct task_struct *child)
 {
/* make sure the single step bit is not set. */
-   clear_single_step(child);
+   user_disable_single_step(child);
 }
 
 /*
@@ -456,7 +456,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
child-exit_code = data;
/* make sure the single step bit is not set. */
-   clear_single_step(child);
+   user_disable_single_step(child);
wake_up_process(child);
ret = 0;
break;
@@ -473,7 +473,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
break;
child-exit_code = SIGKILL;
/* make sure the single step bit is not set. */
-   clear_single_step(child);
+   user_disable_single_step(child);
wake_up_process(child);
break;
}
@@ -483,7 +483,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
if (!valid_signal(data))
break;
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   set_single_step(child);
+   user_enable_single_step(child);
child-exit_code = data;
/* give it a chance to run. */
wake_up_process(child);
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 13fccc5..3063363 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -119,6 +119,13 @@ do {   
  \
 } while (0)
 #endif /* __powerpc64__ */
 
+/*
+ * These are defined as per linux/ptrace.h, which see.
+ */
+#define arch_has_single_step() (1)
+extern void user_enable_single_step(struct task_struct *);
+extern void user_disable_single_step(struct task_struct *);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86-64: ptrace generic resume

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=18982c158f9c255d437713e63a93270d07408674
Commit: 18982c158f9c255d437713e63a93270d07408674
Parent: 36df29d7994180cf7f0ccc5d46495855d56d2721
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:51 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:51 2008 +0100

x86-64: ptrace generic resume

This removes the handling for PTRACE_CONT et al from the 64-bit
ptrace code, so it uses the new generic code via ptrace_request.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_64.c |   45 ---
 1 files changed, 0 insertions(+), 45 deletions(-)

diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 035d53e..b129b1f 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -334,23 +334,6 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
}
break;
}
-   case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall 
*/
-   case PTRACE_CONT:/* restart after signal. */
-
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-   if (request == PTRACE_SYSCALL)
-   set_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
-   else
-   clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
-   clear_tsk_thread_flag(child, TIF_SINGLESTEP);
-   child-exit_code = data;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   ret = 0;
-   break;
 
 #ifdef CONFIG_IA32_EMULATION
/* This makes only sense with 32bit programs. Allow a
@@ -378,34 +361,6 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
ret = do_arch_prctl(child, data, addr);
break;
 
-/*
- * make the child exit.  Best I can do is send it a sigkill. 
- * perhaps it should be put in the status that it wants to 
- * exit.
- */
-   case PTRACE_KILL:
-   ret = 0;
-   if (child-exit_state == EXIT_ZOMBIE)   /* already dead */
-   break;
-   clear_tsk_thread_flag(child, TIF_SINGLESTEP);
-   child-exit_code = SIGKILL;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   break;
-
-   case PTRACE_SINGLESTEP:/* set the trap flag. */
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-   clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
-   user_enable_single_step(child);
-   child-exit_code = data;
-   /* give it a chance to run. */
-   wake_up_process(child);
-   ret = 0;
-   break;
-
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
   sizeof(struct user_regs_struct))) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


powerpc: ptrace generic resume

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6f4fb7558ee8138fe86e2778bc16e3794d0baa2
Commit: d6f4fb7558ee8138fe86e2778bc16e3794d0baa2
Parent: 2a84b0d71973692b291f03a870c4d0d13f722d79
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:51 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:51 2008 +0100

powerpc: ptrace generic resume

This removes the handling for PTRACE_CONT et al from the powerpc
ptrace code, so it uses the new generic code via ptrace_request.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/powerpc/kernel/ptrace.c |   46 --
 1 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index b970d79..8b056d2 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -445,52 +445,6 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
break;
}
 
-   case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall 
*/
-   case PTRACE_CONT: { /* restart after signal. */
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-   if (request == PTRACE_SYSCALL)
-   set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   else
-   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   child-exit_code = data;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   ret = 0;
-   break;
-   }
-
-/*
- * make the child exit.  Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
-   case PTRACE_KILL: {
-   ret = 0;
-   if (child-exit_state == EXIT_ZOMBIE)   /* already dead */
-   break;
-   child-exit_code = SIGKILL;
-   /* make sure the single step bit is not set. */
-   user_disable_single_step(child);
-   wake_up_process(child);
-   break;
-   }
-
-   case PTRACE_SINGLESTEP: {  /* set the trap flag. */
-   ret = -EIO;
-   if (!valid_signal(data))
-   break;
-   clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-   user_enable_single_step(child);
-   child-exit_code = data;
-   /* give it a chance to run. */
-   wake_up_process(child);
-   ret = 0;
-   break;
-   }
-
case PTRACE_GET_DEBUGREG: {
ret = -EINVAL;
/* We only support one DABR and no IABRS at the moment */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86-32 ptrace: use task_pt_regs

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=62a97d447b511bf4f0f0aa8cdccfb9ed1c934c8b
Commit: 62a97d447b511bf4f0f0aa8cdccfb9ed1c934c8b
Parent: d6f4fb7558ee8138fe86e2778bc16e3794d0baa2
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:52 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:52 2008 +0100

x86-32 ptrace: use task_pt_regs

This cleans up the 32-bit ptrace code to use task_pt_regs instead of its
own redundant code that does the same thing a different way.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_32.c |   68 ++
 1 files changed, 16 insertions(+), 52 deletions(-)

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index bd3668c..a1425e9 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -37,53 +37,20 @@
  */
 #define FLAG_MASK 0x00050dd5
 
-/*
- * Offset of eflags on child stack..
- */
-#define EFL_OFFSET offsetof(struct pt_regs, eflags)
-
-static inline struct pt_regs *get_child_regs(struct task_struct *task)
-{
-   void *stack_top = (void *)task-thread.esp0;
-   return stack_top - sizeof(struct pt_regs);
-}
-
-/*
- * This routine will get a word off of the processes privileged stack.
- * the offset is bytes into the pt_regs structure on the stack.
- * This routine assumes that all the privileged stacks are in our
- * data space.
- */   
-static inline int get_stack_long(struct task_struct *task, int offset)
+static long *pt_regs_access(struct pt_regs *regs, unsigned long regno)
 {
-   unsigned char *stack;
-
-   stack = (unsigned char *)task-thread.esp0 - sizeof(struct pt_regs);
-   stack += offset;
-   return (*((int *)stack));
-}
-
-/*
- * This routine will put a word on the processes privileged stack.
- * the offset is bytes into the pt_regs structure on the stack.
- * This routine assumes that all the privileged stacks are in our
- * data space.
- */
-static inline int put_stack_long(struct task_struct *task, int offset,
-   unsigned long data)
-{
-   unsigned char * stack;
-
-   stack = (unsigned char *)task-thread.esp0 - sizeof(struct pt_regs);
-   stack += offset;
-   *(unsigned long *) stack = data;
-   return 0;
+   BUILD_BUG_ON(offsetof(struct pt_regs, ebx) != 0);
+   if (regno  FS)
+   --regno;
+   return regs-ebx + regno;
 }
 
 static int putreg(struct task_struct *child,
unsigned long regno, unsigned long value)
 {
-   switch (regno  2) {
+   struct pt_regs *regs = task_pt_regs(child);
+   regno = 2;
+   switch (regno) {
case GS:
if (value  (value  3) != 3)
return -EIO;
@@ -113,26 +80,25 @@ static int putreg(struct task_struct *child,
clear_tsk_thread_flag(child, TIF_FORCED_TF);
else if (test_tsk_thread_flag(child, TIF_FORCED_TF))
value |= X86_EFLAGS_TF;
-   value |= get_stack_long(child, EFL_OFFSET)  ~FLAG_MASK;
+   value |= regs-eflags  ~FLAG_MASK;
break;
}
-   if (regno  FS*4)
-   regno -= 1*4;
-   put_stack_long(child, regno, value);
+   *pt_regs_access(regs, regno) = value;
return 0;
 }
 
-static unsigned long getreg(struct task_struct *child,
-   unsigned long regno)
+static unsigned long getreg(struct task_struct *child, unsigned long regno)
 {
+   struct pt_regs *regs = task_pt_regs(child);
unsigned long retval = ~0UL;
 
-   switch (regno  2) {
+   regno = 2;
+   switch (regno) {
case EFL:
/*
 * If the debugger set TF, hide it from the readout.
 */
-   retval = get_stack_long(child, EFL_OFFSET);
+   retval = regs-eflags;
if (test_tsk_thread_flag(child, TIF_FORCED_TF))
retval = ~X86_EFLAGS_TF;
break;
@@ -147,9 +113,7 @@ static unsigned long getreg(struct task_struct *child,
retval = 0x;
/* fall through */
default:
-   if (regno  FS*4)
-   regno -= 1*4;
-   retval = get_stack_long(child, regno);
+   retval = *pt_regs_access(regs, regno);
}
return retval;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86-64 ptrace: use task_pt_regs

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e4aed6cc45f06acd35e3dfbbaf632c5d5aa897c0
Commit: e4aed6cc45f06acd35e3dfbbaf632c5d5aa897c0
Parent: 62a97d447b511bf4f0f0aa8cdccfb9ed1c934c8b
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:52 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:52 2008 +0100

x86-64 ptrace: use task_pt_regs

This cleans up the 64-bit ptrace code to use task_pt_regs instead of its
own redundant code that does the same thing a different way.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_64.c |   60 --
 1 files changed, 12 insertions(+), 48 deletions(-)

diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index b129b1f..d0a0aea 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -43,44 +43,6 @@
 #define FLAG_MASK 0x54dd5UL
 
 /*
- * eflags and offset of eflags on child stack..
- */
-#define EFLAGS offsetof(struct pt_regs, eflags)
-#define EFL_OFFSET ((int)(EFLAGS-sizeof(struct pt_regs)))
-
-/*
- * this routine will get a word off of the processes privileged stack. 
- * the offset is how far from the base addr as stored in the TSS.  
- * this routine assumes that all the privileged stacks are in our
- * data space.
- */   
-static inline unsigned long get_stack_long(struct task_struct *task, int 
offset)
-{
-   unsigned char *stack;
-
-   stack = (unsigned char *)task-thread.rsp0;
-   stack += offset;
-   return (*((unsigned long *)stack));
-}
-
-/*
- * this routine will put a word on the processes privileged stack. 
- * the offset is how far from the base addr as stored in the TSS.  
- * this routine assumes that all the privileged stacks are in our
- * data space.
- */
-static inline long put_stack_long(struct task_struct *task, int offset,
-   unsigned long data)
-{
-   unsigned char * stack;
-
-   stack = (unsigned char *) task-thread.rsp0;
-   stack += offset;
-   *(unsigned long *) stack = data;
-   return 0;
-}
-
-/*
  * Called by kernel/ptrace.c when detaching..
  *
  * Make sure the single step bit is not set.
@@ -90,11 +52,16 @@ void ptrace_disable(struct task_struct *child)
user_disable_single_step(child);
 }
 
+static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long 
offset)
+{
+   BUILD_BUG_ON(offsetof(struct pt_regs, r15) != 0);
+   return regs-r15 + (offset / sizeof(regs-r15));
+}
+
 static int putreg(struct task_struct *child,
unsigned long regno, unsigned long value)
 {
-   unsigned long tmp; 
-   
+   struct pt_regs *regs = task_pt_regs(child);
switch (regno) {
case offsetof(struct user_regs_struct,fs):
if (value  (value  3) != 3)
@@ -152,9 +119,7 @@ static int putreg(struct task_struct *child,
clear_tsk_thread_flag(child, TIF_FORCED_TF);
else if (test_tsk_thread_flag(child, TIF_FORCED_TF))
value |= X86_EFLAGS_TF;
-   tmp = get_stack_long(child, EFL_OFFSET); 
-   tmp = ~FLAG_MASK; 
-   value |= tmp;
+   value |= regs-eflags  ~FLAG_MASK;
break;
case offsetof(struct user_regs_struct,cs): 
if ((value  3) != 3)
@@ -162,12 +127,13 @@ static int putreg(struct task_struct *child,
value = 0x;
break;
}
-   put_stack_long(child, regno - sizeof(struct pt_regs), value);
+   *pt_regs_access(regs, regno) = value;
return 0;
 }
 
 static unsigned long getreg(struct task_struct *child, unsigned long regno)
 {
+   struct pt_regs *regs = task_pt_regs(child);
unsigned long val;
switch (regno) {
case offsetof(struct user_regs_struct, fs):
@@ -202,16 +168,14 @@ static unsigned long getreg(struct task_struct *child, 
unsigned long regno)
/*
 * If the debugger set TF, hide it from the readout.
 */
-   regno = regno - sizeof(struct pt_regs);
-   val = get_stack_long(child, regno);
+   val = regs-eflags;
if (test_tsk_thread_flag(child, TIF_IA32))
val = 0x;
if (test_tsk_thread_flag(child, TIF_FORCED_TF))
val = ~X86_EFLAGS_TF;
return val;
default:
-   regno = regno - sizeof(struct pt_regs);
-   val = get_stack_long(child, regno);
+

x86: x86-64 ptrace debugreg cleanup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=962ff3804d31a4d090bbcbd3d06a4b63e3a5b5fd
Commit: 962ff3804d31a4d090bbcbd3d06a4b63e3a5b5fd
Parent: e4aed6cc45f06acd35e3dfbbaf632c5d5aa897c0
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:52 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:52 2008 +0100

x86: x86-64 ptrace debugreg cleanup

This cleans up the 64-bit ptrace code to separate the guts of the
debug register access from the implementation of PTRACE_PEEKUSR and
PTRACE_POKEUSR.  The new functions ptrace_[gs]et_debugreg are made
global so that the ia32 code can later be changed to call them too.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_64.c |  140 ---
 include/asm-x86/ptrace.h|3 +
 2 files changed, 69 insertions(+), 74 deletions(-)

diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index d0a0aea..4ba66d8 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -183,9 +183,63 @@ static unsigned long getreg(struct task_struct *child, 
unsigned long regno)
 
 }
 
+unsigned long ptrace_get_debugreg(struct task_struct *child, int n)
+{
+   switch (n) {
+   case 0: return child-thread.debugreg0;
+   case 1: return child-thread.debugreg1;
+   case 2: return child-thread.debugreg2;
+   case 3: return child-thread.debugreg3;
+   case 6: return child-thread.debugreg6;
+   case 7: return child-thread.debugreg7;
+   }
+   return 0;
+}
+
+int ptrace_set_debugreg(struct task_struct *child, int n, unsigned long data)
+{
+   int i;
+
+   if (n  4) {
+   int dsize = test_tsk_thread_flag(child, TIF_IA32) ? 3 : 7;
+   if (unlikely(data = TASK_SIZE_OF(child) - dsize))
+   return -EIO;
+   }
+
+   switch (n) {
+   case 0: child-thread.debugreg0 = data; break;
+   case 1: child-thread.debugreg1 = data; break;
+   case 2: child-thread.debugreg2 = data; break;
+   case 3: child-thread.debugreg3 = data; break;
+
+   case 6:
+   if (data  32)
+   return -EIO;
+   child-thread.debugreg6 = data;
+   break;
+
+   case 7:
+   /*
+* See ptrace_32.c for an explanation of this awkward check.
+*/
+   data = ~DR_CONTROL_RESERVED;
+   for (i = 0; i  4; i++)
+   if ((0x5554  ((data  (16 + 4*i))  0xf))  1)
+   return -EIO;
+   child-thread.debugreg7 = data;
+   if (data)
+   set_tsk_thread_flag(child, TIF_DEBUG);
+   else
+   clear_tsk_thread_flag(child, TIF_DEBUG);
+   break;
+   }
+
+   return 0;
+}
+
 long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
-   long i, ret;
+   long ret;
unsigned ui;
 
switch (request) {
@@ -204,32 +258,14 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
addr  sizeof(struct user) - 7)
break;
 
-   switch (addr) { 
-   case 0 ... sizeof(struct user_regs_struct) - sizeof(long):
+   tmp = 0;
+   if (addr  sizeof(struct user_regs_struct))
tmp = getreg(child, addr);
-   break;
-   case offsetof(struct user, u_debugreg[0]):
-   tmp = child-thread.debugreg0;
-   break;
-   case offsetof(struct user, u_debugreg[1]):
-   tmp = child-thread.debugreg1;
-   break;
-   case offsetof(struct user, u_debugreg[2]):
-   tmp = child-thread.debugreg2;
-   break;
-   case offsetof(struct user, u_debugreg[3]):
-   tmp = child-thread.debugreg3;
-   break;
-   case offsetof(struct user, u_debugreg[6]):
-   tmp = child-thread.debugreg6;
-   break;
-   case offsetof(struct user, u_debugreg[7]):
-   tmp = child-thread.debugreg7;
-   break;
-   default:
-   tmp = 0;
-   break;
+   else if (addr = offsetof(struct user, u_debugreg[0])) {
+   addr -= offsetof(struct user, u_debugreg[0]);
+   tmp = ptrace_get_debugreg(child, addr / sizeof(long));
}
+

x86: x86-32 ptrace debugreg cleanup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9771e8c50020bb1b4ca9eca9c188874ff126aa4
Commit: d9771e8c50020bb1b4ca9eca9c188874ff126aa4
Parent: d0f081758260e9221729cabbc3aba63d89b8c8d4
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:52 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:52 2008 +0100

x86: x86-32 ptrace debugreg cleanup

This cleans up the 32-bit ptrace code to separate the guts of the
debug register access from the implementation of PTRACE_PEEKUSR and
PTRACE_POKEUSR.  The new functions ptrace_[gs]et_debugreg match the
new 64-bit entry points for parity, but they don't need to be global.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/ptrace_32.c |  119 +--
 1 files changed, 69 insertions(+), 50 deletions(-)

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index a1425e9..512f841 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -119,6 +119,72 @@ static unsigned long getreg(struct task_struct *child, 
unsigned long regno)
 }
 
 /*
+ * This function is trivial and will be inlined by the compiler.
+ * Having it separates the implementation details of debug
+ * registers from the interface details of ptrace.
+ */
+static unsigned long ptrace_get_debugreg(struct task_struct *child, int n)
+{
+   return child-thread.debugreg[n];
+}
+
+static int ptrace_set_debugreg(struct task_struct *child,
+  int n, unsigned long data)
+{
+   if (unlikely(n == 4 || n == 5))
+   return -EIO;
+
+   if (n  4  unlikely(data = TASK_SIZE - 3))
+   return -EIO;
+
+   if (n == 7) {
+   /*
+* Sanity-check data. Take one half-byte at once with
+* check = (val  (16 + 4*i))  0xf. It contains the
+* R/Wi and LENi bits; bits 0 and 1 are R/Wi, and bits
+* 2 and 3 are LENi. Given a list of invalid values,
+* we do mask |= 1  invalid_value, so that
+* (mask  check)  1 is a correct test for invalid
+* values.
+*
+* R/Wi contains the type of the breakpoint /
+* watchpoint, LENi contains the length of the watched
+* data in the watchpoint case.
+*
+* The invalid values are:
+* - LENi == 0x10 (undefined), so mask |= 0x0f00.
+* - R/Wi == 0x10 (break on I/O reads or writes), so
+*   mask |= 0x.
+* - R/Wi == 0x00  LENi != 0x00, so we have mask |=
+*   0x1110.
+*
+* Finally, mask = 0x0f00 | 0x | 0x1110 == 0x5f54.
+*
+* See the Intel Manual System Programming Guide,
+* 15.2.4
+*
+* Note that LENi == 0x10 is defined on x86_64 in long
+* mode (i.e. even for 32-bit userspace software, but
+* 64-bit kernel), so the x86_64 mask value is 0x5454.
+* See the AMD manual no. 24593 (AMD64 System Programming)
+*/
+   int i;
+   data = ~DR_CONTROL_RESERVED;
+   for (i = 0; i  4; i++)
+   if ((0x5f54  ((data  (16 + 4*i))  0xf))  1)
+   return -EIO;
+   if (data)
+   set_tsk_thread_flag(child, TIF_DEBUG);
+   else
+   clear_tsk_thread_flag(child, TIF_DEBUG);
+   }
+
+   child-thread.debugreg[n] = data;
+
+   return 0;
+}
+
+/*
  * Called by kernel/ptrace.c when detaching..
  *
  * Make sure the single step bit is not set.
@@ -158,7 +224,7 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
   addr = (long) dummy-u_debugreg[7]){
addr -= (long) dummy-u_debugreg[0];
addr = addr  2;
-   tmp = child-thread.debugreg[addr];
+   tmp = ptrace_get_debugreg(child, addr);
}
ret = put_user(tmp, datap);
break;
@@ -188,56 +254,9 @@ long arch_ptrace(struct task_struct *child, long request, 
long addr, long data)
  ret = -EIO;
  if(addr = (long) dummy-u_debugreg[0] 
 addr = (long) dummy-u_debugreg[7]){
-
- if(addr == (long) dummy-u_debugreg[4]) break;
- if(addr == (long) dummy-u_debugreg[5]) break;
- if(addr  (long) dummy-u_debugreg[4] 
-((unsigned long) data) = TASK_SIZE-3) break;
- 

x86: x86-64 ia32 ptrace debugreg cleanup

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d0f081758260e9221729cabbc3aba63d89b8c8d4
Commit: d0f081758260e9221729cabbc3aba63d89b8c8d4
Parent: 962ff3804d31a4d090bbcbd3d06a4b63e3a5b5fd
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:52 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:52 2008 +0100

x86: x86-64 ia32 ptrace debugreg cleanup

This cleans up the ia32 compat ptrace code to use shared code from
native ptrace for the implementation guts of debug register access.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ptrace32.c |   63 ++
 1 files changed, 8 insertions(+), 55 deletions(-)

diff --git a/arch/x86/ia32/ptrace32.c b/arch/x86/ia32/ptrace32.c
index 5dee334..5ababea 100644
--- a/arch/x86/ia32/ptrace32.c
+++ b/arch/x86/ia32/ptrace32.c
@@ -41,7 +41,6 @@
 
 static int putreg32(struct task_struct *child, unsigned regno, u32 val)
 {
-   int i;
__u64 *stack = (__u64 *)task_pt_regs(child);
 
switch (regno) {
@@ -102,43 +101,10 @@ static int putreg32(struct task_struct *child, unsigned 
regno, u32 val)
break;
}
 
-   case offsetof(struct user32, u_debugreg[4]):
-   case offsetof(struct user32, u_debugreg[5]):
-   return -EIO;
-
-   case offsetof(struct user32, u_debugreg[0]):
-   child-thread.debugreg0 = val;
-   break;
-
-   case offsetof(struct user32, u_debugreg[1]):
-   child-thread.debugreg1 = val;
-   break;
-
-   case offsetof(struct user32, u_debugreg[2]):
-   child-thread.debugreg2 = val;
-   break;
-
-   case offsetof(struct user32, u_debugreg[3]):
-   child-thread.debugreg3 = val;
-   break;
-
-   case offsetof(struct user32, u_debugreg[6]):
-   child-thread.debugreg6 = val;
-   break;
-
-   case offsetof(struct user32, u_debugreg[7]):
-   val = ~DR_CONTROL_RESERVED;
-   /* See arch/i386/kernel/ptrace.c for an explanation of
-* this awkward check.*/
-   for (i = 0; i  4; i++)
-   if ((0x5454  ((val  (16 + 4*i))  0xf))  1)
-  return -EIO;
-   child-thread.debugreg7 = val;
-   if (val)
-   set_tsk_thread_flag(child, TIF_DEBUG);
-   else
-   clear_tsk_thread_flag(child, TIF_DEBUG);
-   break;
+   case offsetof(struct user32, u_debugreg[0]) ...
+   offsetof(struct user32, u_debugreg[7]):
+   regno -= offsetof(struct user32, u_debugreg[0]);
+   return ptrace_set_debugreg(child, regno / 4, val);
 
default:
if (regno  sizeof(struct user32) || (regno  3))
@@ -199,23 +165,10 @@ static int getreg32(struct task_struct *child, unsigned 
regno, u32 *val)
*val = ~X86_EFLAGS_TF;
break;
 
-   case offsetof(struct user32, u_debugreg[0]):
-   *val = child-thread.debugreg0;
-   break;
-   case offsetof(struct user32, u_debugreg[1]):
-   *val = child-thread.debugreg1;
-   break;
-   case offsetof(struct user32, u_debugreg[2]):
-   *val = child-thread.debugreg2;
-   break;
-   case offsetof(struct user32, u_debugreg[3]):
-   *val = child-thread.debugreg3;
-   break;
-   case offsetof(struct user32, u_debugreg[6]):
-   *val = child-thread.debugreg6;
-   break;
-   case offsetof(struct user32, u_debugreg[7]):
-   *val = child-thread.debugreg7;
+   case offsetof(struct user32, u_debugreg[0]) ...
+   offsetof(struct user32, u_debugreg[7]):
+   regno -= offsetof(struct user32, u_debugreg[0]);
+   *val = ptrace_get_debugreg(child, regno / 4);
break;
 
default:
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ptrace: arch_has_block_step

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dc802c2d2e66e2d1544e023bfd4be6cdee48d57b
Commit: dc802c2d2e66e2d1544e023bfd4be6cdee48d57b
Parent: d9771e8c50020bb1b4ca9eca9c188874ff126aa4
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:53 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:53 2008 +0100

ptrace: arch_has_block_step

This defines the new macro arch_has_block_step() in linux/ptrace.h, a
default for when asm/ptrace.h does not define it.  This is the analog
of arch_has_single_step() for step-until-branch on machines that have
it.  It declares the new user_enable_block_step function, which goes
with the existing user_enable_single_step and user_disable_single_step.
This is not used yet, but paves the way to harmonize on this interface
for the arch-specific calls on all machines.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/linux/ptrace.h |   37 +
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 8f06c6f..1febc54 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -155,7 +155,8 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long 
addr, long data);
  *
  * This can only be called when arch_has_single_step() has returned nonzero.
  * Set @task so that when it returns to user mode, it will trap after the
- * next single instruction executes.
+ * next single instruction executes.  If arch_has_block_step() is defined,
+ * this must clear the effects of user_enable_block_step() too.
  */
 static inline void user_enable_single_step(struct task_struct *task)
 {
@@ -166,15 +167,43 @@ static inline void user_enable_single_step(struct 
task_struct *task)
  * user_disable_single_step - cancel user-mode single-step
  * @task: either current or a task stopped in %TASK_TRACED
  *
- * Clear @task of the effects of user_enable_single_step().  This can
- * be called whether or not user_enable_single_step() was ever called
- * on @task, and even if arch_has_single_step() returned zero.
+ * Clear @task of the effects of user_enable_single_step() and
+ * user_enable_block_step().  This can be called whether or not either
+ * of those was ever called on @task, and even if arch_has_single_step()
+ * returned zero.
  */
 static inline void user_disable_single_step(struct task_struct *task)
 {
 }
 #endif /* arch_has_single_step */
 
+#ifndef arch_has_block_step
+/**
+ * arch_has_block_step - does this CPU support user-mode block-step?
+ *
+ * If this is defined, then there must be a function declaration or inline
+ * for user_enable_block_step(), and arch_has_single_step() must be defined
+ * too.  arch_has_block_step() should evaluate to nonzero iff the machine
+ * supports step-until-branch for user mode.  It can be a constant or it
+ * can test a CPU feature bit.
+ */
+#define arch_has_single_step() (0)
+
+/**
+ * user_enable_block_step - step until branch in user-mode task
+ * @task: either current or a task stopped in %TASK_TRACED
+ *
+ * This can only be called when arch_has_block_step() has returned nonzero,
+ * and will never be called when single-instruction stepping is being used.
+ * Set @task so that when it returns to user mode, it will trap after the
+ * next branch or trap taken.
+ */
+static inline void user_enable_block_step(struct task_struct *task)
+{
+   BUG();  /* This can never be called.  */
+}
+#endif /* arch_has_block_step */
+
 #endif
 
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ptrace: generic PTRACE_SINGLEBLOCK

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5b88abbf770a0e1975c668743100f42934f385e8
Commit: 5b88abbf770a0e1975c668743100f42934f385e8
Parent: dc802c2d2e66e2d1544e023bfd4be6cdee48d57b
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:53 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:53 2008 +0100

ptrace: generic PTRACE_SINGLEBLOCK

This makes ptrace_request handle PTRACE_SINGLEBLOCK along with
PTRACE_CONT et al.  The new generic code makes use of the
arch_has_block_step macro and generic entry points on machines
that define them.

[ [EMAIL PROTECTED]: bugfix ]

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/linux/ptrace.h |2 +-
 kernel/ptrace.c|   15 ++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 1febc54..515bff0 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -187,7 +187,7 @@ static inline void user_disable_single_step(struct 
task_struct *task)
  * supports step-until-branch for user mode.  It can be a constant or it
  * can test a CPU feature bit.
  */
-#define arch_has_single_step() (0)
+#define arch_has_block_step()  (0)
 
 /**
  * user_enable_block_step - step until branch in user-mode task
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index fad5f1e..973d727 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -373,6 +373,12 @@ static int ptrace_setsiginfo(struct task_struct *child, 
siginfo_t __user * data)
 #define is_singlestep(request) 0
 #endif
 
+#ifdef PTRACE_SINGLEBLOCK
+#define is_singleblock(request)((request) == 
PTRACE_SINGLEBLOCK)
+#else
+#define is_singleblock(request)0
+#endif
+
 #ifdef PTRACE_SYSEMU
 #define is_sysemu_singlestep(request)  ((request) == PTRACE_SYSEMU_SINGLESTEP)
 #else
@@ -396,7 +402,11 @@ static int ptrace_resume(struct task_struct *child, long 
request, long data)
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 #endif
 
-   if (is_singlestep(request) || is_sysemu_singlestep(request)) {
+   if (is_singleblock(request)) {
+   if (unlikely(!arch_has_block_step()))
+   return -EIO;
+   user_enable_block_step(child);
+   } else if (is_singlestep(request) || is_sysemu_singlestep(request)) {
if (unlikely(!arch_has_single_step()))
return -EIO;
user_enable_single_step(child);
@@ -438,6 +448,9 @@ int ptrace_request(struct task_struct *child, long request,
 #ifdef PTRACE_SINGLESTEP
case PTRACE_SINGLESTEP:
 #endif
+#ifdef PTRACE_SINGLEBLOCK
+   case PTRACE_SINGLEBLOCK:
+#endif
 #ifdef PTRACE_SYSEMU
case PTRACE_SYSEMU:
case PTRACE_SYSEMU_SINGLESTEP:
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: debugctlmsr kprobes

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1ecc798c67645e0ee6eb028cb988b71b3edf4b40
Commit: 1ecc798c67645e0ee6eb028cb988b71b3edf4b40
Parent: 10faa81e102e2b7695f386812055cd2ef9e44b4c
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:54 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:54 2008 +0100

x86: debugctlmsr kprobes

This adjusts the x86 kprobes implementation to cope with per-thread
MSR_IA32_DEBUGCTLMSR being set for user mode.  I haven't delved deep
enough into the kprobes code to be really sure this covers all the
cases where the user-mode BTF setting needs to be cleared or restored.
It looks about right to me.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/kprobes_32.c |   15 +++
 arch/x86/kernel/kprobes_64.c |   14 ++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index 3a020f7..bc4a683 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -217,8 +217,21 @@ static void __kprobes set_current_kprobe(struct kprobe *p, 
struct pt_regs *regs,
kcb-kprobe_saved_eflags = ~IF_MASK;
 }
 
+static __always_inline void clear_btf(void)
+{
+   if (test_thread_flag(TIF_DEBUGCTLMSR))
+   wrmsr(MSR_IA32_DEBUGCTLMSR, 0, 0);
+}
+
+static __always_inline void restore_btf(void)
+{
+   if (test_thread_flag(TIF_DEBUGCTLMSR))
+   wrmsr(MSR_IA32_DEBUGCTLMSR, current-thread.debugctlmsr, 0);
+}
+
 static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs 
*regs)
 {
+   clear_btf();
regs-eflags |= TF_MASK;
regs-eflags = ~IF_MASK;
/*single step inline if the instruction is an int3*/
@@ -542,6 +555,8 @@ static void __kprobes resume_execution(struct kprobe *p,
regs-eip = orig_eip + (regs-eip - copy_eip);
 
 no_change:
+   restore_btf();
+
return;
 }
 
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 5df19a9..10d66e3 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -256,8 +256,21 @@ static void __kprobes set_current_kprobe(struct kprobe *p, 
struct pt_regs *regs,
kcb-kprobe_saved_rflags = ~IF_MASK;
 }
 
+static __always_inline void clear_btf(void)
+{
+   if (test_thread_flag(TIF_DEBUGCTLMSR))
+   wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
+}
+
+static __always_inline void restore_btf(void)
+{
+   if (test_thread_flag(TIF_DEBUGCTLMSR))
+   wrmsrl(MSR_IA32_DEBUGCTLMSR, current-thread.debugctlmsr);
+}
+
 static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs 
*regs)
 {
+   clear_btf();
regs-eflags |= TF_MASK;
regs-eflags = ~IF_MASK;
/*single step inline if the instruction is an int3*/
@@ -527,6 +540,7 @@ static void __kprobes resume_execution(struct kprobe *p,
 
regs-rip = orig_rip + (regs-rip - copy_rip);
 no_change:
+   restore_btf();
 
return;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: PTRACE_SINGLEBLOCK

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0fa376e027f0bd71368e1485f863f0dff8f7c897
Commit: 0fa376e027f0bd71368e1485f863f0dff8f7c897
Parent: 1ecc798c67645e0ee6eb028cb988b71b3edf4b40
Author: Roland McGrath [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:55 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:55 2008 +0100

x86: PTRACE_SINGLEBLOCK

This adds the PTRACE_SINGLEBLOCK request on x86, matching the ia64 feature.
The implementation comes from the generic ptrace code and relies on the
low-level machine support provided by arch_has_block_step() et al.

Signed-off-by: Roland McGrath [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ptrace32.c |1 +
 include/asm-x86/ptrace-abi.h |2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/ia32/ptrace32.c b/arch/x86/ia32/ptrace32.c
index 5ababea..8c6fb9d 100644
--- a/arch/x86/ia32/ptrace32.c
+++ b/arch/x86/ia32/ptrace32.c
@@ -227,6 +227,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 
addr, u32 data)
case PTRACE_KILL:
case PTRACE_CONT:
case PTRACE_SINGLESTEP:
+   case PTRACE_SINGLEBLOCK:
case PTRACE_DETACH:
case PTRACE_SYSCALL:
case PTRACE_OLDSETOPTIONS:
diff --git a/include/asm-x86/ptrace-abi.h b/include/asm-x86/ptrace-abi.h
index 7524e12..adce6b5 100644
--- a/include/asm-x86/ptrace-abi.h
+++ b/include/asm-x86/ptrace-abi.h
@@ -78,4 +78,6 @@
 # define PTRACE_SYSEMU_SINGLESTEP 32
 #endif
 
+#define PTRACE_SINGLEBLOCK 33  /* resume execution until next branch */
+
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: prevent dereferencing non-allocated per_cpu variables

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5
Commit: 7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5
Parent: 0fa376e027f0bd71368e1485f863f0dff8f7c897
Author: Mike Travis [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:55 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:55 2008 +0100

x86: prevent dereferencing non-allocated per_cpu variables

'for_each_possible_cpu(i)' when there's a _remote possibility_ of
dereferencing a non-allocated per_cpu variable involved.

All files except mm/vmstat.c are x86 arch.

Thanks to [EMAIL PROTECTED] for pointing this out.

Signed-off-by: Mike Travis [EMAIL PROTECTED]
Cc: Christoph Lameter [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/smp_32.c |4 ++--
 arch/x86/kernel/smpboot_32.c |4 ++--
 arch/x86/xen/smp.c   |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index fcaa026..d4c01a4 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -223,7 +223,7 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector)
 */ 
 
local_irq_save(flags);
-   for (query_cpu = 0; query_cpu  NR_CPUS; ++query_cpu) {
+   for_each_possible_cpu(query_cpu) {
if (cpu_isset(query_cpu, mask)) {
__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu),
  vector);
@@ -675,7 +675,7 @@ static int convert_apicid_to_cpu(int apic_id)
 {
int i;
 
-   for (i = 0; i  NR_CPUS; i++) {
+   for_each_possible_cpu(i) {
if (per_cpu(x86_cpu_to_apicid, i) == apic_id)
return i;
}
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index 239ada1..0bf7f20 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -1090,7 +1090,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
 * Allow the user to impress friends.
 */
Dprintk(Before bogomips.\n);
-   for (cpu = 0; cpu  NR_CPUS; cpu++)
+   for_each_possible_cpu(cpu)
if (cpu_isset(cpu, cpu_callout_map))
bogosum += cpu_data(cpu).loops_per_jiffy;
printk(KERN_INFO
@@ -1121,7 +1121,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
 * construct cpu_sibling_map, so that we can tell sibling CPUs
 * efficiently.
 */
-   for (cpu = 0; cpu  NR_CPUS; cpu++) {
+   for_each_possible_cpu(cpu) {
cpus_clear(per_cpu(cpu_sibling_map, cpu));
cpus_clear(per_cpu(cpu_core_map, cpu));
}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c1b131b..8e1234e 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -146,7 +146,7 @@ void __init xen_smp_prepare_boot_cpu(void)
   old memory can be recycled */
make_lowmem_page_readwrite(per_cpu__gdt_page);
 
-   for (cpu = 0; cpu  NR_CPUS; cpu++) {
+   for_each_possible_cpu(cpu) {
cpus_clear(per_cpu(cpu_sibling_map, cpu));
/*
 * cpu_core_map lives in a per cpu area that is cleared
@@ -163,7 +163,7 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 {
unsigned cpu;
 
-   for (cpu = 0; cpu  NR_CPUS; cpu++) {
+   for_each_possible_cpu(cpu) {
cpus_clear(per_cpu(cpu_sibling_map, cpu));
/*
 * cpu_core_ map will be zeroed when the per
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86: partial unification of asm-x86/bitops.h

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1c54d77078056cde0f195b1a982cb681850efc08
Commit: 1c54d77078056cde0f195b1a982cb681850efc08
Parent: 7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5
Author: Jeremy Fitzhardinge [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:55 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:55 2008 +0100

x86: partial unification of asm-x86/bitops.h

This unifies the set/clear/test bit functions of asm/bitops.h.

I have not attempted to merge the bit-finding functions, since they
rely on the machine word size and can't be easily restructured to work
generically without a lot of #ifdefs.  In particular, the 64-bit code
can assume the presence of conditional move instructions, whereas
32-bit needs to be more careful.

The inline assembly for the bit operations has been changed to remove
explicit sizing hints on the instructions, so the assembler will pick
the appropriate instruction forms depending on the architecture and
the context.

Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Linus Torvalds [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 include/asm-x86/bitops.h|  315 +
 include/asm-x86/bitops_32.h |  636 +++---
 include/asm-x86/bitops_64.h |  653 ---
 3 files changed, 657 insertions(+), 947 deletions(-)

diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h
index 07e3f6d..c6dd7e2 100644
--- a/include/asm-x86/bitops.h
+++ b/include/asm-x86/bitops.h
@@ -1,5 +1,320 @@
+#ifndef _ASM_X86_BITOPS_H
+#define _ASM_X86_BITOPS_H
+
+/*
+ * Copyright 1992, Linus Torvalds.
+ */
+
+#ifndef _LINUX_BITOPS_H
+#error only linux/bitops.h can be included directly
+#endif
+
+#include linux/compiler.h
+#include asm/alternative.h
+
+/*
+ * These have to be done with inline assembly: that way the bit-setting
+ * is guaranteed to be atomic. All bit operations return 0 if the bit
+ * was cleared before the operation and != 0 if it was not.
+ *
+ * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
+ */
+
+#if __GNUC__  4 || (__GNUC__ == 4  __GNUC_MINOR__  1)
+/* Technically wrong, but this avoids compilation errors on some gcc
+   versions. */
+#define ADDR =m (*(volatile long *) addr)
+#else
+#define ADDR +m (*(volatile long *) addr)
+#endif
+
+/**
+ * set_bit - Atomically set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ *
+ * This function is atomic and may not be reordered.  See __set_bit()
+ * if you do not require the atomic guarantees.
+ *
+ * Note: there are no guarantees that this function will not be reordered
+ * on non x86 architectures, so if you are writing portable code,
+ * make sure not to rely on its reordering guarantees.
+ *
+ * Note that @nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static inline void set_bit(int nr, volatile unsigned long *addr)
+{
+   asm volatile(LOCK_PREFIX bts %1,%0
+: ADDR
+: Ir (nr) : memory);
+}
+
+/**
+ * __set_bit - Set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ *
+ * Unlike set_bit(), this function is non-atomic and may be reordered.
+ * If it's called on the same region of memory simultaneously, the effect
+ * may be that only one operation succeeds.
+ */
+static inline void __set_bit(int nr, volatile unsigned long *addr)
+{
+   asm volatile(bts %1,%0
+: ADDR
+: Ir (nr) : memory);
+}
+
+
+/**
+ * clear_bit - Clears a bit in memory
+ * @nr: Bit to clear
+ * @addr: Address to start counting from
+ *
+ * clear_bit() is atomic and may not be reordered.  However, it does
+ * not contain a memory barrier, so if it is used for locking purposes,
+ * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
+ * in order to ensure changes are visible on other processors.
+ */
+static inline void clear_bit(int nr, volatile unsigned long *addr)
+{
+   asm volatile(LOCK_PREFIX btr %1,%0
+: ADDR
+: Ir (nr));
+}
+
+/*
+ * clear_bit_unlock - Clears a bit in memory
+ * @nr: Bit to clear
+ * @addr: Address to start counting from
+ *
+ * clear_bit() is atomic and implies release semantics before the memory
+ * operation. It can be used for an unlock.
+ */
+static inline void clear_bit_unlock(unsigned nr, volatile unsigned long *addr)
+{
+   barrier();
+   clear_bit(nr, addr);
+}
+
+static inline void __clear_bit(int nr, volatile unsigned long *addr)
+{
+   asm volatile(btr %1,%0 : ADDR : Ir (nr));
+}
+
+/*
+ * __clear_bit_unlock - Clears a bit in memory
+ * @nr: Bit 

x86: add set/clear_cpu_cap operations

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=53756d3722172815f52272b28c6d5d5e9639adde
Commit: 53756d3722172815f52272b28c6d5d5e9639adde
Parent: 5548fecdff5617ba3a2f09f0e585e1ac6e1bd25c
Author: Jeremy Fitzhardinge [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:55 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:55 2008 +0100

x86: add set/clear_cpu_cap operations

The patch to suppress bitops-related warnings added a pile of ugly
casts.  Many of these were related to the management of x86 CPU
capabilities.  Clean these up by adding specific set/clear_cpu_cap
macros, and use them consistently.

Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/alternative.c  |   13 ++-
 arch/x86/kernel/apic_32.c  |8 +++---
 arch/x86/kernel/apic_64.c  |2 +-
 arch/x86/kernel/cpu/addon_cpuid_features.c |2 +-
 arch/x86/kernel/cpu/mcheck/mce_64.c|2 +-
 arch/x86/kernel/setup_32.c |2 +-
 arch/x86/kernel/setup_64.c |   29 +--
 arch/x86/kernel/vmi_32.c   |   10 
 include/asm-x86/cpufeature.h   |5 +++-
 9 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index d6405e0..cdc4324 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -356,15 +356,15 @@ void alternatives_smp_switch(int smp)
spin_lock_irqsave(smp_alt, flags);
if (smp) {
printk(KERN_INFO SMP alternatives: switching to SMP code\n);
-   clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
-   clear_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
+   clear_cpu_cap(boot_cpu_data, X86_FEATURE_UP);
+   clear_cpu_cap(cpu_data(0), X86_FEATURE_UP);
list_for_each_entry(mod, smp_alt_modules, next)
alternatives_smp_lock(mod-locks, mod-locks_end,
  mod-text, mod-text_end);
} else {
printk(KERN_INFO SMP alternatives: switching to UP code\n);
-   set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
-   set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
+   set_cpu_cap(boot_cpu_data, X86_FEATURE_UP);
+   set_cpu_cap(cpu_data(0), X86_FEATURE_UP);
list_for_each_entry(mod, smp_alt_modules, next)
alternatives_smp_unlock(mod-locks, mod-locks_end,
mod-text, mod-text_end);
@@ -431,8 +431,9 @@ void __init alternative_instructions(void)
if (smp_alt_once) {
if (1 == num_possible_cpus()) {
printk(KERN_INFO SMP alternatives: switching to UP 
code\n);
-   set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
-   set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
+   set_cpu_cap(boot_cpu_data, X86_FEATURE_UP);
+   set_cpu_cap(cpu_data(0), X86_FEATURE_UP);
+
alternatives_smp_unlock(__smp_locks, __smp_locks_end,
_text, _etext);
}
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 56352c1..1ee443a 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1078,7 +1078,7 @@ static int __init detect_init_APIC (void)
printk(KERN_WARNING Could not enable APIC!\n);
return -1;
}
-   set_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
+   set_cpu_cap(boot_cpu_data, X86_FEATURE_APIC);
mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
 
/* The BIOS may have set up the APIC at some other address */
@@ -1168,7 +1168,7 @@ fake_ioapic_page:
 int __init APIC_init_uniprocessor (void)
 {
if (enable_local_apic  0)
-   clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
+   clear_cpu_cap(boot_cpu_data, X86_FEATURE_APIC);
 
if (!smp_found_config  !cpu_has_apic)
return -1;
@@ -1180,7 +1180,7 @@ int __init APIC_init_uniprocessor (void)
APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
printk(KERN_ERR BIOS bug, local APIC #%d not detected!...\n,
   boot_cpu_physical_apicid);
-   clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
+   clear_cpu_cap(boot_cpu_data, X86_FEATURE_APIC);
return -1;
}
 
@@ -1536,7 +1536,7 @@ early_param(lapic, parse_lapic);
 static 

x86: use generic register names in struct user_regs_struct

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=153d5f2e5787c74e9cbb6b6687c9b04be1b59893
Commit: 153d5f2e5787c74e9cbb6b6687c9b04be1b59893
Parent: 65ea5b0349903585bfed9720fa06f5edb4f1cd25
Author: H. Peter Anvin [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:56 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:56 2008 +0100

x86: use generic register names in struct user_regs_struct

Switch struct user_regs_struct (defined in asm/user.h, which is no
longer exported to userspace) to using register names without e- or
r-prefixes for both 32 and 64 bit x86.  This is intended as a
preliminary step in unifying this code between architectures.

Also, be a bit more strict in truncating 32-bit extended segment
register values to 16 bits.

Signed-off-by: H. Peter Anvin [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/kernel/process_32.c |   35 ++-
 arch/x86/kernel/ptrace_64.c  |4 ++--
 include/asm-x86/user_32.h|   24 +---
 include/asm-x86/user_64.h|   41 +++--
 4 files changed, 68 insertions(+), 36 deletions(-)

diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index c9f28e0..5340646 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -523,6 +523,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned 
long sp,
 void dump_thread(struct pt_regs * regs, struct user * dump)
 {
int i;
+   u16 gs;
 
 /* changed the size calculations - should hopefully work better. lbt */
dump-magic = CMAGIC;
@@ -538,23 +539,23 @@ void dump_thread(struct pt_regs * regs, struct user * 
dump)
if (dump-start_stack  TASK_SIZE)
dump-u_ssize = ((unsigned long) (TASK_SIZE - 
dump-start_stack))  PAGE_SHIFT;
 
-   dump-regs.ebx = regs-bx;
-   dump-regs.ecx = regs-cx;
-   dump-regs.edx = regs-dx;
-   dump-regs.esi = regs-si;
-   dump-regs.edi = regs-di;
-   dump-regs.ebp = regs-bp;
-   dump-regs.eax = regs-ax;
-   dump-regs.ds = regs-ds;
-   dump-regs.es = regs-es;
-   dump-regs.fs = regs-fs;
-   savesegment(gs,dump-regs.gs);
-   dump-regs.orig_eax = regs-orig_ax;
-   dump-regs.eip = regs-ip;
-   dump-regs.cs = regs-cs;
-   dump-regs.eflags = regs-flags;
-   dump-regs.esp = regs-sp;
-   dump-regs.ss = regs-ss;
+   dump-regs.bx = regs-bx;
+   dump-regs.cx = regs-cx;
+   dump-regs.dx = regs-dx;
+   dump-regs.si = regs-si;
+   dump-regs.di = regs-di;
+   dump-regs.bp = regs-bp;
+   dump-regs.ax = regs-ax;
+   dump-regs.ds = (u16)regs-ds;
+   dump-regs.es = (u16)regs-es;
+   dump-regs.fs = (u16)regs-fs;
+   savesegment(gs,gs);
+   dump-regs.orig_ax = regs-orig_ax;
+   dump-regs.ip = regs-ip;
+   dump-regs.cs = (u16)regs-cs;
+   dump-regs.flags = regs-flags;
+   dump-regs.sp = regs-sp;
+   dump-regs.ss = (u16)regs-ss;
 
dump-u_fpvalid = dump_fpu (regs, dump-i387);
 }
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index bee20bb..56b31cd 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -108,7 +108,7 @@ static int putreg(struct task_struct *child,
if (child-thread.gs != value)
return do_arch_prctl(child, ARCH_SET_GS, value);
return 0;
-   case offsetof(struct user_regs_struct, eflags):
+   case offsetof(struct user_regs_struct,flags):
value = FLAG_MASK;
/*
 * If the user value contains TF, mark that
@@ -164,7 +164,7 @@ static unsigned long getreg(struct task_struct *child, 
unsigned long regno)
if (child-thread.gsindex != GS_TLS_SEL)
return 0;
return get_desc_base(child-thread.tls_array[GS_TLS]);
-   case offsetof(struct user_regs_struct, eflags):
+   case offsetof(struct user_regs_struct, flags):
/*
 * If the debugger set TF, hide it from the readout.
 */
diff --git a/include/asm-x86/user_32.h b/include/asm-x86/user_32.h
index 0e85d2a..ed8b8fc 100644
--- a/include/asm-x86/user_32.h
+++ b/include/asm-x86/user_32.h
@@ -75,13 +75,23 @@ struct user_fxsr_struct {
  * doesn't use the extra segment registers)
  */
 struct user_regs_struct {
-   long ebx, ecx, edx, esi, edi, ebp, eax;
-   unsigned short ds, __ds, es, __es;
-   unsigned short fs, __fs, gs, __gs;
-   long orig_eax, eip;
-   unsigned short cs, __cs;
-   long eflags, esp;
-   unsigned short ss, __ss;
+   unsigned 

x86: use generic register names in struct sigcontext

2008-01-30 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=742fa54a62be6a263df14a553bf832724471dfbe
Commit: 742fa54a62be6a263df14a553bf832724471dfbe
Parent: 153d5f2e5787c74e9cbb6b6687c9b04be1b59893
Author: H. Peter Anvin [EMAIL PROTECTED]
AuthorDate: Wed Jan 30 13:30:56 2008 +0100
Committer:  Ingo Molnar [EMAIL PROTECTED]
CommitDate: Wed Jan 30 13:30:56 2008 +0100

x86: use generic register names in struct sigcontext

Switch struct sigcontext (defined in asm/sigcontext*.h) to using
register names withut e- or r-prefixes for both 32- and 64-bit x86.
This is intended as a preliminary step in unifying this code between
architectures.

Signed-off-by: H. Peter Anvin [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
---
 arch/x86/ia32/ia32_signal.c  |   32 +++---
 arch/x86/kernel/asm-offsets_32.c |   18 ++--
 arch/x86/kernel/asm-offsets_64.c |   18 ++--
 arch/x86/kernel/signal_32.c  |   28 ++--
 arch/x86/kernel/signal_64.c  |   29 ++--
 arch/x86/vdso/vdso32/sigreturn.S |   54 +++---
 include/asm-x86/sigcontext.h |   42 ++--
 include/asm-x86/sigcontext32.h   |   22 +++---
 8 files changed, 121 insertions(+), 122 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index f2da443..d03d43f 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -192,9 +192,9 @@ struct rt_sigframe
char retcode[8];
 };
 
-#define COPY(x){ \
-   unsigned int reg;   \
-   err |= __get_user(reg, sc-e ##x); \
+#define COPY(x){   \
+   unsigned int reg;   \
+   err |= __get_user(reg, sc-x); \
regs-x = reg;  \
 }
 
@@ -248,7 +248,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
err |= __get_user(regs-ss, sc-ss);
regs-ss |= 3;
 
-   err |= __get_user(tmpflags, sc-eflags);
+   err |= __get_user(tmpflags, sc-flags);
regs-flags = (regs-flags  ~0x40DD5) | (tmpflags  0x40DD5);
/* disable syscall checks */
regs-orig_ax = -1;
@@ -268,7 +268,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
}
}
 
-   err |= __get_user(tmp, sc-eax);
+   err |= __get_user(tmp, sc-ax);
*peax = tmp;
 
return err;
@@ -361,21 +361,21 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 
__user *sc,
__asm__(movl %%es,%0 : =r(tmp): 0(tmp));
err |= __put_user(tmp, (unsigned int __user *)sc-es);
 
-   err |= __put_user((u32)regs-di, sc-edi);
-   err |= __put_user((u32)regs-si, sc-esi);
-   err |= __put_user((u32)regs-bp, sc-ebp);
-   err |= __put_user((u32)regs-sp, sc-esp);
-   err |= __put_user((u32)regs-bx, sc-ebx);
-   err |= __put_user((u32)regs-dx, sc-edx);
-   err |= __put_user((u32)regs-cx, sc-ecx);
-   err |= __put_user((u32)regs-ax, sc-eax);
+   err |= __put_user((u32)regs-di, sc-di);
+   err |= __put_user((u32)regs-si, sc-si);
+   err |= __put_user((u32)regs-bp, sc-bp);
+   err |= __put_user((u32)regs-sp, sc-sp);
+   err |= __put_user((u32)regs-bx, sc-bx);
+   err |= __put_user((u32)regs-dx, sc-dx);
+   err |= __put_user((u32)regs-cx, sc-cx);
+   err |= __put_user((u32)regs-ax, sc-ax);
err |= __put_user((u32)regs-cs, sc-cs);
err |= __put_user((u32)regs-ss, sc-ss);
err |= __put_user(current-thread.trap_no, sc-trapno);
err |= __put_user(current-thread.error_code, sc-err);
-   err |= __put_user((u32)regs-ip, sc-eip);
-   err |= __put_user((u32)regs-flags, sc-eflags);
-   err |= __put_user((u32)regs-sp, sc-esp_at_signal);
+   err |= __put_user((u32)regs-ip, sc-ip);
+   err |= __put_user((u32)regs-flags, sc-flags);
+   err |= __put_user((u32)regs-sp, sc-sp_at_signal);
 
tmp = save_i387_ia32(current, fpstate, regs, 0);
if (tmp  0)
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index a3a8be7..4fc24a6 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -38,15 +38,15 @@ void foo(void);
 
 void foo(void)
 {
-   OFFSET(IA32_SIGCONTEXT_eax, sigcontext, eax);
-   OFFSET(IA32_SIGCONTEXT_ebx, sigcontext, ebx);
-   OFFSET(IA32_SIGCONTEXT_ecx, sigcontext, ecx);
-   OFFSET(IA32_SIGCONTEXT_edx, sigcontext, edx);
-   OFFSET(IA32_SIGCONTEXT_esi, sigcontext, esi);
-   OFFSET(IA32_SIGCONTEXT_edi, sigcontext, edi);
-   OFFSET(IA32_SIGCONTEXT_ebp, sigcontext, ebp);
-   OFFSET(IA32_SIGCONTEXT_esp, sigcontext, esp);
-   OFFSET(IA32_SIGCONTEXT_eip, sigcontext, eip);
+   OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
+   

<    5   6   7   8   9   10   11   12   13   14   >