15 Nov, 2007

1 commit

  • pud_clear wasn't setting the _PAGE_NEWPAGE bit, fooling tlb_flush into
    thinking that this area of the address space was up-to-date and not unmapping
    whatever was covered by the pud.

    This manifested itself as ldconfig on x86_64 complaining about the first
    library it looked at not being a valid ELF file. A config file is mapped at
    0x4000000, as the only thing mapped under its pud, and unmapped. The
    unmapping caused a pud_clear, which, due to this bug, didn't actually unmap
    the config file data on the host. The first library is then mapped at the
    same location, but is not actually mapped on the host because accesses to it
    cause no page faults. As a result, ldconfig sees the old config file data.

    [akpm@linux-foundation.org: coding-style cleanups]
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

29 Oct, 2007

1 commit

  • Don't undef __i386__/__x86_64__ in uml anymore, make sure that (few) places
    that required adjusting the ifdefs got those.

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro
     

20 Oct, 2007

2 commits

  • forbid asm/bitops.h direct inclusion

    Because of compile errors that may occur after bit changes if asm/bitops.h is
    included directly without e.g. linux/kernel.h which includes linux/bitops.h,
    forbid direct inclusion of asm/bitops.h. Thanks to Adrian Bunk.

    Signed-off-by: Jiri Slaby
    Cc: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Slaby
     
  • Nobody uses flush_tlb_pgtables anymore, this patch removes all remaining
    traces of it from all archs.

    Signed-off-by: Benjamin Herrenschmidt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

18 Oct, 2007

1 commit

  • .i is an ending used for preprocessed stuff.

    This patch therefore renames assembler include files to .h and guards
    the contents with an #ifdef __ASSEMBLY__.

    [ tglx: arch/x86 adaptation ]

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andi Kleen
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Adrian Bunk
     

17 Oct, 2007

13 commits

  • All asm/ipc.h files do only #include .

    This patch therefore removes all include/asm-*/ipc.h files and moves the
    contents of include/asm-generic/ipc.h to include/linux/ipc.h.

    Signed-off-by: Adrian Bunk
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Tidy the code affected by the floating point fixes.

    A bunch of unused stuff is gone, including two sigcontext.c files,
    which turned out to be entirely unneeded.

    There are the usual fixes -
    whitespace and style cleanups
    copyright updates
    emacs formatting comments gone
    include cleanups
    adding severities to printks

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Fix core dumping of floating point state. ELF_CORE_COPY_FPREGS gets a
    definitions, and as a result, dump_fpu no longer needs to exist. Also,
    elf_fpregset_t needed a real definition.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Handle floating point state better in ptrace. The code now correctly
    distinguishes between PTRACE_[GS]ETFPREGS and PTRACE_[GS]ETFPXREGS. The FPX
    requests get handed off to arch-specific code because that's not generic.

    get_fpregs, set_fpregs, set_fpregs, and set_fpxregs needed real
    implementations.

    Something here exposed a missing include in asm/page.h, which needed
    linux/types.h in order to get gfp_t, so that's fixed here.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • "extern inline" will have different semantics with gcc 4.3.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Before the removal of tt mode, access to a register on the skas-mode side of a
    pt_regs struct looked like pt_regs.regs.skas.regs.regs[FOO]. This was bad
    enough, but it became pt_regs.regs.regs.regs[FOO] with the removal of the
    union from the middle. To get rid of the run of three "regs", the last field
    is renamed to "gp".

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch folds mmu_context_skas into struct mm_context, changing all users
    of these structures as needed.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • do_longjmp used to be needed when UML didn't have its own implementation of
    setjmp and longjmp. They came from libc, and couldn't be called directly from
    kernel code, as the libc jmp_buf couldn't be imported there. do_longjmp was a
    userspace function which served to provide longjmp access to kernel code.

    This is gone, and a number of void * pointers can now be jmp_buf *.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Formatting changes in the files which have been changed in the course
    of folding foo_skas functions into their callers. These include:
    copyright updates
    header file trimming
    style fixes
    adding severity to printks

    These changes should be entirely non-functional.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch makes a number of simplifications enabled by the removal of
    CHOOSE_MODE. There were lots of functions that looked like

    int foo(args){
    foo_skas(args);
    }

    The bodies of foo_skas are now folded into foo, and their declarations (and
    sometimes entire header files) are deleted.

    In addition, the union uml_pt_regs, which was a union between the tt and skas
    register formats, is now a struct, with the tt-mode arm of the union being
    removed.

    It turns out that usr2_handler was unused, so it is gone.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Formatting changes in the files which have been changed in the course
    of removing CHOOSE_MODE. These include:
    copyright updates
    header file trimming
    style fixes
    adding severity to printks

    These changes should be entirely non-functional.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • The next stage after removing code which depends on CONFIG_MODE_TT is removing
    the CHOOSE_MODE abstraction, which provided both compile-time and run-time
    branching to either tt-mode or skas-mode code.

    This patch removes choose-mode.h and all inclusions of it, and replaces all
    CHOOSE_MODE invocations with the skas branch. This leaves a number of trivial
    functions which will be dealt with in a later patch.

    There are some changes in the uaccess and tls support which go somewhat beyond
    this and eliminate some of the now-redundant functions.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patchset throws out tt mode, which has been non-functional for a while.

    This is done in phases, interspersed with code cleanups on the affected files.

    The removal is done as follows:
    remove all code, config options, and files which depend on
    CONFIG_MODE_TT
    get rid of the CHOOSE_MODE macro, which decided whether to
    call tt-mode or skas-mode code, and replace invocations with their
    skas portions
    replace all now-trivial procedures with their skas equivalents

    There are now a bunch of now-redundant pieces of data structures, including
    mode-specific pieces of the thread structure, pt_regs, and mm_context. These
    are all replaced with their skas-specific contents.

    As part of the ongoing style compliance project, I made a style pass over all
    files that were changed. There are three such patches, one for each phase,
    covering the files affected by that phase but no later ones.

    I noticed that we weren't freeing the LDT state associated with a process when
    it exited, so that's fixed in one of the later patches.

    The last patch is a tidying patch which I've had for a while, but which caused
    inexplicable crashes under tt mode. Since that is no longer a problem, this
    can now go in.

    This patch:

    Start getting rid of tt mode support.

    This patch throws out CONFIG_MODE_TT and all config options, code, and files
    which depend on it.

    CONFIG_MODE_SKAS is gone and everything that depends on it is included
    unconditionally.

    The few changed lines are in re-written Kconfig help, lines which needed
    something skas-related removed from them, and a few more which weren't
    strictly deletions.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

11 Sep, 2007

1 commit

  • The earlier crash dump fix on x86_64 depended on patches in -mm which
    are intended for post-2.6.23. Without those, it broke the build when
    it went into 2.6.23-rc5.

    This changes the field references in ELF_CORE_COPY_REGS back to those
    still used in mainline.

    Signed-off-by: Jeff Dike
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

31 Aug, 2007

2 commits

  • Stop UML crashing when trying to dump a process core on x86_64. This is the
    minimal fix to stop the crash - more things are broken here, and patches are
    forthcoming.

    The immediate thing to do is define ELF_CORE_COPY_REGS and
    ELF_CORE_COPY_FPREGS. Defining ELF_CORE_COPY_FPREGS allows dump_fpu to go
    away. It is defined in terms of save_fp_registers, so that needs to be added.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Fix a class of bugs in the UML linker scripts which caused section boundary
    variables to sometimes not line up with their sections.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

20 Jul, 2007

1 commit

  • New arch macro STACK_TOP_MAX it gives the larges valid stack address for the
    architecture in question.

    It differs from STACK_TOP in that it will not distinguish between
    personalities but will always return the largest possible address.

    This is used to create the initial stack on execve, which we will move down to
    the proper location once the binfmt code has figured out where that is.

    Signed-off-by: Peter Zijlstra
    Signed-off-by: Ollie Wild
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

17 Jul, 2007

3 commits


24 Jun, 2007

2 commits

  • Add asm-um/paravirt.h so that i386 headers that get pulled into UML
    don't cause build failures when they want asm/paravirt.h.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Get UML to use the generic bug support rather than arch specific one.

    If I insert an artificial bug right before loading init, I get this:

    Kernel panic - not syncing: Kernel mode signal 4

    EIP: 0023:[] CPU: 0 Not tainted ESP: 002b:f7fd4fbc EFLAGS: 00000246
    Not tainted
    EAX: 00000000 EBX: 00007870 ECX: 00000013 EDX: 00007870
    ESI: 0000786d EDI: 00000011 EBP: f7fd4fd8 DS: 002b ES: 002b
    08273bec: [] show_regs+0x104/0x106
    08273c08: [] panic_exit+0x2c/0x4b
    08273c18: [] notifier_call_chain+0x32/0x5b
    08273c38: [] __atomic_notifier_call_chain+0x30/0x32
    08273c54: [] atomic_notifier_call_chain+0x2f/0x31
    08273c70: [] panic+0x75/0x131
    08273c94: [] relay_signal+0x87/0x95
    08273cb0: [] sig_handler_common_skas+0x9e/0x120
    08273cd8: [] sig_handler+0x28/0x4f
    08273cec: [] handle_signal+0x53/0x89
    08273d0c: [] hard_handler+0x18/0x28
    08273d1c: [] transitions+0xf7d598b8/0xfffffff0

    With this patch in place, this is how it looks:

    BUG: failure at init/main.c:779/init_post()!
    Kernel panic - not syncing: BUG!

    EIP: 0023:[] CPU: 0 Not tainted ESP: 002b:f7f0dfbc EFLAGS: 00000246
    Not tainted
    EAX: 00000000 EBX: 000069db ECX: 00000013 EDX: 000069db
    ESI: 000069d8 EDI: 00000011 EBP: f7f0dfd8 DS: 002b ES: 002b
    098efedc: [] show_regs+0x104/0x106
    098efef8: [] panic_exit+0x2c/0x4b
    098eff08: [] notifier_call_chain+0x32/0x5b
    098eff28: [] __atomic_notifier_call_chain+0x30/0x32
    098eff44: [] atomic_notifier_call_chain+0x2f/0x31
    098eff60: [] panic+0x75/0x131
    098eff84: [] init_post+0xcd/0xe8
    098eff9c: [] kernel_init+0x8e/0x9a
    098effb4: [] run_kernel_thread+0x41/0x53
    098effe0: [] new_thread_handler+0x62/0x8b
    098efffc: [] 0xa55a5a5a

    [ jdike - added BUG_TABLE to linker script ]

    Signed-off-by: Nick Piggin
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

17 Jun, 2007

1 commit

  • The x86_64 a.out.h got a definition of STACK_TOP_MAX, which interferes with
    the UML version. So, just undef it like STACK_TOP.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

11 May, 2007

1 commit

  • Add a separate IRQ stack. This differs from i386 in having the entire
    interrupt run on a separate stack rather than starting on the normal kernel
    stack and switching over once some preparation has been done. The underlying
    mechanism, is of course, sigaltstack.

    Another difference is that interrupts that happen in userspace are handled on
    the normal kernel stack. These cause a wait wakeup instead of a signal
    delivery so there is no point in trying to switch stacks for these. There's
    no other stuff on the stack, so there is no extra stack consumption.

    This quirk makes it possible to have the entire interrupt run on a separate
    stack - process preemption (and calls to schedule()) happens on a normal
    kernel stack. If we enable CONFIG_PREEMPT, this will need to be rethought.

    The IRQ stack for CPU 0 is declared in the same way as the initial kernel
    stack. IRQ stacks for other CPUs will be allocated dynamically.

    An extra field was added to the thread_info structure. When the active
    thread_info is copied to the IRQ stack, the real_thread field points back to
    the original stack. This makes it easy to tell where to copy the thread_info
    struct back to when the interrupt is finished. It also serves as a marker of
    a nested interrupt. It is NULL for the first interrupt on the stack, and
    non-NULL for any nested interrupts.

    Care is taken to behave correctly if a second interrupt comes in when the
    thread_info structure is being set up or taken down. I could just disable
    interrupts here, but I don't feel like giving up any of the performance gained
    by not flipping signals on and off.

    If an interrupt comes in during these critical periods, the handler can't run
    because it has no idea what shape the stack is in. So, it sets a bit for its
    signal in a global mask and returns. The outer handler will deal with this
    signal itself.

    Atomicity is had with xchg. A nested interrupt that needs to bail out will
    xchg its signal mask into pending_mask and repeat in case yet another
    interrupt hit at the same time, until the mask stabilizes.

    The outermost interrupt will set up the thread_info and xchg a zero into
    pending_mask when it is done. At this point, nested interrupts will look at
    ->real_thread and see that no setup needs to be done. They can just continue
    normally.

    Similar care needs to be taken when exiting the outer handler. If another
    interrupt comes in while it is copying the thread_info, it will drop a bit
    into pending_mask. The outer handler will check this and if it is non-zero,
    will loop, set up the stack again, and handle the interrupt.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

10 May, 2007

2 commits

  • With the advent of kdump, the assumption that the boot CPU when booting an UP
    kernel is always the CPU with a particular hardware ID (often 0) (usually
    referred to as BSP on some architectures) is not valid anymore. The reason
    being that the dump capture kernel boots on the crashed CPU (the CPU that
    invoked crash_kexec), which may be or may not be that particular CPU.

    Move definition of hard_smp_processor_id for the UP case to
    architecture-specific code ("asm/smp.h") where it belongs, so that each
    architecture can provide its own implementation.

    Signed-off-by: Fernando Luis Vazquez Cao
    Cc: "Luck, Tony"
    Acked-by: Andi Kleen
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fernando Luis Vazquez Cao
     
  • UML now needs required-features.h to build - an empty one suffices.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

09 May, 2007

2 commits

  • i386:

    Rearrange the cmpxchg code to allow atomic.h to get it without needing to
    include system.h. This kills warnings in the UML build from atomic.h about
    implicit declarations of cmpxchg symbols. The i386 build presumably isn't
    seeing this because a separate inclusion of system.h is covering it over.

    The cmpxchg stuff is moved to asm-i386/cmpxchg.h, with an include left in
    system.h for the benefit of generic code which expects cmpxchg there.

    Meanwhile, atomic.h includes cmpxchg.h.

    This causes no noticable damage to the i386 build.

    x86_64:

    Move cmpxchg into its own header. atomic.h already included system.h, so
    this is changed to include cmpxchg.h.

    This is purely cleanup - it's not fixing any warnings - so if the x86_64
    system.h isn't considered as cleanup-worthy as i386, then this can be
    dropped.

    It causes no noticable damage to the x86_64 build.

    uml:

    The i386 and x86_64 cmpxchg patches require an asm-um/cmpxchg.h for the
    UML build.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This patch moves the die notifier handling to common code. Previous
    various architectures had exactly the same code for it. Note that the new
    code is compiled unconditionally, this should be understood as an appel to
    the other architecture maintainer to implement support for it aswell (aka
    sprinkling a notify_die or two in the proper place)

    arm had a notifiy_die that did something totally different, I renamed it to
    arm_notify_die as part of the patch and made it static to the file it's
    declared and used at. avr32 used to pass slightly less information through
    this interface and I brought it into line with the other architectures.

    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix vmalloc_sync_all bustage]
    [bryan.wu@analog.com: fix vmalloc_sync_all in nommu]
    Signed-off-by: Christoph Hellwig
    Cc:
    Cc: Russell King
    Signed-off-by: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

08 May, 2007

1 commit

  • More trimming of the page fault path.

    Permissions are passed around in a single int rather than one bit per
    int. The permission values are copied from libc so that they can be
    passed to mmap and mprotect without any further conversion.

    The register sets used by do_syscall_stub and copy_context_skas0 are
    initialized once, at boot time, rather than once per call.

    wait_stub_done checks whether it is getting the signals it expects by
    comparing the wait status to a mask containing bits for the signals of
    interest rather than comparing individually to the signal numbers. It
    also has one check for a wait failure instead of two. The caller is
    expected to do the initial continue of the stub. This gets rid of an
    argument and some logic. The fname argument is gone, as that can be
    had from a stack trace.

    user_signal() is collapsed into userspace() as it is basically one or
    two lines of code afterwards.

    The physical memory remapping stuff is gone, as it is unused.

    flush_tlb_page is inlined.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

03 May, 2007

1 commit

  • Add hooks to allow a paravirt implementation to track the lifetime of
    an mm. Paravirtualization requires three hooks, but only two are
    needed in common code. They are:

    arch_dup_mmap, which is called when a new mmap is created at fork

    arch_exit_mmap, which is called when the last process reference to an
    mm is dropped, which typically happens on exit and exec.

    The third hook is activate_mm, which is called from the arch-specific
    activate_mm() macro/function, and so doesn't need stub versions for
    other architectures. It's called when an mm is first used.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen
    Cc: linux-arch@vger.kernel.org
    Cc: James Bottomley
    Acked-by: Ingo Molnar

    Jeremy Fitzhardinge
     

26 Apr, 2007

1 commit


03 Apr, 2007

1 commit

  • Currently we have a confused udelay implementation.

    * __const_udelay does not accept usecs but xloops in i386 and x86_64
    * our implementation requires usecs as arg
    * it gets a xloops count when called by asm/arch/delay.h

    Bugs related to this (extremely long shutdown times) where reported by some
    x86_64 users, especially using Device Mapper.

    To hit this bug, a compile-time constant time parameter must be passed -
    that's why UML seems to work most times. Fix this with a simple udelay
    implementation.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Acked-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     

31 Mar, 2007

1 commit


29 Mar, 2007

1 commit

  • _PAGE_PROTNONE conflicts with the lowest bit of pgoff. This causes all sorts
    of weirdness when nonlinear mappings are used.

    Took me a good half day to track this down.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Jeff Dike
    Acked-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

28 Mar, 2007

1 commit

  • During a static link, ld has started putting a .note section in the
    .uml.setup.init section. This has the result that the UML setups begin
    with 32 bytes of garbage and UML crashes immediately on boot.

    This patch creates a specific .note section for ld to drop this stuff
    into.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike