17 Oct, 2007

40 commits

  • Rename the ioatdma.c file in preparation for splitting into multiple files,
    which will allow for easier adding new functionality.

    Signed-off-by: Shannon Nelson
    Acked-by: David S. Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shannon Nelson
     
  • Add device ids for new revs of the Intel I/OAT DMA engine

    Signed-off-by: Shannon Nelson
    Acked-by: David S. Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shannon Nelson
     
  • Signed-off-by: Thomas Gleixner
    Cc: Miles Bader
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • In a stock 2.6.22.6 kernel, poweroff a user mode linux guest (2.6.22.6 running
    in skas0 mode) will halt the host linux. I think the reason is the kernel
    thread abort because of a bug. Then the sys_reboot in process of user mode
    linux guest is not trapped by the user mode linux kernel and is executed by
    host. I think it is better to make sure all of our children process to quit
    when user mode linux kernel abort.

    [ jdike - the kernel process needs to ignore SIGTERM, plus the waitpid/kill
    loop is needed to make sure that all of our children are dead before the
    kernel exits ]

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

    Lepton Wu
     
  • Style fixes for the rest of the drivers. arch/um/drivers should be pretty
    CodingStyle-compliant now.

    Except for the ubd driver, which will have to be treated separately.

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

    Jeff Dike
     
  • The calculation of CONFIG_STUB_CODE and CONFIG_STUB_DATA didn't take into
    account anything but 3G/1G and 2G/2G, leaving the other vmsplits out in the
    cold.

    I'd rather not duplicate the four known host vmsplit cases for each of these
    symbols. I'd also like to calculate them based on the highest userspace
    address.

    The Kconfig language seems not to allow calculation of hex constants, so I
    moved this to as-layout.h. CONFIG_STUB_CODE, CONFIG_STUB_DATA, and
    CONFIG_STUB_START are now gone. In their place are STUB_CODE, STUB_DATA, and
    STUB_START in as-layout.h.

    i386 and x86_64 seem to differ as to whether an unadorned constant is an int
    or a long, so I cast them to unsigned long so they can be printed
    consistently. However, they are also used in stub.S, where C types don't work
    so well. So, there are ASM_ versions of these constants for use in stub.S. I
    also ifdef-ed the non-asm-friendly portion of as-layout.h.

    With this in place, most of the rest of this patch is changing CONFIG_STUB_*
    to STUB_*, except in stub.S, where they are changed to ASM_STUB_*.

    defconfig has the old symbols deleted.

    I also print these addresses out in case there is any problem mapping them on
    the host.

    The two stub.S files had some trailing whitespace, so that is cleaned up here.

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

    Jeff Dike
     
  • Handle memory allocation failures when reading packets.

    We have to read something from the host, even if we can't allocate any
    memory. If we don't, the host side of the device may fill up and stop
    delivering interrupts because no new packets can be queued.

    A single sk_buff is allocated whenever an MTU is seen which is larger
    than any seen earlier. This is used to read packets if there is a
    memory allocation failure.

    The large MTU check is done from eth_configure, which is called when a
    interface is added to the system.

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

    Jeff Dike
     
  • A bunch of MTU-related cleanups in the network code.

    First, there is the addition of the notion of a maximally-sized packet, which
    is the MTU plus headers. This is used to size the skb that will receive a
    packet. This allows ether_adjust_skb to go away, as it was used to resize the
    skb after it was allocated.

    Since the skb passed into the low-level read routine is no longer resized, and
    possibly reallocated, there, they (and the write routines) don't need to get
    an sk_buff **. They just need the sk_buff * now. The callers of
    ether_adjust_skb still need to do the skb_put, so that's now inlined.

    The MAX_PACKET definitions in most of the drivers are gone.

    The set_mtu methods were all the same and did nothing, so they can be
    removed.

    The ethertap driver had a typo which doubled the size of the packet rather
    than adding two bytes to it. It also wasn't defining its setup_size, causing
    a zero-byte kmalloc and crash when the invalid pointer returned from kmalloc
    was dereferenced.

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

    Jeff Dike
     
  • Style and other non-functional changes in the UML networking code, including
    include tidying
    style violations
    copyright updates
    printks getting severities
    userspace code calling libc directly rather than using the os_*
    wrappers

    There's also a exit path cleanup in the pcap driver.

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

    Jeff Dike
     
  • There are various uses of powers of 1000, plus the odd BILLION constant in the
    time code. However, there are perfectly good definitions of *SEC_PER_*SEC in
    linux/time.h which can be used instaed.

    These are replaced directly in kernel code. Userspace code imports those
    constants as UM_*SEC_PER_*SEC and uses these.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Now that ITIMER_REAL is no longer used, there is no need for any use of
    SIGALRM whatsoever. This patch removes all mention of it.

    In addition, real_alarm_handler took a signal argument which is now always
    SIGVTALRM. So, that is gone.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Put back an implementation of timeval_to_ns in arch/um/os-Linux/time.c.
    tglx pointed out in his review of tickless support that there was a
    perfectly good implementation of it in linux/time.h. The problem is that
    this is userspace code which can't pull in kernel headers and there doesn't
    seem to be a libc version.

    So, I'm copying the version from linux/time.h rather than resurrecting my
    version. This causes some declaration changes as it now returns a signed
    value rather than an unsigned value.

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

    Jeff Dike
     
  • Now, the idle loop now longer needs SIGALRM firing - it can just sleep for the
    requisite amount of time and fake a timer interrupt when it finishes.

    Any use of ITIMER_REAL now goes away. disable_timer only turns off
    ITIMER_VIRTUAL. switch_timers is no longer needed, so it, and all calls, goes
    away.

    disable_timer now returns the amount of time remaining on the timer.
    default_idle uses this to tell idle_sleep how long to sleep. idle_sleep will
    call alarm_handler if nanosleep returns 0, which is the case if it didn't
    return early due to an interrupt. Otherwise, it just returns.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Enable tickless support.

    CONFIG_TICK_ONESHOT and CONFIG_NO_HZ are enabled.

    itimer_clockevent gets CLOCK_EVT_FEAT_ONESHOT and an implementation of
    .set_next_event.

    CONFIG_UML_REAL_TIME_CLOCK goes away because it only makes sense when there is
    a clock ticking away all the time. timer_handler now just calls do_IRQ once
    without trying to figure out how many ticks to emulate.

    The idle loop now needs to turn ticking on and off.

    Userspace ticks keep happening as usual. However, the userspace loop keep
    track of when the next wakeup should happen and suppresses process ticks until
    that happens.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Add clocksource support.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Enable CONFIG_GENERIC_CLOCKEVENTS.

    timer_irq gets its name changed to timer_handler, and becomes the recipient of
    timer signals.

    The clock_event_device is set up to imitate the current ticking clock, i.e.
    CLOCK_EVT_FEAT_ONESHOT is not enabled yet.

    disable_timer now doesn't ignore SIGALRM and SIGVTALRM because that breaks
    delay calibration.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Enable CONFIG_GENERIC_TIME.

    As a side-effect of this, the UML implementations of do_gettimeofday and
    do_settimeofday go away, as these are provided by generic code. set_time also
    goes away since it was only used by do_settimeofday.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Move timer signal initialization from init_irq_signals to a new function,
    timer_init.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • set_interval took a timer type as an argument, but it always specified a
    virtual timer. So, it is not needed, and it is gone, and set_interval is
    simplified appropriately.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Fix up the switching between virtual and real timers. The idle loop sleeps,
    so the timer at that point must be real time. At all other times, the timer
    must be virtual. Even when userspace is running, and the kernel is asleep,
    the virtual timer is correct because the process timer will be running and the
    process timer will be firing.

    The timer switch used to be in the context switch and timer handler code.
    This is moved to the idle loop and the signal handler, making it much more
    clear why it is happening.

    switch_timers now returns the old timer type so that it may be restored. The
    signal handler uses this in order to restore the previous timer type when it
    returns.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Eliminate hz() since its only purpose was to provide a kernel-space constant
    to userspace code. This can be done instead by providing the constant
    directly through kernel_constants.h.

    Signed-off-by: Jeff Dike
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Make mconsole parameter parsing slightly more idiomatic.

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

    Jeff Dike
     
  • arch/um/os-Linux/tt.c is no longer used.

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

    Jeff Dike
     
  • vmalloc() returns a void pointer, so casting to (void *) is pretty pointless.

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

    Jesper Juhl
     
  • The floating point fields in the pt_regs register file aren't used, so they
    are deleted.

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

    Jeff Dike
     
  • 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 the passing of printk output back to the mconsole client. The existing
    code was somewhat confused, accumulating output in a buffer, but writing it
    out entirely whenever a new chunk was added. This is fixed.

    The earlier include cleanups caused linux/sysrq.h to not be included - this is
    fixed by adding the include back, under CONFIG_MAGIC_SYSRQ.

    CONFIG_MAGIC_SYSRQ is also defaulted to on in defconfig.

    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
     
  • Handle floating point state in across signals correctly. UML/i386 needs to
    know whether the host does PTRACE_[GS]ETFPXREGS, so an arch_init_registers
    hook is added, which on x86_64 does nothing.

    UML doesn't save and restore floating point registers on kernel entry and
    exit, so they need to be copied between the host process and the sigcontext.
    save_fpx_registers and restore_fpx_registers are added for this purpose.
    save_fp_registers and restore_fp_registers already exist.

    There was a bunch of floating point state conversion code in
    arch/um/sys-i386/ptrace.c which isn't needed there, but is needed in signal.c,
    so it is moved over.

    The i386 code now distinguishes between fp and fpx state and handles them
    correctly. The x86_64 code just needs to copy state as-is between the host
    process and the stack. There are also some fixes there to pass the correct
    address of the floating point state around.

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

    Jeff Dike
     
  • Stop including asm/user.h from libc - it seems to be disappearing from
    distros. It's replaced with sys/user.h which defines user_fpregs_struct and
    user_fpxregs_struct instead of user_i387_struct and struct user_fxsr_struct on
    i386.

    As a bonus, on x86_64, I get to dump some stupid typedefs which were needed in
    order to get asm/user.h to compile.

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

    Jeff Dike
     
  • Style fixes in hostfs.

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

    Jeff Dike
     
  • Get rid of an empty if statement which might look like a bug to a
    casual reader.

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

    Jeff Dike
     
  • Tidy the tlb flushing code.

    With tt mode gone, there is no reason to have the capability to have
    called directly from do_mmap, do_mprotect, and do_munmap, rather than
    calling a function pointer that it is given.

    There was a large amount of data that was passed from function to
    function, being used at the lowest level, without being changed. This
    stuff is now encapsulated in a structure which is initialized at the
    top layer and passed down. This simplifies the code, reduces the
    amount of code needed to pass the parameters around, and saves on
    stack space.

    A somewhat more subtle change is the meaning of the current operation
    index. It used to start at -1, being pre-incremented when adding an
    operation. It now starts at 0, being post-incremented, with
    associated adjustments of +/- 1 on comparisons.

    In addition, tlb.h contained a couple of declarations which had no
    users outside of tlb.c, so they could be moved or deleted.

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

    Jeff Dike
     
  • A number of files that were changed in the recent removal of tt mode
    are userspace files which call the os_* wrappers instead of calling
    libc directly. A few other files were affected by this, through

    This patch makes these call glibc directly.

    There are also style fixes in the affected areas.

    os_print_error has no remaining callers, so it is deleted.

    There is a interface change to os_set_exec_close, eliminating a
    parameter which was always the same. The callers are fixed as well.

    os_process_pc got its error path cleaned up.

    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
     
  • Convert the boot-time host ptrace testing from clone to fork. They were
    essentially doing fork anyway. This cleans up the code a bit, and makes
    valgrind a bit happier about grinding it.

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

    Jeff Dike
     
  • This patch fixes some userspace files which were calling libc through the os_*
    wrappers.

    It turns out that there was only one user of os_new_tty_pgrp, so it can be
    deleted.

    There are also some style and whitespace fixes in here.

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

    Jeff Dike
     
  • The space allocated for a process LDT wasn't being freed when the process
    exited.

    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