Skip to contentSkip to conversation

x86 updates

GIT PULL Ingo Molnar 4 participants 14 messages Feb 4, 2008 – Feb 5, 2008 x86

lore
Share & tools
lore
#0 lore raw

Linus, please pull the latest x86 git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

Find the shortlog below.

78 commits: most of them are fixes, cleanups and low-risk items. There is one group of higher-risk items: the now pretty much rounded up CPA/ioremap work [this was needed to fix some of the regressions]. Some gbpages bits are included too but it's not enabled. All known x86 regressions up to date are fixed by this queue.

there's two non-x86 changes:

include/asm-generic/rtc.h
include/asm-generic/tlb.h

rtc.h is a fix, the tlb.h one is a revert for a change introduced a week ago by x86.git. (as requested by Christoph Lameter)

Thanks,

Ingo

------------------>
Andi Kleen (14):
x86: move NUMAQ io handling into arch/x86/pci/numa.c
x86: remove special NUMAQ support in io_32.h
x86: cpa, add the PAT bit defines
x86: cpa, only flush the cache if the caching attributes have changed
x86: rename LARGE_PAGE_SIZE to PMD_PAGE_SIZE
x86: switch pci-gart over to using set_memory_np() instead of clear_kernel_mapping()
x86: remove now unused clear_kernel_mapping
x86: switch direct mapping setup over to set_pte
x86: add feature macros for the gbpages cpuid bit
x86: add PUD_PAGE_SIZE
x86: add pgtable accessor functions for gbpages
x86: add gbpages support to lookup_address
x86: support gbpages in pagetable dump
x86: implement gbpages support in change_page_attr()

Andrew Morton (1):
x86: fix RTC lockdep warning: potential hardirq recursion

Arjan van de Ven (2):
x86: teach the static_protection function about high mappings
x86: use the pfn from the page when change its attributes

Cyrill Gorcunov (1):
x86: cleanup - eliminate numbers in LDT allocation code

Florian Fainelli (1):
x86: mach-rdc321x Kconfig fix

H. Peter Anvin (18):
x86: add _ASM_EXTABLE macro to <asm/asm.h>
x86: use _ASM_EXTABLE macro in arch/x86/kernel/test_nx.c
x86: use _ASM_EXTABLE macro in arch/x86/lib/mmx_32.c
x86: use _ASM_EXTABLE macro in arch/x86/lib/usercopy_32.c
x86: use _ASM_EXTABLE macro in arch/x86/lib/usercopy_64.c
x86: use _ASM_EXTABLE macro in arch/x86/mm/init_32.c
x86: use _ASM_EXTABLE macro in include/asm-x86/futex.h
x86: use _ASM_EXTABLE macro in include/asm-x86/i387.h
x86: use _ASM_EXTABLE macro in include/asm-x86/msr.h
x86: use _ASM_EXTABLE macro in include/asm-x86/system.h
x86: use _ASM_EXTABLE macro in include/asm-x86/uaccess_32.h
x86: use _ASM_EXTABLE macro in include/asm-x86/uaccess_64.h
x86: cpuid: allow querying %ecx-sensitive CPUID levels
x86: cpuid, msr: use inode mutex instead of big kernel lock
x86: reintroduce volatile keyword in prototype to clflush()
x86: unify CPU feature string names
x86 setup: print missing CPU features in cleartext asm-generic/tlb.h: remove <linux/quicklist.h>

Harvey Harrison (9):
x86: reduce ifdef sections in fault.c
x86: remove long dead cyrix mtrr code
x86: sparse errors from string_32.h
x86: remove final FASTCALL() uses
x86: add include to cpu/intel.c
x86: add function prototype to vm86.h
x86: small sparse fix in process_32.c
x86: add cpu init function defintions to cpu.h
x86: add cpu mtrr init function definitions to mtrr.h

Huang, Ying (1):
x86: fix EFI mapping

Ian Campbell (1):
x86: define OBJCOPYFLAGS explicitly for each target.

Ingo Molnar (7):
x86: relax RAM check in ioremap()
x86: VMI fix
x86: AMD Athlon X2 hard hang fix
x86: remove cpa warning
x86: cpa, cleanups
x86: cpa, eliminate CPA_ enum
x86: cpa, clean up code flow

Jeremy Fitzhardinge (4):
x86: unify PAE/non-PAE pgd_ctor
x86: revert "defer cr3 reload when doing pud_clear()"
x86: pud_clear: only reload cr3 if necessary
x86: update reference for PAE tlb flushing

Pavel Machek (1):
x86: remove misleading comments in trampoline_*.S

Rob Landley (1):
documentation: add Documentation/x86-64/00-INDEX

Sam Ravnborg (2):
x86: restore correct module name for apm
x86: rename module scx200_32 to scx200

Thomas Gleixner (14):
x86: CPA remove bogus NX clear
x86: CPA use the existing pfn in split as well
x86: simplify __ioremap
x86: ioremap remove the range check of cpa
x86: no CPA on iounmap
x86: CPA return early when requested feature is not available
x86: introduce struct cpa_data
x86: cpa, check if we changed anything and tlb flushing is necessary
x86: cpa, preserve large pages if possible
x86: cpa, fix lookup_address
x86: CPA fix pagetable split
x86: cpa selftest, skip non present entries
x86: fix page-present check in cpa_flush_range
x86: cpa, micro-optimization

Yinghai Lu (1):
x86: print out node_data addr and bootmap_start addr

 Documentation/x86_64/00-INDEX          |   16 ++
 arch/x86/Kconfig                       |    1 +
 arch/x86/Makefile                      |    1 -
 arch/x86/boot/Makefile                 |   18 +-
 arch/x86/boot/compressed/Makefile      |    1 +
 arch/x86/boot/compressed/head_64.S     |    8 +-
 arch/x86/boot/cpu.c                    |   26 ++-
 arch/x86/boot/mkcpustr.c               |   49 ++++
 arch/x86/kernel/Makefile               |    6 +-
 arch/x86/kernel/cpu/Makefile           |    1 +
 arch/x86/kernel/cpu/common.c           |   10 -
 arch/x86/kernel/cpu/cpu.h              |    9 +
 arch/x86/kernel/cpu/feature_names.c    |   83 +++++++
 arch/x86/kernel/cpu/intel.c            |    1 +
 arch/x86/kernel/cpu/mtrr/cyrix.c       |  107 ---------
 arch/x86/kernel/cpu/mtrr/main.c        |   16 --
 arch/x86/kernel/cpu/mtrr/mtrr.h        |    4 +
 arch/x86/kernel/cpu/proc.c             |   74 ------
 arch/x86/kernel/cpuid.c                |   52 ++---
 arch/x86/kernel/efi.c                  |   57 +++---
 arch/x86/kernel/efi_64.c               |   22 +-
 arch/x86/kernel/head_64.S              |    4 +-
 arch/x86/kernel/ldt.c                  |    3 +-
 arch/x86/kernel/msr.c                  |   14 +-
 arch/x86/kernel/pci-gart_64.c          |    5 +-
 arch/x86/kernel/process_32.c           |    2 +-
 arch/x86/kernel/setup_64.c             |   76 ------
 arch/x86/kernel/test_nx.c              |   12 +-
 arch/x86/kernel/trampoline_32.S        |    7 +-
 arch/x86/kernel/trampoline_64.S        |    3 -
 arch/x86/kernel/vmi_32.c               |    6 +-
 arch/x86/lib/mmx_32.c                  |   31 +--
 arch/x86/lib/usercopy_32.c             |   12 +-
 arch/x86/lib/usercopy_64.c             |   12 +-
 arch/x86/mm/fault.c                    |   34 +--
 arch/x86/mm/init_32.c                  |    6 +-
 arch/x86/mm/init_64.c                  |   49 +----
 arch/x86/mm/ioremap.c                  |   41 +---
 arch/x86/mm/numa_64.c                  |    7 +-
 arch/x86/mm/pageattr-test.c            |    3 +-
 arch/x86/mm/pageattr.c                 |  400 +++++++++++++++++++++++++-------
 arch/x86/mm/pgtable_32.c               |   61 ++----
 arch/x86/pci/numa.c                    |   52 ++++-
 include/asm-generic/rtc.h              |   11 +-
 include/asm-generic/tlb.h              |    1 -
 include/asm-x86/asm.h                  |    7 +
 include/asm-x86/bugs.h                 |    2 +-
 include/asm-x86/cpufeature.h           |   14 +-
 include/asm-x86/efi.h                  |    4 +-
 include/asm-x86/futex.h                |   23 +--
 include/asm-x86/highmem.h              |    4 +-
 include/asm-x86/hw_irq_32.h            |    2 +-
 include/asm-x86/i387.h                 |   16 +-
 include/asm-x86/io_32.h                |   25 --
 include/asm-x86/mach-numaq/mach_apic.h |    2 +
 include/asm-x86/msr.h                  |   10 +-
 include/asm-x86/page.h                 |    4 +-
 include/asm-x86/page_64.h              |    3 +
 include/asm-x86/pgalloc_32.h           |    6 +-
 include/asm-x86/pgtable-3level.h       |   26 +--
 include/asm-x86/pgtable.h              |    4 +
 include/asm-x86/pgtable_32.h           |    2 +
 include/asm-x86/pgtable_64.h           |    7 +-
 include/asm-x86/string_32.h            |    8 +-
 include/asm-x86/system.h               |   23 +--
 include/asm-x86/uaccess_32.h           |   18 +-
 include/asm-x86/uaccess_64.h           |   10 +-
 include/asm-x86/vm86.h                 |    1 +
 68 files changed, 821 insertions(+), 814 deletions(-)
 create mode 100644 Documentation/x86_64/00-INDEX
 create mode 100644 arch/x86/boot/mkcpustr.c
 create mode 100644 arch/x86/kernel/cpu/feature_names.c
#1 lore raw

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

Linus

---
 arch/x86/kernel/head_64.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/head_64.S +1 -1
index 4f283ad..d16d7b8 100644
@@ -251,7 +251,7 @@ ENTRY(secondary_startup_64)
 
 	/* SMP bootup changes these two */
 #ifndef CONFIG_HOTPLUG_CPU
-	.pushsection .init.data
+	.pushsection .init.data,"aw"
 #endif
 	.align	8
 	.globl	initial_code
#2 lore raw
Quoted 10 lines · Linus Torvalds

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

With a bit of help from the bin-utils people (Alan Modra) I recently discovered that the linker generate sections with different names when the flags differs, so fogetting "aw" casues the linekr to generate a section named .init.data.1 (or some other number).
But I nevet got to investigate if ld does something magically with these autogenerated section names.
But I added a check in modpost and it should warn about the code below.

I would prefer the use of
__CPUINITDATA
__FINITDATA

as defined in linux/init.h but otherwise - yes it should be fixed. With the use of __CPUINITDATA we can kill the ifdef too.

Sam

So something like this (untested - sorry):
I sneaked an extra ENTRY() in just to clean up a bit.

arch/x86/kernel/head_64.S +5 -10
index 4f283ad..09b38d5 100644
@@ -250,18 +250,13 @@ ENTRY(secondary_startup_64)
 	lretq
 
 	/* SMP bootup changes these two */
-#ifndef CONFIG_HOTPLUG_CPU
-	.pushsection .init.data
-#endif
+	__CPUINITDATA
 	.align	8
-	.globl	initial_code
-initial_code:
+	ENTRY(initial_code)
 	.quad	x86_64_start_kernel
-#ifndef CONFIG_HOTPLUG_CPU
-	.popsection
-#endif
-	.globl init_rsp
-init_rsp:
+	__FINITDATA
+
+	ENTRY(init_rsp)
 	.quad  init_thread_union+THREAD_SIZE-8
 
 bad_address:
#3 lore raw
Quoted 20 lines · Sam Ravnborg
Quoted 10 lines · Linus Torvalds

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

With a bit of help from the bin-utils people (Alan Modra) I recently discovered that the linker generate sections with different names when the flags differs, so fogetting "aw" casues the linekr to generate a section named .init.data.1 (or some other number). But I nevet got to investigate if ld does something magically with these autogenerated section names. But I added a check in modpost and it should warn about the code below.

Quoted 6 lines

I would prefer the use of
__CPUINITDATA
__FINITDATA

as defined in linux/init.h but otherwise - yes it should be fixed. With the use of __CPUINITDATA we can kill the ifdef too.

ok, i've queued up your patch.

btw., __CPUINITDATA/__FINITDATA is nice, except that the small patch below is needed to make the fun complete ;-)

or, we could use __FINIT all the time.

btw., what's the practical consequence of getting these section flags wrong - for example writable data can end up in executable section accidentally and be marked readonly by RODATA? Or can anything more serious happen? (they cannot get into any of the discarded sections, we filter for them explicitly in the linker scripts)

Ingo

---
 include/linux/init.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/init.h +1 -0
Index: linux-x86.q/include/linux/init.h
===================================================================
@@ -110,6 +110,7 @@
 #define __FINIT		.previous
 
 #define __INITDATA	.section	".init.data","aw"
+#define __FINITDATA	.previous
 
 #define __DEVINIT        .section	".devinit.text", "ax"
 #define __DEVINITDATA    .section	".devinit.data", "aw"
#4 lore raw
Quoted 3 lines · Ingo Molnar

btw., what's the practical consequence of getting these section flags wrong - for example writable data can end up in executable section accidentally and be marked readonly by RODATA? Or can anything more serious happen? (they cannot get into any of the discarded sections, we filter for them explicitly in the linker scripts)

The practical consequences are probably zero - *except* for getting the "a" flag wrong, as !a sections will never be loaded.

Technically we should also specify @progbits or @nobits on sections, however, I think @progbits is the default.

-hpa

#5 lore raw
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Ingo Molnar

btw., what's the practical consequence of getting these section flags wrong - for example writable data can end up in executable section accidentally and be marked readonly by RODATA? Or can anything more serious happen? (they cannot get into any of the discarded sections, we filter for them explicitly in the linker scripts)

Quoted 5 lines

The practical consequences are probably zero - *except* for getting the "a" flag wrong, as !a sections will never be loaded.

Technically we should also specify @progbits or @nobits on sections, however, I think @progbits is the default.

I have on my todo list to do so. But I wanted to investigate a bit more since I do not yet fully understand the difference.

And we have to use %progbits and %nobits as ARM uses '"' to indicate comments.

Sam

#6 lore raw
Quoted 9 lines · Sam Ravnborg
Quoted 2 lines

Technically we should also specify @progbits or @nobits on sections, however, I think @progbits is the default.

I have on my todo list to do so. But I wanted to investigate a bit more since I do not yet fully understand the difference.

And we have to use %progbits and %nobits as ARM uses '"' to indicate comments.

The difference is quite simple:

a - this section occupies address space
w - this section is writable
x - this section is executable
progbits - this section has data in the file

In contrast, a nobits section is implicitly zero-filled.

By default:

.bss is (aw,nobits).
.data is (aw,progbits).
.rodata is (a,progbits).
.text is (ax,progbits).

Since .bss is nobits, it doesn't occupy any space in the executable, and is zero-filled by the loader.

-hpa

#7 lore raw
Quoted 9 lines · H. Peter Anvin

The difference is quite simple:

a - this section occupies address space
w - this section is writable
x - this section is executable
progbits - this section has data in the file

In contrast, a nobits section is implicitly zero-filled.

Well, the real question is "what are the defaults"

Quoted 6 lines

By default:

.bss is (aw,nobits).
.data is (aw,progbits).
.rodata is (a,progbits).
.text is (ax,progbits).

But what about something like ".init.data"?

I'd assume the defaults for unrecognized segments would have to be something sane like (aw,progbits) (ie my patch shouldn't make any difference), but where do we find that out?

Linus

#8 lore raw
Quoted 3 lines · Linus Torvalds

Well, the real question is "what are the defaults"

Well, I guess my point was that we shouldn't rely on the defaults.

Quoted 10 lines
Quoted 6 lines

By default:

.bss is (aw,nobits).
.data is (aw,progbits).
.rodata is (a,progbits).
.text is (ax,progbits).

But what about something like ".init.data"?

I'd assume the defaults for unrecognized segments would have to be something sane like (aw,progbits) (ie my patch shouldn't make any difference), but where do we find that out?

The defaults are undocumented, and thus could change from one binutils version to another. Experimentally, with binutils-2.17.50.0.18-1.x86_64, a section named ".init.data" get ("",@progbits) as the default attributes.

-hpa

#9 lore raw
In reply to Ingo Molnar
Quoted 30 lines · Ingo Molnar
Quoted 20 lines · Sam Ravnborg
Quoted 10 lines · Linus Torvalds

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

With a bit of help from the bin-utils people (Alan Modra) I recently discovered that the linker generate sections with different names when the flags differs, so fogetting "aw" casues the linekr to generate a section named .init.data.1 (or some other number). But I nevet got to investigate if ld does something magically with these autogenerated section names. But I added a check in modpost and it should warn about the code below.

Quoted 6 lines

I would prefer the use of
__CPUINITDATA
__FINITDATA

as defined in linux/init.h but otherwise - yes it should be fixed. With the use of __CPUINITDATA we can kill the ifdef too.

Quoted 6 lines

ok, i've queued up your patch.

btw., __CPUINITDATA/__FINITDATA is nice, except that the small patch below is needed to make the fun complete ;-)

or, we could use __FINIT all the time.

I have no strong preference - I do not like the naming of __FINIT but maybe thats just me and I have no better name right now.

Quoted 6 lines

btw., what's the practical consequence of getting these section flags wrong - for example writable data can end up in executable section accidentally and be marked readonly by RODATA? Or can anything more serious happen? (they cannot get into any of the discarded sections, we filter for them explicitly in the linker scripts)

I have not investigated this. My attention were due to section mismatch warnings pointing to section names I could not find in the code. When I did an objdump of vmlinux the funny section names were gone so I expected ld had recognized them and merged them somehow - but I did not look closer as my focus was to get rid of them anyway.

I also did a quick skimming of info ld - but no luck.

Sam

#10 lore raw
Quoted 7 lines · Sam Ravnborg
Quoted 6 lines

btw., what's the practical consequence of getting these section flags wrong - for example writable data can end up in executable section accidentally and be marked readonly by RODATA? Or can anything more serious happen? (they cannot get into any of the discarded sections, we filter for them explicitly in the linker scripts)

Quoted 5 lines

I have not investigated this. My attention were due to section mismatch warnings pointing to section names I could not find in the code. When I did an objdump of vmlinux the funny section names were gone so I expected ld had recognized them and merged them somehow - but I did not look closer as my focus was to get rid of them anyway.

ah, indeed. if we have the same section name but different attributes then i guess gas/ld resolves the conflict by auto-generating these .1/.2, etc. artificial sections. They dont show up in the vmlinux because they went through the linker scripts that merges them into a single output section. But modpost picks up those pre-merge names.

Quoted 1 line

I also did a quick skimming of info ld - but no luck.

Peter pointed me to "info gas", which has a "Sections and Relocation" chapter.

Ingo

#11 lore raw
Quoted 5 lines · Ingo Molnar
Quoted 2 lines

I also did a quick skimming of info ld - but no luck.

Peter pointed me to "info gas", which has a "Sections and Relocation" chapter.

Also see the ".section" directive under pseudo-ops (in the gas doc.)

-hpa

#12 lore raw
In reply to Linus Torvalds
Quoted 19 lines · Linus Torvalds

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

Linus

---
 arch/x86/kernel/head_64.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/head_64.S +0 -0
index 4f283ad..d16d7b8 100644

arch/x86/kernel/head_64.S ENTRY(secondary_startup_64) · line 257

Quoted 8 lines
arch/x86/kernel/head_64.S +1 -1
@@ -251,7 +251,7 @@ ENTRY(secondary_startup_64)
 
 	/* SMP bootup changes these two */
 #ifndef CONFIG_HOTPLUG_CPU
-	.pushsection .init.data
+	.pushsection .init.data,"aw"
 #endif
 	.align	8
 	.globl	initial_code

I definitely think we should add flags where applicable.

-hpa

#13 lore raw
In reply to Linus Torvalds

arch/x86/kernel/head_64.S ENTRY(secondary_startup_64) · line 255

Quoted 13 lines · Linus Torvalds

Ingo, Thomas,
should we not do this?

Otherwise, it seems we generate a section that isn't allocated?

I think toolchain should add the right flags automatically for sections that start with ".[ro]data" and ".text", but not for the kernel-specific ".init.*" sections.

#ifndef CONFIG_HOTPLUG_CPU

arch/x86/kernel/head_64.S +1 -1
-	.pushsection .init.data
+	.pushsection .init.data,"aw"
 #endif

hm, did you get linker errors due to an unallocated section discarded from the vmlinux?

Sam says that forgetting the "aw" attribute means it's .init.data.1, so the standard vmlinux.lds rule does not pick it up:

  .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
        _sinittext = .;
        INIT_TEXT
        _einittext = .;
  }

as INIT_TEXT is defined as:

#define INIT_TEXT                                                       \
        *(.init.text)                                                   \

which wouldnt pick up .init.text.1, and the linker would thus discard the section?

i'm wondering whether it's possible to add a wildcard, something like this:

#define INIT_TEXT                                                       \
        *(.init.text*)                                                  \

? That way even if we forget the attribute, it gets picked up.

Ingo