login
Header Space

 
 

[PATCH] [33/35] x86_64: Remove duplicated code for reading control registers

Previous thread: none

Next thread: [PATCH] SCSI: use irq_handler_t where appropriate by Jeff Garzik on Saturday, April 28, 2007 - 2:23 pm. (1 message)
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

Here are some 2.6.22 candidate x86 patches for review. I will be posting more 
over a few days.

This first batch has:
- Ingo's genapic rework. Now we always use physical mode on x86-64.
- Lots of minor stuff

Please review.

-Andi

-
To: Ingo Molnar <mingo@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, Eric W. Biederman <ebiederm@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Ingo Molnar &lt;mingo@elte.hu&gt;

Remove clustered APIC mode.  There's little point in the use of clustered APIC
mode, broadcasting is limited to within the cluster only, and chipsets have
bugs in this area as well.  So default to physical APIC mode when the CPU
count is large, and default to logical APIC mode when the CPU count is 8 or
smaller.

(this patch only removes the use of genapic_cluster and cleans up the
resulting genapic.c file - removal of all remaining traces of clustered
mode will be done by another patch.)

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/x86_64/kernel/genapic.c |   71 +++++++++----------------------------------
 include/asm-x86_64/genapic.h |    4 +-
 2 files changed, 18 insertions(+), 57 deletions(-)

Index: linux/arch/x86_64/kernel/genapic.c
===================================================================
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -11,26 +11,24 @@
 #include &lt;linux/threads.h&gt;
 #include &lt;linux/cpumask.h&gt;
 #include &lt;linux/string.h&gt;
+#include &lt;linux/module.h&gt;
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/ctype.h&gt;
 #include &lt;linux/init.h&gt;
-#include &lt;linux/module.h&gt;
 
 #include &lt;asm/smp.h&gt;
 #include &lt;asm/ipi.h&gt;
 
-#if defined(CONFIG_ACPI)
+#ifdef CONFIG_ACPI
 #include &lt;acpi/acpi_bus.h&gt;
 #endif
 
 /* which logical CPU number maps to which CPU (physical APIC ID) */
-u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
+u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly
+					= { [0 ... NR_CPUS-1] = BAD_APICID };
 EXPORT_SYMBOL(x86_cpu_to_apicid);
-u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ......
To: Jan Beulich <jbeulich@...>, Andi Kleen <ak@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;

Whether a region is below 1Mb is determined by its start rather than
its end.

This hunk got erroneously dropped from a previous patch.

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
---

 arch/i386/kernel/cpu/mtrr/generic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/arch/i386/kernel/cpu/mtrr/generic.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mtrr/generic.c
+++ linux/arch/i386/kernel/cpu/mtrr/generic.c
@@ -428,7 +428,7 @@ int generic_validate_add_page(unsigned l
 		}
 	}
 
-	if (base + size &lt; 0x100) {
+	if (base &lt; 0x100) {
 		printk(KERN_WARNING "mtrr: cannot set region below 1 MiB (0x%lx000,0x%lx000)\n",
 		       base, size);
 		return -EINVAL;
-
To: takada <takada@...>, Andi Kleen <ak@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: takada &lt;takada@mbf.nifty.com&gt;

Eliminated the arch/i386/kernel/timers in 2.6.18, use clocksoures instead. 
pit_latch_buggy was referred in timers/timer_tsc.c, and currently removed. 
Therefore nobody refer it.

Until 2.6.17, MediaGX's TSC works correctly.  after 2.6.18, warned "TSC
appears to be running slowly.  Marking it as unstable".  So marked unstable
TSC when CS55x0.

Cc: Andi Kleen &lt;ak@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

 arch/i386/kernel/cpu/cyrix.c |    2 +-
 arch/i386/kernel/time.c      |    2 --
 include/asm-i386/timer.h     |    2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

Index: linux/arch/i386/kernel/cpu/cyrix.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/cyrix.c
+++ linux/arch/i386/kernel/cpu/cyrix.c
@@ -279,7 +279,7 @@ static void __cpuinit init_cyrix(struct 
 		 */  
 		if (vendor == PCI_VENDOR_ID_CYRIX &amp;&amp;
 	 (device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
-			pit_latch_buggy = 1;
+			mark_tsc_unstable();
 	}
 #endif
 		c-&gt;x86_cache_size=16;	/* Yep 16K integrated cache thats it */
Index: linux/arch/i386/kernel/time.c
===================================================================
--- linux.orig/arch/i386/kernel/time.c
+++ linux/arch/i386/kernel/time.c
@@ -70,8 +70,6 @@
 
 #include &lt;asm/i8259.h&gt;
 
-int pit_latch_buggy;              /* extern */
-
 #include "do_timer.h"
 
 unsigned int cpu_khz;	/* Detected as we calibrate the TSC */
Index: linux/include/asm-i386/timer.h
===================================================================
--- linux.orig/include/asm-i386/timer.h
+++ linux/include/asm-i386/timer.h
@@ -9,8 +9,6 @@ void setup_pit_timer(void);
 unsigned long long native_sched_clock(void);
 unsigned long native_calculate_cpu_khz(void);
 
-/* Modifiers for buggy PIT handling */
-extern int pit_latch_buggy;
 exter...
To: Andrew Morton <akpm@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Ingo Molnar <mingo@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Andrew Morton &lt;akpm@osdl.org&gt;

This is unneeded with Ingo's genapic rework.

Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

 arch/i386/kernel/quirks.c |   33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)

Index: linux/arch/i386/kernel/quirks.c
===================================================================
--- linux.orig/arch/i386/kernel/quirks.c
+++ linux/arch/i386/kernel/quirks.c
@@ -10,38 +10,13 @@
 #if defined(CONFIG_X86_IO_APIC) &amp;&amp; defined(CONFIG_SMP) &amp;&amp; defined(CONFIG_PCI)
 static void __devinit verify_quirk_intel_irqbalance(struct pci_dev *dev)
 {
-	u8 config, rev;
-	u32 word;
-
-	/* BIOS may enable hardware IRQ balancing for
-	 * E7520/E7320/E7525(revision ID 0x9 and below)
-	 * based platforms.
-	 * For those platforms, make sure that the genapic is set to 'flat'
-	 */
-	pci_read_config_byte(dev, PCI_CLASS_REVISION, &amp;rev);
-	if (rev &gt; 0x9)
-		return;
-
-	/* enable access to config space*/
-	pci_read_config_byte(dev, 0xf4, &amp;config);
-	pci_write_config_byte(dev, 0xf4, config|0x2);
-
-	/* read xTPR register */
-	raw_pci_ops-&gt;read(0, 0, 0x40, 0x4c, 2, &amp;word);
-
-	if (!(word &amp; (1 &lt;&lt; 13))) {
 #ifdef CONFIG_X86_64
-		if (genapic !=  &amp;apic_flat)
-			panic("APIC mode must be flat on this system\n");
+	if (genapic !=  &amp;apic_flat)
+		panic("APIC mode must be flat on this system\n");
 #elif defined(CONFIG_X86_GENERICARCH)
-		if (genapic != &amp;apic_default)
-			panic("APIC mode must be default(flat) on this system. Use apic=default\n");
+	if (genapic != &amp;apic_default)
+		panic("APIC mode must be default(flat) on this system. Use apic=default\n");
 #endif
-	}
-
-	/* put back the original value for config space*/
-	if (!(config &amp; 0x2))
-		pci_write_config_byte(dev, 0xf4,...
To: Ingo Molnar <mingo@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, Eric W. Biederman <ebiederm@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Ingo Molnar &lt;mingo@elte.hu&gt;

Fix a couple of inconsistencies/problems I found while reviewing the x86_64
genapic code (when I was chasing mysterious eth0 timeouts that would only
trigger if CPU_HOTPLUG is enabled):

 - AMD systems defaulted to the slower flat-physical mode instead
   of the flat-logical mode. The only restriction on AMD systems
   is that they should not use clustered APIC mode.

 - removed the CPU hotplug hacks, switching the default for small
   systems back from phys-flat to logical-flat. The switching to logical
   flat mode on small systems fixed sporadic ethernet driver timeouts i
   was getting on a dual-core Athlon64 system:

    NETDEV WATCHDOG: eth0: transmit timed out
    eth0: Transmit timeout, status 0c 0005 c07f media 80.
    eth0: Tx queue start entry 32  dirty entry 28.
    eth0:  Tx descriptor 0 is 0008a04a. (queue head)
    eth0:  Tx descriptor 1 is 0008a04a.
    eth0:  Tx descriptor 2 is 0008a04a.
    eth0:  Tx descriptor 3 is 0008a04a.
    eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

 - The use of '&lt;= 8' was a bug by itself (the valid APIC ids
   for logical flat mode go from 0 to 7, not 0 to 8). The new logic
   is to use logical flat mode on both AMD and Intel systems, and
   to only switch to physical mode when logical mode cannot be used.
   If CPU hotplug is racy wrt. APIC shutdown then CPU hotplug needs
   fixing, not the whole IRQ system be made inconsistent and slowed
   down.

 - minor cleanups: simplified some code constructs

build &amp; booted on a couple of AMD and Intel SMP systems.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/x86_64/kernel/genapic.c |   39 +++++++++++++++------------------------
 1 file...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;
Avoid including asm/vsyscall32.h in virtually every source file.

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/ia32/syscall32.c |    1 +
 include/asm-x86_64/fixmap.h  |    1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

Index: linux/arch/x86_64/ia32/syscall32.c
===================================================================
--- linux.orig/arch/x86_64/ia32/syscall32.c
+++ linux/arch/x86_64/ia32/syscall32.c
@@ -13,6 +13,7 @@
 #include &lt;asm/proto.h&gt;
 #include &lt;asm/tlbflush.h&gt;
 #include &lt;asm/ia32_unistd.h&gt;
+#include &lt;asm/vsyscall32.h&gt;
 
 extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
 extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
Index: linux/include/asm-x86_64/fixmap.h
===================================================================
--- linux.orig/include/asm-x86_64/fixmap.h
+++ linux/include/asm-x86_64/fixmap.h
@@ -15,7 +15,6 @@
 #include &lt;asm/apicdef.h&gt;
 #include &lt;asm/page.h&gt;
 #include &lt;asm/vsyscall.h&gt;
-#include &lt;asm/vsyscall32.h&gt;
 
 /*
  * Here we define all the compile-time 'special' virtual
-
To: Jeremy Fitzhardinge <jeremy@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
No need to use -traditional for processing asm in i386/kernel/

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/kernel/Makefile |    2 --
 arch/i386/kernel/entry.S  |    2 +-
 include/asm-i386/percpu.h |    4 ++--
 3 files changed, 3 insertions(+), 5 deletions(-)

Index: linux/arch/i386/kernel/Makefile
===================================================================
--- linux.orig/arch/i386/kernel/Makefile
+++ linux/arch/i386/kernel/Makefile
@@ -43,8 +43,6 @@ obj-$(CONFIG_VMI)		+= vmi.o vmitime.o
 obj-$(CONFIG_PARAVIRT)		+= paravirt.o
 obj-y				+= pcspeaker.o
 
-EXTRA_AFLAGS   := -traditional
-
 obj-$(CONFIG_SCx200)		+= scx200.o
 
 # vsyscall.o contains the vsyscall DSO images as __initdata.
Index: linux/arch/i386/kernel/entry.S
===================================================================
--- linux.orig/arch/i386/kernel/entry.S
+++ linux/arch/i386/kernel/entry.S
@@ -635,7 +635,7 @@ ENTRY(name)				\
 	SAVE_ALL;			\
 	TRACE_IRQS_OFF			\
 	movl %esp,%eax;			\
-	call smp_/**/name;		\
+	call smp_##name;		\
 	jmp ret_from_intr;		\
 	CFI_ENDPROC;			\
 ENDPROC(name)
Index: linux/include/asm-i386/percpu.h
===================================================================
--- linux.orig/include/asm-i386/percpu.h
+++ linux/include/asm-i386/percpu.h
@@ -20,10 +20,10 @@
 #ifdef CONFIG_SMP
 #define PER_CPU(var, cpu) \
 	movl __per_cpu_offset(,cpu,4), cpu;	\
-	addl $per_cpu__/**/var, cpu;
+	addl $per_cpu__##var, cpu;
 #else /* ! SMP */
 #define PER_CPU(var, cpu) \
-	movl $per_cpu__/**/var, cpu;
+	movl $per_cpu__##var, cpu;
 #endif	/* SMP */
 
 #endif /* !__ASSEMBLY__ */
-
To: Andrew Morton <akpm@...>, Ingo Molnar <mingo@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Andrew Morton &lt;akpm@osdl.org&gt;

Obsoleted by Ingo's genapic stuff.

Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

 arch/i386/kernel/acpi/earlyquirk.c |   21 ----------------
 arch/i386/kernel/quirks.c          |   46 ++++++++-----------------------------
 arch/i386/kernel/smpboot.c         |    6 ----
 arch/x86_64/kernel/early-quirks.c  |   13 ----------
 arch/x86_64/kernel/smpboot.c       |    8 ------
 include/asm-i386/genapic.h         |    2 -
 include/asm-i386/irq.h             |    2 -
 include/asm-x86_64/proto.h         |    1 
 8 files changed, 12 insertions(+), 87 deletions(-)

Index: linux/arch/i386/kernel/acpi/earlyquirk.c
===================================================================
--- linux.orig/arch/i386/kernel/acpi/earlyquirk.c
+++ linux/arch/i386/kernel/acpi/earlyquirk.c
@@ -10,7 +10,6 @@
 #include &lt;asm/pci-direct.h&gt;
 #include &lt;asm/acpi.h&gt;
 #include &lt;asm/apic.h&gt;
-#include &lt;asm/irq.h&gt;
 
 #ifdef CONFIG_ACPI
 
@@ -45,24 +44,6 @@ static int __init check_bridge(int vendo
 	return 0;
 }
 
-static void check_intel(void)
-{
-	u16 vendor, device;
-
-	vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID);
-
-	if (vendor != PCI_VENDOR_ID_INTEL)
-		return;
-
-	device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID);
-#ifdef CONFIG_SMP
-	if (device == PCI_DEVICE_ID_INTEL_E7320_MCH ||
-	    device == PCI_DEVICE_ID_INTEL_E7520_MCH ||
-	    device == PCI_DEVICE_ID_INTEL_E7525_MCH)
-		quirk_intel_irqbalance();
-#endif
-}
-
 void __init check_acpi_pci(void)
 {
 	int num, slot, func;
@@ -74,8 +55,6 @@ void __init check_acpi_pci(void)
 	if (!early_pci_allowed())
 		return;
 
-	check_intel();
-
 	/* Poor man's PCI discovery */
 	for (num = 0; num &lt; 32; num++) {
 		for (slot = 0; slot &lt;...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;
- make the page table contents printing PAE capable
- make sure the address stored in current-&gt;thread.cr2 is unmodified
  from what was read from CR2
- don't call oops_may_print() multiple times, when one time suffices
- print pte even in highpte case, as long as the pte page isn't in
  actually in high memory (which is specifically the case for all page
  tables covering kernel space)

(Changes to v3: Use sizeof()*2 rather than the suggested sizeof()*4 for
printing width, use fixed 16-nibble width for PAE, and also apply the
max_low_pfn range check to the middle level lookup on PAE.)

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/mm/fault.c |   55 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 20 deletions(-)

Index: linux/arch/i386/mm/fault.c
===================================================================
--- linux.orig/arch/i386/mm/fault.c
+++ linux/arch/i386/mm/fault.c
@@ -20,6 +20,7 @@
 #include &lt;linux/tty.h&gt;
 #include &lt;linux/vt_kern.h&gt;		/* For unblank_screen() */
 #include &lt;linux/highmem.h&gt;
+#include &lt;linux/bootmem.h&gt;		/* for max_low_pfn */
 #include &lt;linux/module.h&gt;
 #include &lt;linux/kprobes.h&gt;
 #include &lt;linux/uaccess.h&gt;
@@ -301,7 +302,6 @@ fastcall void __kprobes do_page_fault(st
 	struct mm_struct *mm;
 	struct vm_area_struct * vma;
 	unsigned long address;
-	unsigned long page;
 	int write, si_code;
 
 	/* get the address */
@@ -510,7 +510,9 @@ no_context:
 	bust_spinlocks(1);
 
 	if (oops_may_print()) {
-	#ifdef CONFIG_X86_PAE
+		__typeof__(pte_val(__pte(0))) page;
+
+#ifdef CONFIG_X86_PAE
 		if (error_code &amp; 16) {
 			pte_t *pte = lookup_address(address);
 
@@ -519,7 +521,7 @@ no_context:
 					"NX-protected page - exploit attempt? "
 					"(uid: %d)\n", current-&gt;uid);
 		}
-	#endif
+#endif
 		if (address &lt; PAGE_SIZE)
 			printk(...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;
Move inclusion of asm/fixmap.h to where it is really used rather than
where it may have been used long ago (requires a few other adjustments
to includes due to previous implicit dependencies).

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/kernel/genapic.c      |    1 +
 arch/x86_64/kernel/genapic_flat.c |    1 +
 include/asm-i386/hpet.h           |    2 --
 include/asm-i386/kexec.h          |    5 -----
 include/asm-i386/pgalloc.h        |    1 -
 include/asm-i386/smp.h            |    7 ++-----
 include/asm-x86_64/ipi.h          |    4 +---
 include/asm-x86_64/pgalloc.h      |    1 -
 include/asm-x86_64/pgtable.h      |    1 -
 include/asm-x86_64/smp.h          |    3 +--
 10 files changed, 6 insertions(+), 20 deletions(-)

Index: linux/arch/x86_64/kernel/genapic.c
===================================================================
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -18,6 +18,7 @@
 
 #include &lt;asm/smp.h&gt;
 #include &lt;asm/ipi.h&gt;
+#include &lt;asm/genapic.h&gt;
 
 #ifdef CONFIG_ACPI
 #include &lt;acpi/acpi_bus.h&gt;
Index: linux/arch/x86_64/kernel/genapic_flat.c
===================================================================
--- linux.orig/arch/x86_64/kernel/genapic_flat.c
+++ linux/arch/x86_64/kernel/genapic_flat.c
@@ -16,6 +16,7 @@
 #include &lt;linux/init.h&gt;
 #include &lt;asm/smp.h&gt;
 #include &lt;asm/ipi.h&gt;
+#include &lt;asm/genapic.h&gt;
 
 static cpumask_t flat_target_cpus(void)
 {
Index: linux/include/asm-i386/hpet.h
===================================================================
--- linux.orig/include/asm-i386/hpet.h
+++ linux/include/asm-i386/hpet.h
@@ -28,8 +28,6 @@
 
 #include &lt;linux/timex.h&gt;
 
-#include &lt;asm/fixmap.h&gt;
-
 /*
  * Documentation on HPET can be found at:
  *      http://www.intel.com/ial/home/sp/pcmmspec.htm
Index: linux/incl...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;
Synchronize i386's smp_send_stop() with x86-64's in only try-locking
the call lock to prevent deadlocks when called from panic().
In both version, disable interrupts before clearing the CPU off the
online map to eliminate races with IRQ handlers inspecting this map.
Also in both versions, save/restore interrupts rather than disabling/
enabling them.
On x86-64, eliminate one function used here by folding it into its
single caller, convert to static, and rename for consistency with i386
(lkcd may like this).

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/kernel/smp.c   |   70 ++++++++++++++++++++++++++---------------------
 arch/x86_64/kernel/smp.c |   28 ++++++------------
 include/asm-x86_64/smp.h |    1 
 3 files changed, 49 insertions(+), 50 deletions(-)

Index: linux/arch/i386/kernel/smp.c
===================================================================
--- linux.orig/arch/i386/kernel/smp.c
+++ linux/arch/i386/kernel/smp.c
@@ -515,35 +515,14 @@ void unlock_ipi_call_lock(void)
 
 static struct call_data_struct *call_data;
 
-/**
- * smp_call_function(): Run a function on all other CPUs.
- * @func: The function to run. This must be fast and non-blocking.
- * @info: An arbitrary pointer to pass to the function.
- * @nonatomic: currently unused.
- * @wait: If true, wait (atomically) until function has completed on other CPUs.
- *
- * Returns 0 on success, else a negative status code. Does not return until
- * remote CPUs are nearly ready to execute &lt;&lt;func&gt;&gt; or are or have executed.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler.
- */
-int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
-			int wait)
+static void __smp_call_function(void (*func) (void *info), void *info,
+				int nonatomic, int wait)
 {
 	struct call_data_str...
To: Ingo Molnar <mingo@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, Eric W. Biederman <ebiederm@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Ingo Molnar &lt;mingo@elte.hu&gt;

Default to physical mode on hotplug CPU kernels.  Furher simplify and clean up
the APIC initialization code.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/i386/kernel/acpi/boot.c              |    2 +-
 arch/i386/kernel/mpparse.c                |    2 +-
 arch/x86_64/kernel/genapic.c              |   16 +++-------------
 arch/x86_64/kernel/mpparse.c              |    2 +-
 include/asm-i386/genapic.h                |    4 ++--
 include/asm-i386/mach-bigsmp/mach_apic.h  |    2 +-
 include/asm-i386/mach-default/mach_apic.h |    2 +-
 include/asm-i386/mach-es7000/mach_apic.h  |    2 +-
 include/asm-i386/mach-generic/mach_apic.h |    2 +-
 include/asm-i386/mach-numaq/mach_apic.h   |    2 +-
 include/asm-i386/mach-summit/mach_apic.h  |    2 +-
 include/asm-i386/mach-visws/mach_apic.h   |    2 +-
 include/asm-x86_64/apic.h                 |    2 +-
 13 files changed, 16 insertions(+), 26 deletions(-)

Index: linux/arch/i386/kernel/acpi/boot.c
===================================================================
--- linux.orig/arch/i386/kernel/acpi/boot.c
+++ linux/arch/i386/kernel/acpi/boot.c
@@ -874,7 +874,7 @@ static void __init acpi_process_madt(voi
 				acpi_ioapic = 1;
 
 				smp_found_config = 1;
-				clustered_apic_check();
+				setup_apic_routing();
 			}
 		}
 		if (error == -EINVAL) {
Index: linux/arch/i386/kernel/mpparse.c
===================================================================
--- linux.orig/arch/i386/kernel/mpparse.c
+++ linux/arch/i386/kernel/mpparse.c
@@ -477,7 +477,7 @@ static int __init smp_read_mpc(struct mp
 		}
 		++mpc_record;
 	}
-	clustered_apic_check();
+	setup_apic_routing();
 	if (!num_processors)
...
To: Bryan O'Sullivan <bos@...>, Andi Kleen <ak@...>, Roland Dreier <rolandd@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Bryan O'Sullivan" &lt;bos@pathscale.com&gt;

This copy routine is memcpy-compatible, but on some architectures will use
cache-bypassing loads to avoid bringing the source data into the cache.

One case where this is useful is when a device issues a DMA to a memory
region, and the CPU must copy the DMAed data elsewhere before doing any work
with it.  Since the source data is read-once, write-never from the CPU's
perspective, caching the data at those addresses can only evict potentially
useful data.

We provide an x86_64 implementation that uses SSE non-temporal loads, and a
generic version that falls back to plain memcpy.

Implementors for other arches should not use cache-bypassing stores to the
destination, as in most cases, the destination is accessed almost immediately
after a copy finishes.

[akpm@osdl.org: add module export]
[akpm@osdl.org: remove an ARCH_HAS_foo]
Signed-off-by: Bryan O'Sullivan &lt;bryan.osullivan@qlogic.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Roland Dreier &lt;rolandd@cisco.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/x86_64/kernel/x8664_ksyms.c       |    2 
 arch/x86_64/lib/Makefile               |    1 
 arch/x86_64/lib/memcpy_uncached_read.S |  142 +++++++++++++++++++++++++++++++++
 include/asm-x86_64/string.h            |    2 
 include/linux/string.h                 |    3 
 5 files changed, 150 insertions(+)

Index: linux/arch/x86_64/kernel/x8664_ksyms.c
===================================================================
--- linux.orig/arch/x86_64/kernel/x8664_ksyms.c
+++ linux/arch/x86_64/kernel/x8664_ksyms.c
@@ -8,6 +8,7 @@
 #include &lt;asm/processor.h&gt;
 #include &lt;asm/uaccess.h&gt;
 #include &lt;asm/pgtable.h&gt;
+#include &lt;asm/string.h&gt;
 
 EXPORT_SYMBOL(kernel_thread);
 
@@ -54,6 +55,7 @@ extern void * __memcpy(void *,const void
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(__memcpy);
+EXPORT_SYMBOL(memcpy_uncached_r...
To: Bryan O'Sullivan <bos@...>, Andi Kleen <ak@...>
Cc: Roland Dreier <rolandd@...>, <linux-kernel@...>, <patches@...>
Date: Monday, April 30, 2007 - 3:26 am

&gt;+	testb	$8, %dxl	/* rdx is 3,5,6,7,9..15 */

Could you use the more conventional name %dl (or whatever is being meant)

I think I commented similarly on a previous version of the patch: This will 
- result in still bringing the first 128 bytes into the cache

Similarly, I continue to believe this is wrong here (again I commented before

Operations of this type generally should use 'test', not 'or' or 'and'.

Jan


-
To: Jan Beulich <jbeulich@...>
Cc: Bryan O'Sullivan <bos@...>, Roland Dreier <rolandd@...>, <linux-kernel@...>, <patches@...>
Date: Monday, April 30, 2007 - 5:04 am

Yes I remember, somehow it got lost. I agree it's a bad thing. Will drop
the patch for now especially since nothing seems to really need it right now.

Thanks,

-Andi
-
To: Andi Kleen <ak@...>
Cc: Jan Beulich <jbeulich@...>, Roland Dreier <rolandd@...>, <linux-kernel@...>, <patches@...>
Date: Monday, April 30, 2007 - 12:14 pm

It would be used by the ipath driver if it was around.

	&lt;b
-
To: Jeremy Fitzhardinge <jeremy@...>, Stephane Eranian <eranian@...>, Andrew Morton <akpm@...>, Andi Kleen <ak@...>, Randy.Dunlap <rdunlap@...>, Ingo Molnar <mingo@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:53 pm

From: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
Subject: Simplify smp_call_function*() by using common implementation

smp_call_function and smp_call_function_single are almost complete
duplicates of the same logic.  This patch combines them by
implementing them in terms of the more general
smp_call_function_mask().

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Stephane Eranian &lt;eranian@hpl.hp.com&gt;
Cc: Andrew Morton &lt;akpm@osdl.org&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Randy.Dunlap" &lt;rdunlap@xenotime.net&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;

---
 arch/i386/kernel/smp.c |  173 +++++++++++++++++++++++++++----------------------
 1 file changed, 96 insertions(+), 77 deletions(-)

===================================================================
Index: linux/arch/i386/kernel/smp.c
===================================================================
--- linux.orig/arch/i386/kernel/smp.c
+++ linux/arch/i386/kernel/smp.c
@@ -546,34 +546,124 @@ static void __smp_call_function(void (*f
 			cpu_relax();
 }
 
+
 /**
- * smp_call_function(): Run a function on all other CPUs.
+ * smp_call_function_mask(): Run a function on a set of other CPUs.
+ * @mask: The set of cpus to run on.  Must not include the current cpu.
  * @func: The function to run. This must be fast and non-blocking.
  * @info: An arbitrary pointer to pass to the function.
- * @nonatomic: currently unused.
  * @wait: If true, wait (atomically) until function has completed on other CPUs.
  *
  * Returns 0 on success, else a negative status code. Does not return until
- * remote CPUs are nearly ready to execute &lt;&lt;func&gt;&gt; or are or have executed.
+ * remote CPUs are nearly ready to execute &lt;&lt;func&gt;&gt; or are or have finished.
  *
  * You must not call this function with disabled interrupts or from a
  * hardware interrupt handler or from a bottom half handler.
  */
-int smp_call_function (void (*func) (void ...
To: Joerg Roedel <joerg.roedel@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:53 pm

From: Joerg Roedel &lt;joerg.roedel@amd.com&gt;

This patch fixes the reporting of cpu_mhz in /proc/cpuinfo on CPUs with
a constant TSC rate and a kernel with disabled cpufreq.

Signed-off-by: Mark Langsdorf &lt;mark.langsdorf@amd.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

 arch/x86_64/kernel/apic.c     |    2 -
 arch/x86_64/kernel/time.c     |   58 +++++++++++++++++++++++++++++++++++++++---
 arch/x86_64/kernel/tsc.c      |   12 +++++---
 arch/x86_64/kernel/tsc_sync.c |    2 -
 include/asm-x86_64/proto.h    |    1 
 5 files changed, 65 insertions(+), 10 deletions(-)

Index: linux/arch/x86_64/kernel/apic.c
===================================================================
--- linux.orig/arch/x86_64/kernel/apic.c
+++ linux/arch/x86_64/kernel/apic.c
@@ -843,7 +843,7 @@ static int __init calibrate_APIC_clock(v
 		} while ((tsc - tsc_start) &lt; TICK_COUNT &amp;&amp;
 				(apic - apic_start) &lt; TICK_COUNT);
 
-		result = (apic_start - apic) * 1000L * cpu_khz /
+		result = (apic_start - apic) * 1000L * tsc_khz /
 					(tsc - tsc_start);
 	}
 	printk("result %d\n", result);
Index: linux/arch/x86_64/kernel/time.c
===================================================================
--- linux.orig/arch/x86_64/kernel/time.c
+++ linux/arch/x86_64/kernel/time.c
@@ -43,6 +43,7 @@
 #include &lt;asm/apic.h&gt;
 #include &lt;asm/hpet.h&gt;
 #include &lt;asm/mpspec.h&gt;
+#include &lt;asm/nmi.h&gt;
 
 static char *timename = NULL;
 
@@ -249,6 +250,51 @@ static unsigned long get_cmos_time(void)
 	return mktime(year, mon, day, hour, min, sec);
 }
 
+/* calibrate_cpu is used on systems with fixed rate TSCs to determine
+ * processor frequency */
+#define TICK_COUNT 100000000
+static unsigned int __init tsc_calibrate_cpu_khz(void)
+{
+       int tsc_start, tsc_now;
+       int i, no_ctr_free;
+       unsigned long evntsel3 = 0, pmc3 = 0, pmc_now = 0;
+       unsigned long flags;
+
+       for (i = 0; i &lt; 4;...
To: Glauber de Oliveira Costa <gcosta@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Glauber de Oliveira Costa &lt;gcosta@redhat.com&gt;

thanks. Attached now

-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"


Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

 include/asm-x86_64/system.h   |    7 ++++++-
 include/asm-x86_64/tlbflush.h |   33 +++++----------------------------
 2 files changed, 11 insertions(+), 29 deletions(-)

2d19cf472903fa4c9e763301b7b1cc0fa53bd023
Index: linux/include/asm-x86_64/system.h
===================================================================
--- linux.orig/include/asm-x86_64/system.h
+++ linux/include/asm-x86_64/system.h
@@ -89,6 +89,11 @@ static inline unsigned long read_cr3(voi
 	return cr3;
 } 
 
+static inline void write_cr3(unsigned long val)
+{
+	asm volatile("movq %0,%%cr3" :: "r" (val) : "memory");
+}
+
 static inline unsigned long read_cr4(void)
 { 
 	unsigned long cr4;
@@ -98,7 +103,7 @@ static inline unsigned long read_cr4(voi
 
 static inline void write_cr4(unsigned long val)
 { 
-	asm volatile("movq %0,%%cr4" :: "r" (val));
+	asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
 } 
 
 #define stts() write_cr0(8 | read_cr0())
Index: linux/include/asm-x86_64/tlbflush.h
===================================================================
--- linux.orig/include/asm-x86_64/tlbflush.h
+++ linux/include/asm-x86_64/tlbflush.h
@@ -3,41 +3,18 @@
 
 #include &lt;linux/mm.h&gt;
 #include &lt;asm/processor.h&gt;
-
-static inline unsigned long get_cr3(void)
-{
-	unsigned long cr3;
-	asm volatile("mov %%cr3,%0" : "=r" (cr3));
-	return cr3;
-}
-
-static inline void set_cr3(unsigned long cr3)
-{
-	asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory");
-}
+#include &lt;asm/system.h&gt;
 
 static inline void __flush_tlb(void)
 {
-	set_cr3(get_cr3());
-}
-
-static inline unsigned long get_cr4(void)
-{
-	unsigned long cr4;
-	asm volatile("mov %%cr4,%0" : "=r" (cr4));
-	return cr4;
-}
-
-static inline void set_cr4(unsigned long cr4)
-{
-	asm volatile("mov %0,%%cr4" :: "...
To: Rusty Russell <rusty@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
The set_seg_base function isn't used anywhere (2.6.21-rc3-git1)

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 include/asm-x86_64/desc.h |   10 ----------
 1 file changed, 10 deletions(-)

Index: linux/include/asm-x86_64/desc.h
===================================================================
--- linux.orig/include/asm-x86_64/desc.h
+++ linux/include/asm-x86_64/desc.h
@@ -107,16 +107,6 @@ static inline void set_ldt_desc(unsigned
 			      DESC_LDT, size * 8 - 1);
 }
 
-static inline void set_seg_base(unsigned cpu, int entry, void *base)
-{ 
-	struct desc_struct *d = &amp;cpu_gdt(cpu)[entry];
-	u32 addr = (u32)(u64)base;
-	BUG_ON((u64)base &gt;&gt; 32); 
-	d-&gt;base0 = addr &amp; 0xffff;
-	d-&gt;base1 = (addr &gt;&gt; 16) &amp; 0xff;
-	d-&gt;base2 = (addr &gt;&gt; 24) &amp; 0xff;
-} 
-
 #define LDT_entry_a(info) \
 	((((info)-&gt;base_addr &amp; 0x0000ffff) &lt;&lt; 16) | ((info)-&gt;limit &amp; 0x0ffff))
 /* Don't allow setting of the lm bit. It is useless anyways because 
-
To: Lasse Collin <lasse.collin@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Lasse Collin &lt;lasse.collin@tukaani.org&gt;
Hi!

I sent this simple patch to lkml about two weeks ago and also cc'ed 
to Linus, but seems that the patch got ignored. I decided to write to 
you, because you have modified the relevant file most recently.

Below is a copy of the mail that is also available at 
&lt;http://lkml.org/lkml/2007/2/28/230&gt;.

Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

Two fixes to arch/i386/Makefile.cpu:

1) When X86_GENERIC=y is set, use -mtune=i686 if $(CC) doesn't
   support -mtune=generic. GCC 4.1.2 and earlier don't support
   -mtune=generic. When building a generic kernel for a distro
   that runs on i586 and better, it is nice to use
   -march=i586 -mtune=i686 instead of plain -march=i586.

2) Use $(call tune) instead of hardcoded -mtune when CONFIG_MCORE2=y.
   This makes it possible to have CONFIG_MCORE2=y when using GCC 3.3,
   which uses -mcpu instead of -mtune. Also dropped fallback to
   -mtune=generic and -mtune=i686, because -march=i686 already
   implies -mtune=i686.

The patch is against 2.6.20, but Makefile.cpu hasn't changed recently.

---
 arch/i386/Makefile.cpu |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/arch/i386/Makefile.cpu
===================================================================
--- linux.orig/arch/i386/Makefile.cpu
+++ linux/arch/i386/Makefile.cpu
@@ -4,9 +4,9 @@
 #-mtune exists since gcc 3.4
 HAS_MTUNE	:= $(call cc-option-yn, -mtune=i386)
 ifeq ($(HAS_MTUNE),y)
-tune		= $(call cc-option,-mtune=$(1),)
+tune		= $(call cc-option,-mtune=$(1),$(2))
 else
-tune		= $(call cc-option,-mcpu=$(1),)
+tune		= $(call cc-option,-mcpu=$(1),$(2))
 endif
 
 align := $(cc-option-align)
@@ -33,7 +33,7 @@ cflags-$(CONFIG_MWINCHIP3D)	+= $(call cc
 cflags-$(CONFIG_MCYRIXIII)	+= $(call cc-option,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
 cflags-$(CONFIG_MVIAC3_2)	+= $(call cc-option,-march=c3-2,-march=i686)
 cflags-$(CONFIG_MVIAC7)		+...
To: Jeremy Fitzhardinge <jeremy@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
The reboot_fixups stuff seems to be a bit of a mess, specifically the
header is in linux/ when its a purely i386-specific piece of code.  I'm
not sure why it has its config option; its only currently needed for
"geode-gx1/cs5530a", so perhaps whatever config option controls that
hardware should enable this?

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/kernel/reboot.c        |    6 +++++-
 arch/i386/kernel/reboot_fixups.c |    2 +-
 include/asm-i386/reboot_fixups.h |    6 ++++++
 include/linux/reboot_fixups.h    |   10 ----------
 4 files changed, 12 insertions(+), 12 deletions(-)

===================================================================
Index: linux/arch/i386/kernel/reboot.c
===================================================================
--- linux.orig/arch/i386/kernel/reboot.c
+++ linux/arch/i386/kernel/reboot.c
@@ -17,7 +17,7 @@
 #include &lt;asm/apic.h&gt;
 #include &lt;asm/desc.h&gt;
 #include "mach_reboot.h"
-#include &lt;linux/reboot_fixups.h&gt;
+#include &lt;asm/reboot_fixups.h&gt;
 
 /*
  * Power off function, if any
@@ -316,6 +316,10 @@ void machine_shutdown(void)
 #endif
 }
 
+void __attribute__((weak)) mach_reboot_fixups(void)
+{
+}
+
 void machine_emergency_restart(void)
 {
 	if (!reboot_thru_bios) {
Index: linux/arch/i386/kernel/reboot_fixups.c
===================================================================
--- linux.orig/arch/i386/kernel/reboot_fixups.c
+++ linux/arch/i386/kernel/reboot_fixups.c
@@ -10,7 +10,7 @@
 
 #include &lt;asm/delay.h&gt;
 #include &lt;linux/pci.h&gt;
-#include &lt;linux/reboot_fixups.h&gt;
+#include &lt;asm/reboot_fixups.h&gt;
 
 static void cs5530a_warm_reset(struct pci_dev *dev)
 {
Index: linux/include/asm-i386/reboot_fixups.h
===================================================================
--- /dev/null
+++ linux/include/asm-i386/reboot_fixups.h
@@ -0,0 +1,6 @@
...
To: Aneesh Kumar K.V <aneesh.kumar@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Aneesh Kumar K.V" &lt;aneesh.kumar@gmail.com&gt;
Explicity specify that the caller should pin the user memory
otherwise the function will sleep

Signed-off-by: Aneesh Kumar K.V &lt;aneesh.kumar@gmail.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 include/asm-i386/uaccess.h |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Index: linux/include/asm-i386/uaccess.h
===================================================================
--- linux.orig/include/asm-i386/uaccess.h
+++ linux/include/asm-i386/uaccess.h
@@ -397,7 +397,19 @@ unsigned long __must_check __copy_from_u
 unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
 				const void __user *from, unsigned long n);
 
-/*
+/**
+ * __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.
+ * @to:   Destination address, in user space.
+ * @from: Source address, in kernel space.
+ * @n:    Number of bytes to copy.
+ *
+ * Context: User context only.
+ *
+ * Copy data from kernel space to user space.  Caller must check
+ * the specified block with access_ok() before calling this function.
+ * The caller should also make sure he pins the user space address
+ * so that the we don't result in page fault and sleep.
+ *
  * Here we special-case 1, 2 and 4-byte copy_*_user invocations.  On a fault
  * we return the initial request size (1, 2 or 4), as copy_*_user should do.
  * If a store crosses a page boundary and gets a fault, the x86 will not write
-
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

The kernel only supports gcc 3.2+ now so it doesn't make sense
anymore to explicitely check for options this compiler version
already has.

This actually fixes a bug. The -mprefered-stack-boundary check
never worked because gcc rightly complains

  CC      arch/i386/kernel/asm-offsets.s
cc1: -mpreferred-stack-boundary=2 is not between 4 and 12

We just never saw the error because of cc-options.
I changed it to 4 to actually work.

Tested by compiling i386 and x86-64 defconfig with gcc 3.2.

Should speed up the build time a tiny bit and improve
stack usage on i386 slightly.

Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 Makefile           |    2 +-
 arch/i386/Makefile |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux/Makefile
===================================================================
--- linux.orig/Makefile
+++ linux/Makefile
@@ -491,7 +491,7 @@ endif
 include $(srctree)/arch/$(ARCH)/Makefile
 
 ifdef CONFIG_FRAME_POINTER
-CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
+CFLAGS		+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 else
 CFLAGS		+= -fomit-frame-pointer
 endif
Index: linux/arch/i386/Makefile
===================================================================
--- linux.orig/arch/i386/Makefile
+++ linux/arch/i386/Makefile
@@ -34,7 +34,7 @@ CHECKFLAGS	+= -D__i386__
 CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return
 
 # prevent gcc from keeping the stack 16 byte aligned
-CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
+CFLAGS += -mpreferred-stack-boundary=4
 
 # CPU-specific tuning. Anything which can be shared with UML should go here.
 include $(srctree)/arch/i386/Makefile.cpu
-
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/oprofile/nmi_int.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux/arch/i386/oprofile/nmi_int.c
===================================================================
--- linux.orig/arch/i386/oprofile/nmi_int.c
+++ linux/arch/i386/oprofile/nmi_int.c
@@ -414,6 +414,10 @@ int __init op_nmi_init(struct oprofile_o
 				   user space an consistent name. */
 				cpu_type = "x86-64/hammer";
 				break;
+			case 0x10:
+				model = &amp;op_athlon_spec;
+				cpu_type = "x86-64/family10";
+				break;
 			}
 			break;
  
-
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

Pointed out by Adrian Bunk

Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/Kconfig |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/arch/x86_64/Kconfig
===================================================================
--- linux.orig/arch/x86_64/Kconfig
+++ linux/arch/x86_64/Kconfig
@@ -415,13 +415,13 @@ config OUT_OF_LINE_PFN_TO_PAGE
 	depends on DISCONTIGMEM
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-256)"
+	int "Maximum number of CPUs (2-255)"
 	range 2 255
 	depends on SMP
 	default "8"
 	help
 	  This allows you to specify the maximum number of CPUs which this
-	  kernel will support. Current maximum is 256 CPUs due to
+	  kernel will support. Current maximum is 255 CPUs due to
 	  APIC addressing limits. Less depending on the hardware.
 
 	  This is purely to save memory - each supported CPU requires
-
To: Prarit Bhargava <prarit@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Prarit Bhargava &lt;prarit@redhat.com&gt;
Change sysenter_setup to __cpuinit.
Change __INIT &amp; __INITDATA to be cpu hotplug aware.

Resolve MODPOST warnings similar to:

WARNING: vmlinux - Section mismatch: reference to .init.text:sysenter_setup from
 .text between 'identify_cpu' (at offset 0xc040a380) and 'detect_ht'

and

WARNING: vmlinux - Section mismatch: reference to .init.data:vsyscall_int80_end
from .text between 'sysenter_setup' (at offset 0xc041a269) and 'enable_sep_cpu'
WARNING: vmlinux - Section mismatch: reference to
.init.data:vsyscall_int80_start from .text between 'sysenter_setup' (at offset
0xc041a26e) and 'enable_sep_cpu'
WARNING: vmlinux - Section mismatch: reference to
.init.data:vsyscall_sysenter_end from .text between 'sysenter_setup' (at offset
0xc041a275) and 'enable_sep_cpu'
WARNING: vmlinux - Section mismatch: reference to
.init.data:vsyscall_sysenter_start from .text between 'sysenter_setup' (at
offset 0xc041a27a) and 'enable_sep_cpu'

Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/kernel/sysenter.c |    2 +-
 include/linux/init.h        |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Index: linux/arch/i386/kernel/sysenter.c
===================================================================
--- linux.orig/arch/i386/kernel/sysenter.c
+++ linux/arch/i386/kernel/sysenter.c
@@ -72,7 +72,7 @@ extern const char vsyscall_int80_start, 
 extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
 static struct page *syscall_pages[1];
 
-int __init sysenter_setup(void)
+int __cpuinit sysenter_setup(void)
 {
 	void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
 	syscall_pages[0] = virt_to_page(syscall_page);
Index: linux/include/linux/init.h
===================================================================
--- linux.orig/include/linux/init.h
+++ linux/include/linux/init.h
@@ -52,9 +52,14 @@
 #endif
 
 /* For assembly routines */
+#...
To: Prarit Bhargava <prarit@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Prarit Bhargava &lt;prarit@redhat.com&gt;
Add __init to probe_bigsmp.  All callers are __init and data being examined
is __initdata.

Resolves MODPOST warning similar to:

WARNING: vmlinux - Section mismatch: reference to .init.data: from .text between 'probe_bigsmp' (at offset 0xc0401e56) and 'init_apic_ldr'

Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/mach-generic/bigsmp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/arch/i386/mach-generic/bigsmp.c
===================================================================
--- linux.orig/arch/i386/mach-generic/bigsmp.c
+++ linux/arch/i386/mach-generic/bigsmp.c
@@ -45,7 +45,7 @@ static struct dmi_system_id __initdata b
 };
 
 
-static int probe_bigsmp(void)
+static int __init probe_bigsmp(void)
 { 
 	if (def_to_bigsmp)
         	dmi_bigsmp = 1;
-
To: Stephane Eranian <eranian@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Stephane Eranian &lt;eranian@hpl.hp.com&gt;
Hello,

This patch against 2.6.20-git14 makes the NMI watchdog use PERFSEL1/PERFCTR1
instead of PERFSEL0/PERFCTR0 on processors supporting Intel architectural
perfmon, such as Intel Core 2. Although all PMU events can work on
both counters, the Precise Event-Based Sampling (PEBS) requires that the
event be in PERFCTR0 to work correctly (see section 18.14.4.1 in the
IA32 SDM Vol 3b). This versions has 3 chunks compared to previous where
we had missed on check.

Changelog:
        - make the x86-64 NMI watchdog use PERFSEL1/PERFCTR1 instead of PERFSEL0/PERFCTR0
          on processors supporting the Intel architectural perfmon (e.g. Core 2 Duo).
          This allows PEBS to work when the NMI watchdog is active.

signed-off-by: stephane eranian &lt;eranian@hpl.hp.com&gt;


Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/kernel/nmi.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/arch/x86_64/kernel/nmi.c
===================================================================
--- linux.orig/arch/x86_64/kernel/nmi.c
+++ linux/arch/x86_64/kernel/nmi.c
@@ -348,7 +348,7 @@ int __init check_nmi_watchdog (void)
 		struct nmi_watchdog_ctlblk *wd = &amp;__get_cpu_var(nmi_watchdog_ctlblk);
 
 		nmi_hz = 1;
-	 	if (wd-&gt;perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0)
+	 	if (wd-&gt;perfctr_msr == MSR_ARCH_PERFMON_PERFCTR1)
 			nmi_hz = adjust_for_32bit_ctr(nmi_hz);
 	}
 
@@ -713,8 +713,8 @@ static int setup_intel_arch_watchdog(voi
 	    (ebx &amp; ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT))
 		goto fail;
 
-	perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
-	evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
+	perfctr_msr = MSR_ARCH_PERFMON_PERFCTR1;
+	evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL1;
 
 	if (!__reserve_perfctr_nmi(-1, perfctr_msr))
 		goto fail;
@@ -958,7 +958,7 @@ int __kprobes nmi_watchdog_tick(struct p
 				/* start the cycle over again */
 				wrmsrl(wd-&gt;perfctr_msr,
 				       -((u64)...
To: Stephane Eranian <eranian@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Stephane Eranian &lt;eranian@hpl.hp.com&gt;
Hello,

This patch against 2.6.20-git14 makes the NMI watchdog use PERFSEL1/PERFCTR1
instead of PERFSEL0/PERFCTR0 on processors supporting Intel architectural
perfmon, such as Intel Core 2. Although all PMU events can work on
both counters, the Precise Event-Based Sampling (PEBS) requires that the
event be in PERFCTR0 to work correctly (see section 18.14.4.1 in the
IA32 SDM Vol 3b).

A similar patch for x86-64 is to follow.

Changelog:
        - make the i386 NMI watchdog use PERFSEL1/PERFCTR1 instead of PERFSEL0/PERFCTR0
          on processors supporting the Intel architectural perfmon (e.g. Core 2 Duo).
          This allows PEBS to work when the NMI watchdog is active.

signed-off-by: stephane eranian &lt;eranian@hpl.hp.com&gt;


Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/kernel/nmi.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/arch/i386/kernel/nmi.c
===================================================================
--- linux.orig/arch/i386/kernel/nmi.c
+++ linux/arch/i386/kernel/nmi.c
@@ -365,7 +365,7 @@ static int __init check_nmi_watchdog(voi
 		nmi_hz = 1;
 
 		if (wd-&gt;perfctr_msr == MSR_P6_PERFCTR0 ||
-		    wd-&gt;perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) {
+		    wd-&gt;perfctr_msr == MSR_ARCH_PERFMON_PERFCTR1) {
 			nmi_hz = adjust_for_32bit_ctr(nmi_hz);
 		}
 	}
@@ -799,8 +799,8 @@ static int setup_intel_arch_watchdog(voi
 	    (ebx &amp; ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT))
 		goto fail;
 
-	perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
-	evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
+	perfctr_msr = MSR_ARCH_PERFMON_PERFCTR1;
+	evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL1;
 
 	if (!__reserve_perfctr_nmi(-1, perfctr_msr))
 		goto fail;
@@ -1080,7 +1080,7 @@ __kprobes int nmi_watchdog_tick(struct p
 				write_watchdog_counter(wd-&gt;perfctr_msr, NULL);
 	 		}
 			else if (wd-&gt;perfctr_msr == MSR_P6_PERFCTR0 ||
-				 wd-&gt;perfctr_msr == MSR_ARC...
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

Move prototypes into header files
Remove unneeded includes.

Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/kernel/time.c  |    5 +----
 include/asm-x86_64/proto.h |    2 ++
 2 files changed, 3 insertions(+), 4 deletions(-)

Index: linux/arch/x86_64/kernel/time.c
===================================================================
--- linux.orig/arch/x86_64/kernel/time.c
+++ linux/arch/x86_64/kernel/time.c
@@ -39,13 +39,10 @@
 #include &lt;asm/proto.h&gt;
 #include &lt;asm/hpet.h&gt;
 #include &lt;asm/sections.h&gt;
-#include &lt;linux/cpufreq.h&gt;
 #include &lt;linux/hpet.h&gt;
 #include &lt;asm/apic.h&gt;
 #include &lt;asm/hpet.h&gt;
-
-extern void i8254_timer_resume(void);
-extern int using_apic_timer;
+#include &lt;asm/mpspec.h&gt;
 
 static char *timename = NULL;
 
Index: linux/include/asm-x86_64/proto.h
===================================================================
--- linux.orig/include/asm-x86_64/proto.h
+++ linux/include/asm-x86_64/proto.h
@@ -122,6 +122,8 @@ extern void smp_local_timer_interrupt(vo
 
 long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
 
+void i8254_timer_resume(void);
+
 #define round_up(x,y) (((x) + (y) - 1) &amp; ~((y)-1))
 #define round_down(x,y) ((x) &amp; ~((y)-1))
 
-
To: <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

a userspace fault or a kernelspace fault which will result in the
immediate death of the process.  They should not be filled in as a
result of a kernelspace fault which can be fixed up.

Otherwise, if the process is handling SIGSEGV and examining the fault
information, this can result in the kernel space fault trashing the
previously stored fault information if it arrives between the
userspace fault happening and the SIGSEGV being delivered to the process.

Signed-off-by: Jeff Dike &lt;jdike@addtoit.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Acked-by: Jan Beulich &lt;jbeulich@novell.com&gt;
--
 arch/i386/kernel/traps.c   |   24 ++++++++++++++++++------
 arch/x86_64/kernel/traps.c |   30 +++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 13 deletions(-)

Index: linux/arch/i386/kernel/traps.c
===================================================================
--- linux.orig/arch/i386/kernel/traps.c
+++ linux/arch/i386/kernel/traps.c
@@ -476,8 +476,6 @@ static void __kprobes do_trap(int trapnr
 			      siginfo_t *info)
 {
 	struct task_struct *tsk = current;
-	tsk-&gt;thread.error_code = error_code;
-	tsk-&gt;thread.trap_no = trapnr;
 
 	if (regs-&gt;eflags &amp; VM_MASK) {
 		if (vm86)
@@ -489,6 +487,18 @@ static void __kprobes do_trap(int trapnr
 		goto kernel_trap;
 
 	trap_signal: {
+		/*
+		 * We want error_code and trap_no set for userspace faults and
+		 * kernelspace faults which result in die(), but not
+		 * kernelspace faults which are fixed up.  die() gives the
+		 * process no chance to handle the signal and notice the
+		 * kernel fault information, so that won't result in polluting
+		 * the information about previously queued, but not yet
+		 * delivered, faults.  See also do_general_protection below.
+		 */
+		tsk-&gt;thread.error_code = error_code;
+		tsk-&gt;thread.trap_no = trapnr;
+
 		if (info)
 			force_sig_info(signr, info, tsk);
 		else
@@ -497,8 +507,11 @@ static void __kprobes do_trap(int trapnr
 	}
 
 	kernel...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Jan Beulich &lt;jbeulich@novell.com&gt;


Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/i386/lib/checksum.S |   69 ++++++++++++++++++++++++++++++++++++++++-------
 arch/i386/lib/getuser.S  |   26 +++++++++++------
 arch/i386/lib/putuser.S  |   39 +++++++++++++++++---------
 3 files changed, 102 insertions(+), 32 deletions(-)

Index: linux/arch/i386/lib/checksum.S
===================================================================
--- linux.orig/arch/i386/lib/checksum.S
+++ linux/arch/i386/lib/checksum.S
@@ -25,6 +25,8 @@
  *		2 of the License, or (at your option) any later version.
  */
 
+#include &lt;linux/linkage.h&gt;
+#include &lt;asm/dwarf2.h&gt;
 #include &lt;asm/errno.h&gt;
 				
 /*
@@ -36,8 +38,6 @@ unsigned int csum_partial(const unsigned
  */
 		
 .text
-.align 4
-.globl csum_partial								
 		
 #ifndef CONFIG_X86_USE_PPRO_CHECKSUM
 
@@ -48,9 +48,14 @@ unsigned int csum_partial(const unsigned
 	   * Fortunately, it is easy to convert 2-byte alignment to 4-byte
 	   * alignment for the unrolled loop.
 	   */		
-csum_partial:	
+ENTRY(csum_partial)
+	CFI_STARTPROC
 	pushl %esi
+	CFI_ADJUST_CFA_OFFSET 4
+	CFI_REL_OFFSET esi, 0
 	pushl %ebx
+	CFI_ADJUST_CFA_OFFSET 4
+	CFI_REL_OFFSET ebx, 0
 	movl 20(%esp),%eax	# Function arg: unsigned int sum
 	movl 16(%esp),%ecx	# Function arg: int len
 	movl 12(%esp),%esi	# Function arg: unsigned char *buff
@@ -128,16 +133,27 @@ csum_partial:	
 	roll $8, %eax
 8:
 	popl %ebx
+	CFI_ADJUST_CFA_OFFSET -4
+	CFI_RESTORE ebx
 	popl %esi
+	CFI_ADJUST_CFA_OFFSET -4
+	CFI_RESTORE esi
 	ret
+	CFI_ENDPROC
+ENDPROC(csum_partial)
 
 #else
 
 /* Version for PentiumII/PPro */
 
-csum_partial:
+ENTRY(csum_partial)
+	CFI_STARTPROC
 	pushl %esi
+	CFI_ADJUST_CFA_OFFSET 4
+	CFI_REL_OFFSET esi, 0
 	pushl %ebx
+	CFI_ADJUST_CFA_OFFSET 4
+	CFI_REL_OFFSET ebx, 0
 	movl 20(%esp),%eax	# Function arg: unsigned int sum
 	movl 16(%esp),%ecx	# Function arg: int len
 	movl 12(%esp),%esi	# Function arg:	const...
To: Jan Beulich <jbeulich@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: "Jan Beulich" &lt;jbeulich@novell.com&gt;
Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---
 arch/x86_64/kernel/entry.S |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux/arch/x86_64/kernel/entry.S
===================================================================
--- linux.orig/arch/x86_64/kernel/entry.S
+++ linux/arch/x86_64/kernel/entry.S
@@ -701,6 +701,7 @@ END(spurious_interrupt)
 	CFI_ADJUST_CFA_OFFSET 8
 	pushq %rax	/* push real oldrax to the rdi slot */ 
 	CFI_ADJUST_CFA_OFFSET 8
+	CFI_REL_OFFSET rax,0
 	leaq  \sym(%rip),%rax
 	jmp error_entry
 	CFI_ENDPROC
@@ -710,6 +711,7 @@ END(spurious_interrupt)
 	XCPT_FRAME
 	pushq %rax
 	CFI_ADJUST_CFA_OFFSET 8
+	CFI_REL_OFFSET rax,0
 	leaq  \sym(%rip),%rax
 	jmp error_entry
 	CFI_ENDPROC
@@ -817,6 +819,7 @@ paranoid_schedule\trace:
  */ 		  				
 KPROBE_ENTRY(error_entry)
 	_frame RDI
+	CFI_REL_OFFSET rax,0
 	/* rdi slot contains rax, oldrax contains error code */
 	cld	
 	subq  $14*8,%rsp
@@ -824,6 +827,7 @@ KPROBE_ENTRY(error_entry)
 	movq %rsi,13*8(%rsp)
 	CFI_REL_OFFSET	rsi,RSI
 	movq 14*8(%rsp),%rsi	/* load rax from rdi slot */
+	CFI_REGISTER	rax,rsi
 	movq %rdx,12*8(%rsp)
 	CFI_REL_OFFSET	rdx,RDX
 	movq %rcx,11*8(%rsp)
@@ -857,6 +861,7 @@ error_swapgs:	
 	swapgs
 error_sti:	
 	movq %rdi,RDI(%rsp) 	
+	CFI_REL_OFFSET	rdi,RDI
 	movq %rsp,%rdi
 	movq ORIG_RAX(%rsp),%rsi	/* get error code */ 
 	movq $-1,ORIG_RAX(%rsp)
-
To: Rene Herman <rene.herman@...>, Andi Kleen <ak@...>, Zachary Amsden <zach@...>, Jeremy Fitzhardinge <jeremy@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Rene Herman &lt;rene.herman@gmail.com&gt;

Remove the assumption that if the first page of a legacy ROM is mapped,
it'll all be mapped. This'll also stop people reading this code from
wondering if they're looking at a bug...

Signed-off-by: Rene Herman &lt;rene.herman@gmail.com&gt;
Signed-off-by: Martin Murray &lt;murrayma@citi.umich.edu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Zachary Amsden &lt;zach@vmware.com&gt;
Cc: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
---

 arch/i386/kernel/e820.c |   29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

Index: linux/arch/i386/kernel/e820.c
===================================================================
--- linux.orig/arch/i386/kernel/e820.c
+++ linux/arch/i386/kernel/e820.c
@@ -161,26 +161,27 @@ static struct resource standard_io_resou
 
 static int __init romsignature(const unsigned char *rom)
 {
+	const unsigned short * const ptr = (const unsigned short *)rom;
 	unsigned short sig;
 
-	return probe_kernel_address((const unsigned short *)rom, sig) == 0 &amp;&amp;
-	       sig == ROMSIGNATURE;
+	return probe_kernel_address(ptr, sig) == 0 &amp;&amp; sig == ROMSIGNATURE;
 }
 
-static int __init romchecksum(unsigned char *rom, unsigned long length)
+static int __init romchecksum(const unsigned char *rom, unsigned long length)
 {
-	unsigned char sum;
+	unsigned char sum, c;
 
-	for (sum = 0; length; length--)
-		sum += *rom++;
-	return sum == 0;
+	for (sum = 0; length &amp;&amp; probe_kernel_address(rom++, c) == 0; length--)
+		sum += c;
+	return !length &amp;&amp; !sum;
 }
 
 static void __init probe_roms(void)
 {
+	const unsigned char *rom;
 	unsigned long start, length, upper;
-	unsigned char *rom;
-	int	      i;
+	unsigned char c;
+	int i;
 
 	/* video rom */
 	upper = adapter_rom_resources[0].start;
@@ -191,8 +192,11 @@ static void __init probe_roms(void)
 
...
To: Simon Arlott <simon@...>, Andi Kleen <ak@...>, Dave Jones <davej@...>, Alan Cox <alan@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Simon Arlott &lt;simon@arlott.org&gt;

The VIA C7 is a 686 (with TSC) that supports MMX, SSE and SSE2, it also has
a cache line length of 64 according to
http://www.digit-life.com/articles2/cpu/rmma-via-c7.html.  This patch sets
gcc to -march=686 and select s the correct cache shift.

Signed-off-by: Simon Arlott &lt;simon@fire.lp0.eu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
---

 arch/i386/Kconfig.cpu     |   13 ++++++++++---
 arch/i386/Makefile.cpu    |    1 +
 arch/um/defconfig         |    1 +
 include/asm-i386/module.h |    2 ++
 4 files changed, 14 insertions(+), 3 deletions(-)

Index: linux/arch/i386/Kconfig.cpu
===================================================================
--- linux.orig/arch/i386/Kconfig.cpu
+++ linux/arch/i386/Kconfig.cpu
@@ -43,6 +43,7 @@ config M386
 	  - "Geode GX/LX" For AMD Geode GX and LX processors.
 	  - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
 	  - "VIA C3-2" for VIA C3-2 "Nehemiah" (model 9 and above).
+	  - "VIA C7" for VIA C7.
 
 	  If you don't know what to do, choose "386".
 
@@ -203,6 +204,12 @@ config MVIAC3_2
 	  of SSE and tells gcc to treat the CPU as a 686.
 	  Note, this kernel will not boot on older (pre model 9) C3s.
 
+config MVIAC7
+	bool "VIA C7"
+	help
+	  Select this for a VIA C7.  Selecting this uses the correct cache
+	  shift and tells gcc to treat the CPU as a 686.
+
 endchoice
 
 config X86_GENERIC
@@ -231,7 +238,7 @@ config X86_L1_CACHE_SHIFT
 	default "7" if MPENTIUM4 || X86_GENERIC
 	default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
 	default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
-	default "6" if MK7 || MK8 || MPENTIUMM || MCORE2
+	default "6" i...
To: Andi Kleen <ak@...>
Cc: Simon Arlott <simon@...>, Dave Jones <davej@...>, Alan Cox <alan@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 2:08 pm

Has it been verified in the field that this CPU supports CMOV?

	Jeff



-
To: Jeff Garzik <jeff@...>
Cc: Andi Kleen <ak@...>, Simon Arlott <simon@...>, Dave Jones <davej@...>, Alan Cox <alan@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 2:28 pm

On Sat, Apr 28, 2007 at 02:08:58PM -0400, Jeff Garzik wrote:
 &gt; Andi Kleen wrote:
 &gt; &gt; From: Simon Arlott &lt;simon@arlott.org&gt;
 &gt; &gt; 
 &gt; &gt; The VIA C7 is a 686 (with TSC) that supports MMX, SSE and SSE2, it also has
 &gt; &gt; a cache line length of 64 according to
 &gt; &gt; http://www.digit-life.com/articles2/cpu/rmma-via-c7.html.  This patch sets
 &gt; &gt; gcc to -march=686 and select s the correct cache shift.
 &gt; &gt; 
 &gt; &gt; Signed-off-by: Simon Arlott &lt;simon@fire.lp0.eu&gt;
 &gt; &gt; Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
 &gt; &gt; Cc: Andi Kleen &lt;ak@suse.de&gt;
 &gt; &gt; Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
 &gt; &gt; Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
 &gt; &gt; Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
 &gt; 
 &gt; Has it been verified in the field that this CPU supports CMOV?

Yes. All their CPUs for some time now have done so.

	Dave

-- 
http://www.codemonkey.org.uk
-
To: Ingo Molnar <mingo@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, Eric W. Biederman <ebiederm@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Ingo Molnar &lt;mingo@elte.hu&gt;

Remove now unused clustered APIC mode code.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;
Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/x86_64/kernel/Makefile          |    3 
 arch/x86_64/kernel/genapic_cluster.c |  137 -----------------------------------
 2 files changed, 1 insertion(+), 139 deletions(-)

Index: linux/arch/x86_64/kernel/Makefile
===================================================================
--- linux.orig/arch/x86_64/kernel/Makefile
+++ linux/arch/x86_64/kernel/Makefile
@@ -21,8 +21,7 @@ obj-$(CONFIG_MICROCODE)		+= microcode.o
 obj-$(CONFIG_X86_CPUID)		+= cpuid.o
 obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o tsc_sync.o
 obj-y				+= apic.o  nmi.o
-obj-y				+= io_apic.o mpparse.o \
-		genapic.o genapic_cluster.o genapic_flat.o
+obj-y				+= io_apic.o mpparse.o genapic.o genapic_flat.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
Index: linux/arch/x86_64/kernel/genapic_cluster.c
===================================================================
--- linux.orig/arch/x86_64/kernel/genapic_cluster.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2004 James Cleverdon, IBM.
- * Subject to the GNU Public License, v.2
- *
- * Clustered APIC subarch code.  Up to 255 CPUs, physical delivery.
- * (A more realistic maximum is around 230 CPUs.)
- *
- * Hacked for x86-64 by James Cleverdon from i386 architecture code by
- * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
- * James Cleverdon.
- */
-#include &lt;linux/threads.h&gt;
-#include &lt;linux/cpumask.h&gt;
-#include &lt;linux/string.h&gt;
-#include &lt;linux/kernel.h&gt;
-#include &lt;linux/ctyp...
To: Andrew Morton <akpm@...>, Suresh Siddha <suresh.b.siddha@...>, Andi Kleen <ak@...>, Li, Shaohua <shaohua.li@...>, Ingo Molnar <mingo@...>, <linux-kernel@...>, <patches@...>
Date: Saturday, April 28, 2007 - 1:52 pm

From: Andrew Morton &lt;akpm@osdl.org&gt;

This is obsoleted by new Ingo genapic patches.

Cc: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: "Li, Shaohua" &lt;shaohua.li@intel.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Andi Kleen &lt;ak@suse.de&gt;

---

 arch/x86_64/kernel/genapic.c |    9 +--------
 include/asm-x86_64/genapic.h |    2 +-
 2 files changed, 2 insertions(+), 9 deletions(-)

Index: linux/arch/x86_64/kernel/genapic.c
===================================================================
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -33,7 +33,7 @@ extern struct genapic apic_flat;
 extern struct genapic apic_physflat;
 
 struct genapic *genapic = &amp;apic_flat;
-struct genapic *genapic_force;
+
 
 /*
  * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
@@ -46,13 +46,6 @@ void __init clustered_apic_check(void)
 	u8 cluster_cnt[NUM_APIC_CLUSTERS];
 	int max_apic = 0;
 
-	/* genapic selection can be forced because of certain quirks.
-	 */
-	if (genapic_force) {
-		genapic = genapic_force;
-		goto print;
-	}
-
 #if defined(CONFIG_ACPI)
 	/*
 	 * Some x86_64 machines use physical APIC mode regardless of how many
Index: linux/include/asm-x86_64/genapic.h
===================================================================
--- linux.orig/include/asm-x86_64/genapic.h
+++ linux/include/asm-x86_64/genapic.h
@@ -30,6 +30,6 @@ struct genapic {
 };
 
 
-extern struct genapic *genapic, *genapic_force, apic_flat;
+extern struct genapic *genapic;
 
 #endif
-
Previous thread: none

Next thread: [PATCH] SCSI: use irq_handler_t where appropriate by Jeff Garzik on Saturday, April 28, 2007 - 2:23 pm. (1 message)