Skip to contentSkip to conversation

x86 fixes

GIT PULL Ingo Molnar 4 participants 6 messages May 13, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Linus, please pull the latest x86 fixes branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus

It includes a ISA-DMA fix that was a fallout of the PCI unification. Thanks,

Ingo

------------------>
Andrew Morton (1):

      x86: early_init_centaur(): use set_cpu_cap()

Cyrill Gorcunov (1):
x86: wakeup.lds.S - section ordering fix

Hugh Dickins (1):
x86: fix app crashes after SMP resume

Ingo Molnar (1):
x86: fix csum_partial() export

James Bottomley (1):
x86: [VOYAGER] fix duplicate phys_cpu_present_map symbol

Pranith Kumar (1):

      x86: arch/x86/mm/pat.c - fix warning

Roland McGrath (1):
x86: user_regset_view table fix for ia32 on 64-bit

Takashi Iwai (1):
x86/pci: fix broken ISA DMA

 arch/x86/kernel/acpi/realmode/wakeup.lds.S |   10 +++++-----
 arch/x86/kernel/pci-dma.c                  |    8 +++++---
 arch/x86/kernel/ptrace.c                   |    7 +++++--
 arch/x86/kernel/setup.c                    |    4 +++-
 arch/x86/kernel/setup_64.c                 |    2 +-
 arch/x86/kernel/smp.c                      |    3 ++-
 arch/x86/kernel/smpboot.c                  |   24 +++++++++++++++++-------
 arch/x86/kernel/x8664_ksyms_64.c           |    3 +++
 arch/x86/lib/csum-partial_64.c             |    2 --
 arch/x86/mm/init_32.c                      |   12 +-----------
 arch/x86/mm/pat.c                          |    4 ++--
 11 files changed, 44 insertions(+), 35 deletions(-)
arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -5
index 22fab6c..7da00b7 100644
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
 		__bss_end = .;
 	}
 
+	. = HEADER_OFFSET;
+	.header : {
+		*(.header)
+	}
+
 	. = ALIGN(16);
 	_end = .;
 
arch/x86/kernel/pci-dma.c +5 -3
index 0c37f16..c5ef1af 100644
@@ -385,11 +385,13 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
 	if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
 		return memory;
 
-	if (!dev)
+	if (!dev) {
 		dev = &fallback_dev;
+		gfp |= GFP_DMA;
+	}
 	dma_mask = dev->coherent_dma_mask;
 	if (dma_mask == 0)
-		dma_mask = DMA_32BIT_MASK;
+		dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK;
 
 	/* Device not DMA able */
 	if (dev->dma_mask == NULL)
@@ -403,7 +405,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
 	   larger than 16MB and in this case we have a chance of
 	   finding fitting memory in the next higher zone first. If
 	   not retry with true GFP_DMA. -AK */
-	if (dma_mask <= DMA_32BIT_MASK)
+	if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA))
 		gfp |= GFP_DMA32;
 #endif
 
arch/x86/kernel/ptrace.c +5 -2
index fb03ef3..a7835f2 100644
@@ -1303,6 +1303,9 @@ static const struct user_regset_view user_x86_64_view = {
 #define genregs32_get		genregs_get
 #define genregs32_set		genregs_set
 
+#define user_i387_ia32_struct	user_i387_struct
+#define user32_fxsr_struct	user_fxsr_struct
+
 #endif	/* CONFIG_X86_64 */
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -1315,13 +1318,13 @@ static const struct user_regset x86_32_regsets[] = {
 	},
 	[REGSET_FP] = {
 		.core_note_type = NT_PRFPREG,
-		.n = sizeof(struct user_i387_struct) / sizeof(u32),
+		.n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
 		.size = sizeof(u32), .align = sizeof(u32),
 		.active = fpregs_active, .get = fpregs_get, .set = fpregs_set
 	},
 	[REGSET_XFP] = {
 		.core_note_type = NT_PRXFPREG,
-		.n = sizeof(struct user_i387_struct) / sizeof(u32),
+		.n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
 		.size = sizeof(u32), .align = sizeof(u32),
 		.active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
 	},
arch/x86/kernel/setup.c +3 -1
index c0c68c1..6f80b85 100644
@@ -12,6 +12,7 @@
 #include <asm/mpspec.h>
 #include <asm/apicdef.h>
 
+#ifdef CONFIG_X86_LOCAL_APIC
 unsigned int num_processors;
 unsigned disabled_cpus __cpuinitdata;
 /* Processor that is doing the boot up */
@@ -23,8 +24,9 @@ EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
 
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map;
+#endif
 
-#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP)
+#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP)
 /*
  * Copy data used in early init routines from the initial arrays to the
  * per cpu data areas.  These arrays then become expendable and the
arch/x86/kernel/setup_64.c +1 -1
index f2fc8fe..6dff128 100644
@@ -951,7 +951,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
 {
 	if (c->x86 == 0x6 && c->x86_model >= 0xf)
-		set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
+		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 }
 
 static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
arch/x86/kernel/smp.c +2 -1
index 8f75893..0cb7aad 100644
@@ -231,7 +231,8 @@ native_smp_call_function_mask(cpumask_t mask,
 	wmb();
 
 	/* Send a message to other CPUs */
-	if (cpus_equal(mask, allbutself))
+	if (cpus_equal(mask, allbutself) &&
+	    cpus_equal(cpu_online_map, cpu_callout_map))
 		send_IPI_allbutself(CALL_FUNCTION_VECTOR);
 	else
 		send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
arch/x86/kernel/smpboot.c +17 -7
index 6b087ab..3898849 100644
@@ -86,6 +86,7 @@ void *x86_bios_cpu_apicid_early_ptr;
 
 #ifdef CONFIG_X86_32
 u8 apicid_2_node[MAX_APICID];
+static int low_mappings;
 #endif
 
 /* State of each CPU */
@@ -326,6 +327,12 @@ static void __cpuinit start_secondary(void *unused)
 		enable_8259A_irq(0);
 	}
 
+#ifdef CONFIG_X86_32
+	while (low_mappings)
+		cpu_relax();
+	__flush_tlb_all();
+#endif
+
 	/* This must be done before setting cpu_online_map */
 	set_cpu_sibling_map(raw_smp_processor_id());
 	wmb();
@@ -1040,14 +1047,20 @@ int __cpuinit native_cpu_up(unsigned int cpu)
 #ifdef CONFIG_X86_32
 	/* init low mem mapping */
 	clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY,
-			min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
+		min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
 	flush_tlb_all();
-#endif
+	low_mappings = 1;
 
 	err = do_boot_cpu(apicid, cpu);
-	if (err < 0) {
+
+	zap_low_mappings();
+	low_mappings = 0;
+#else
+	err = do_boot_cpu(apicid, cpu);
+#endif
+	if (err) {
 		Dprintk("do_boot_cpu failed %d\n", err);
-		return err;
+		return -EIO;
 	}
 
 	/*
@@ -1259,9 +1272,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
 	setup_ioapic_dest();
 #endif
 	check_nmi_watchdog();
-#ifdef CONFIG_X86_32
-	zap_low_mappings();
-#endif
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
arch/x86/kernel/x8664_ksyms_64.c +3 -0
index 58882f9..f6c05d0 100644
@@ -2,6 +2,7 @@
    All C exports should go in the respective C files. */
 
 #include <linux/module.h>
+#include <net/checksum.h>
 #include <linux/smp.h>
 
 #include <asm/processor.h>
@@ -29,6 +30,8 @@ EXPORT_SYMBOL(__copy_from_user_inatomic);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
+EXPORT_SYMBOL(csum_partial);
+
 /*
  * Export string functions. We normally rely on gcc builtin for most of these,
  * but gcc sometimes decides not to inline them.
arch/x86/lib/csum-partial_64.c +0 -2
index bc503f5..bf51144 100644
@@ -136,8 +136,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
 						(__force u32)sum);
 }
 
-EXPORT_SYMBOL(csum_partial);
-
 /*
  * this routine is used for miscellaneous IP-like checksums, mainly
  * in icmp.c
arch/x86/mm/init_32.c +1 -11
index de236e4..ec30d10 100644
@@ -438,8 +438,6 @@ void zap_low_mappings(void)
 {
 	int i;
 
-	save_pg_dir();
-
 	/*
 	 * Zap initial low-memory mappings.
 	 *
@@ -663,16 +661,8 @@ void __init mem_init(void)
 		test_wp_bit();
 
 	cpa_init();
-
-	/*
-	 * Subtle. SMP is doing it's boot stuff late (because it has to
-	 * fork idle threads) - but it also needs low mappings for the
-	 * protected-mode entry to work. We zap these entries only after
-	 * the WP-bit has been tested.
-	 */
-#ifndef CONFIG_SMP
+	save_pg_dir();
 	zap_low_mappings();
-#endif
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
arch/x86/mm/pat.c +2 -2
index 60adbe2..bcb1a8e 100644
@@ -555,7 +555,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 		"%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
 			current->comm, current->pid,
 			cattr_name(flags),
-			offset, offset + size);
+			offset, (unsigned long long)(offset + size));
 		return 0;
 	}
 
@@ -576,7 +576,7 @@ void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
 		"%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n",
 			current->comm, current->pid,
 			cattr_name(want_flags),
-			addr, addr + size,
+			addr, (unsigned long long)(addr + size),
 			cattr_name(flags));
 	}
 }
#1 lore raw
Quoted 4 lines · Ingo Molnar

Linus, please pull the latest x86 fixes branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus

Wrong URL.

Quoted 10 lines

It includes a ISA-DMA fix that was a fallout of the PCI unification. Thanks,

Ingo

------------------>
...
Ingo Molnar (1):
x86: fix csum_partial() export
...

See my comment below (and I'd really appreciate if such stuff was sent to the mailing list before the pull request for being able to comment in time).

Quoted 2 lines

Takashi Iwai (1):
x86/pci: fix broken ISA DMA

Linus already got the latter through the PCI tree,

Who is actually responsible for the x86 PCI stuff?

Having fixes for this stuff in two trees will create much confusion (e.g. in -next).

Quoted 25 lines

...

arch/x86/kernel/x8664_ksyms_64.c +3 -0
@@ -2,6 +2,7 @@
    All C exports should go in the respective C files. */
 
 #include <linux/module.h>
+#include <net/checksum.h>
 #include <linux/smp.h>
 
 #include <asm/processor.h>
@@ -29,6 +30,8 @@ EXPORT_SYMBOL(__copy_from_user_inatomic);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
+EXPORT_SYMBOL(csum_partial);
+
 /*
  * Export string functions. We normally rely on gcc builtin for most of these,
  * but gcc sometimes decides not to inline them.
arch/x86/lib/csum-partial_64.c +0 -0
index bc503f5..bf51144 100644

arch/x86/lib/csum-partial_64.c __wsum csum_partial(const void *buff, int len, __wsum sum) · line 141

Quoted 9 lines
arch/x86/lib/csum-partial_64.c +0 -2
@@ -136,8 +136,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
 						(__force u32)sum);
 }
 
-EXPORT_SYMBOL(csum_partial);
-
 /*
  * this routine is used for miscellaneous IP-like checksums, mainly
  * in icmp.c
...

Wouldn't the better solution be to move csum-partial_64.c from lib-y to obj-y instead?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 29 lines · Adrian Bunk

On Tue, May 13, 2008 at 09:27:06PM +0200, Ingo Molnar wrote:
...

Quoted 27 lines
arch/x86/kernel/x8664_ksyms_64.c +3 -0
@@ -2,6 +2,7 @@
    All C exports should go in the respective C files. */
 
 #include <linux/module.h>
+#include <net/checksum.h>
 #include <linux/smp.h>
 
 #include <asm/processor.h>
@@ -29,6 +30,8 @@ EXPORT_SYMBOL(__copy_from_user_inatomic);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
+EXPORT_SYMBOL(csum_partial);
+
 /*
  * Export string functions. We normally rely on gcc builtin for most of these,
  * but gcc sometimes decides not to inline them.
arch/x86/lib/csum-partial_64.c +0 -0
index bc503f5..bf51144 100644
@@ -136,8 +136,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
 						(__force u32)sum);
 }
 
Quoted 9 lines

arch/x86/lib/csum-partial_64.c __wsum csum_partial(const void *buff, int len, __wsum sum) · line 141

Quoted 6 lines
arch/x86/lib/csum-partial_64.c +0 -2
-EXPORT_SYMBOL(csum_partial);
-
 /*
  * this routine is used for miscellaneous IP-like checksums, mainly
  * in icmp.c
...

Wouldn't the better solution be to move csum-partial_64.c from lib-y to obj-y instead?

BTW: The usage of csum_partial() in reiserfs you try to work around here
is actually broken, so the best fix would be to fix reiserfs.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
In reply to Adrian Bunk
Quoted 8 lines · Adrian Bunk
Quoted 4 lines · Ingo Molnar

Linus, please pull the latest x86 fixes branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus

Wrong URL.
...

Sorry, scrap that - I missed the symlink.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw
In reply to Adrian Bunk
Quoted 11 lines · Adrian Bunk

See my comment below (and I'd really appreciate if such stuff was sent to the mailing list before the pull request for being able to comment in time).

Quoted 2 lines

Takashi Iwai (1):
x86/pci: fix broken ISA DMA

Linus already got the latter through the PCI tree,

Who is actually responsible for the x86 PCI stuff?

PCI is Jesse Barnes, but this is peripheral to both PCI and x86...

-hpa