14 Dec, 2006

2 commits

  • Run this:

    #!/bin/sh
    for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
    echo "De-casting $f..."
    perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
    done

    And then go through and reinstate those cases where code is casting pointers
    to non-pointers.

    And then drop a few hunks which conflicted with outstanding work.

    Cc: Russell King , Ian Molton
    Cc: Mikael Starvik
    Cc: Yoshinori Sato
    Cc: Roman Zippel
    Cc: Geert Uytterhoeven
    Cc: Ralf Baechle
    Cc: Paul Mackerras
    Cc: Kyle McMartin
    Cc: Benjamin Herrenschmidt
    Cc: Martin Schwidefsky
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Greg KH
    Cc: Jens Axboe
    Cc: Paul Fulghum
    Cc: Alan Cox
    Cc: Karsten Keil
    Cc: Mauro Carvalho Chehab
    Cc: Jeff Garzik
    Cc: James Bottomley
    Cc: Ian Kent
    Cc: Steven French
    Cc: David Woodhouse
    Cc: Neil Brown
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     
  • Fix up the work on stack and exit scope trouble by placing the work_struct
    in the uml_net_private data.

    Signed-off-by: Peter Zijlstra
    Acked-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

13 Dec, 2006

1 commit


09 Dec, 2006

3 commits

  • This is the grungy swap all the occurrences in the right places patch that
    goes with the updates. At this point we have the same functionality as
    before (except that sgttyb() returns speeds not zero) and are ready to
    begin turning new stuff on providing nobody reports lots of bugs

    If you are a tty driver author converting an out of tree driver the only
    impact should be termios->ktermios name changes for the speed/property
    setting functions from your upper layers.

    If you are implementing your own TCGETS function before then your driver
    was broken already and its about to get a whole lot more painful for you so
    please fix it 8)

    Also fill in c_ispeed/ospeed on init for most devices, although the current
    code will do this for you anyway but I'd like eventually to lose that extra
    paranoia

    [akpm@osdl.org: bluetooth fix]
    [mp3@de.ibm.com: sclp fix]
    [mp3@de.ibm.com: warning fix for tty3270]
    [hugh@veritas.com: fix tty_ioctl powerpc build]
    [jdike@addtoit.com: uml: fix ->set_termios declaration]
    Signed-off-by: Alan Cox
    Signed-off-by: Martin Peschke
    Acked-by: Peter Oberparleiter
    Cc: Cornelia Huck
    Signed-off-by: Hugh Dickins
    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • The BUG changes in -mm3 need some arch support. This patch adds the UML
    support needed. For the most part, it was stolen from the underlying
    architecture. The exception is the kernel eip < PAGE_OFFSET test, which is
    wrong for skas mode UMLs.

    Signed-off-by: Jeff Dike
    Cc: Jeremy Fitzhardinge
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Fix the locking of signal->tty.

    Use ->sighand->siglock to protect ->signal->tty; this lock is already used
    by most other members of ->signal/->sighand. And unless we are 'current'
    or the tasklist_lock is held we need ->siglock to access ->signal anyway.

    (NOTE: sys_unshare() is broken wrt ->sighand locking rules)

    Note that tty_mutex is held over tty destruction, so while holding
    tty_mutex any tty pointer remains valid. Otherwise the lifetime of ttys
    are governed by their open file handles. This leaves some holes for tty
    access from signal->tty (or any other non file related tty access).

    It solves the tty SLAB scribbles we were seeing.

    (NOTE: the change from group_send_sig_info to __group_send_sig_info needs to
    be examined by someone familiar with the security framework, I think
    it is safe given the SEND_SIG_PRIV from other __group_send_sig_info
    invocations)

    [schwidefsky@de.ibm.com: 3270 fix]
    [akpm@osdl.org: various post-viro fixes]
    Signed-off-by: Peter Zijlstra
    Acked-by: Alan Cox
    Cc: Oleg Nesterov
    Cc: Prarit Bhargava
    Cc: Chris Wright
    Cc: Roland McGrath
    Cc: Stephen Smalley
    Cc: James Morris
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Martin Schwidefsky
    Cc: Jan Kara
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

08 Dec, 2006

5 commits


06 Dec, 2006

1 commit


03 Dec, 2006

1 commit


30 Nov, 2006

1 commit

  • Changes persistant -> persistent. www.dictionary.com does not know
    persistant (with an A), but should it be one of those things you can
    spell in more than one correct way, let me know.

    Signed-off-by: Jan Engelhardt
    Signed-off-by: Adrian Bunk

    Jan Engelhardt
     

26 Nov, 2006

1 commit

  • Reimplement execvp for our purposes - after we call fork() it is fundamentally
    unsafe to use the kernel allocator - current is not valid there. So we simply
    pass to our modified execvp() a preallocated buffer. This fixes a real bug
    and works very well in testing (I've seen indirectly warning messages from the
    forked thread - they went on the pipe connected to its stdout and where read
    as a number by UML, when calling read_output(). I verified the obtained
    number corresponded to "BUG:").

    The added use of __cant_sleep() is not a new bug since __cant_sleep() is
    already used in the same function - passing an atomicity parameter would be
    better but it would require huge change, stating that this function must not
    be called in atomic context and can sleep is a better idea (will make sure of
    this gradually).

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

    Paolo 'Blaisorblade' Giarrusso
     

04 Nov, 2006

2 commits

  • In order to get the __NR_* constants, we need sys/syscall.h.
    linux/unistd.h works as well since it includes syscall.h, however syscall.h
    is more parsimonious. We were inconsistent in this, and this patch adds
    syscall.h includes where necessary and removes linux/unistd.h includes
    where they are not needed.

    asm/unistd.h also includes the __NR_* constants, but these are not the
    glibc-sanctioned ones, so this also removes one such inclusion.

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

    Jeff Dike
     
  • Fix a UML hang in which everything would just stop until some I/O happened
    - a ping, someone whacking the keyboard - at which point everything would
    start up again as though nothing had happened.

    The cause was gcc reordering some code which absolutely needed to be
    executed in the order in the source. When unblock_signals switches signals
    from off to on, it needs to see if any interrupts had happened in the
    critical section. The interrupt handlers check signals_enabled - if it is
    zero, then the handler adds a bit to the "pending" bitmask and returns.
    unblock_signals checks this mask to see if any signals need to be
    delivered.

    The crucial part is this:
    signals_enabled = 1;
    save_pending = pending;
    if(save_pending == 0)
    return;
    pending = 0;

    In order to avoid an interrupt arriving between reading pending and setting
    it to zero, in which case, the record of the interrupt would be erased,
    signals are enabled.

    What happened was that gcc reordered this so that 'save_pending = pending'
    came before 'signals_enabled = 1', creating a one-instruction window within
    which an interrupt could arrive, set its bit in pending, and have it be
    immediately erased.

    When the I/O workload is purely disk-based, the loss of a block device
    interrupt stops the entire I/O system because the next block request will
    wait for the current one to finish. Thus the system hangs until something
    else causes some I/O to arrive, such as a network packet or console input.

    The fix to this particular problem is a memory barrier between enabling
    signals and reading the pending signal mask. An xchg would also probably
    work.

    Looking over this code for similar problems led me to do a few more
    things:

    - make signals_enabled and pending volatile so that they don't get cached
    in registers

    - add an mb() to the return paths of block_signals and unblock_signals so
    that the modification of signals_enabled doesn't get shuffled into the
    caller in the event that these are inlined in the future.

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

    Jeff Dike
     

01 Nov, 2006

12 commits

  • kallsyms now refers to addresses as '_text + 0xADDRESS', rather than just
    '0xADDRESS', so we need to define _text.

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

    Jeff Dike
     
  • Fix a small memory leak in ubd_config, and clearify the confusion which lead
    to it.

    Then, some little changes not affecting operations -
    * move init functions together,
    * add a comment about a potential problem in case of some evolution in the block layer,
    * mark all initcalls as static __init functions
    * mark an used once little function as inline
    * document that mconsole methods are all called in process context (was
    triggered when checking ubd mconsole methods).

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

    Paolo 'Blaisorblade' Giarrusso
     
  • To simplify error handling, make sure fd is saved into ubd_dev->fd only when
    we are sure it is an fd and not an error code.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Use bitfields for boolean fields in ubd data structure.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Pure whitespace and style fixes split out from subsequent patch. Some changes
    (err -> ret) don't make sense now, only later, but I split them out anyway
    since they cluttered the patch.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • do_ubd is actually just a boolean variable - the way it is used currently is a
    leftover from the old 2.4 block layer, but it is still used; its use is
    suspicious, but removing it would be too intrusive for now and needs more
    thinking.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Add some comments about requirements for ubd_io_lock and expand its use.

    When an irq signals that the "controller" (i.e. another thread on the host,
    which does the actual requests and is the only one blocked on I/O on the host)
    has done some work, we call again the request function ourselves
    (do_ubd_request).

    We now do that with ubd_io_lock held - that's useful to protect against
    concurrent calls to elv_next_request and so on.

    XXX: Maybe we shouldn't call at all the request function. Input needed on
    this. Are we supposed to plug and unplug the queue? That code "indirectly"
    does that by setting a flag, called do_ubd, which makes the request function
    return (it's a residual of 2.4 block layer interface).

    Meanwhile, however, merge this patch, which improves things.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • This lock protects ubd setup and teardown, so is only used in process context;
    beyond that, during such setup memory allocations must be performed and some
    generic functions which can sleep must be called (such as add_disk()). So the
    only correct solution is to make it a mutex instead of a spin_lock. No other
    change is done - this lock must be acquired in different places but it's done
    afterwards.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • To rethink locking, I needed to understand well what each function does.
    While doing this I renamed some:

    * ubd_close -> ubd_close_dev (since it pairs with ubd_open_dev)

    * ubd_new_disk -> ubd_disk_register (it handles registration with the block
    layer - one hopes this makes clearer the difference with ubd_add())

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Rename the ubd_dev array to ubd_devs and then call any "struct ubd" ubd_dev
    instead of dev, which doesn't make clear what we're treating (and no, it's not
    hungarian notation - not any more than calling all vm_area_struct vma or all
    inodes inode).

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Add documentation about some fields in struct ubd, whose meaning is
    non-obvious due to struct names (should change names altogether, I agree).

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

    Paolo 'Blaisorblade' Giarrusso
     
  • With 256 minors and 16 minors used per each UBD device, we can allow the use
    of up to 16 UBD devices per UML.

    Also chnage parse_unit and leave to the caller (which already do it) the check
    for excess numbers, since this is just supposed to do raw parsing.

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

    Paolo 'Blaisorblade' Giarrusso
     

31 Oct, 2006

2 commits

  • From: Jeff Dike , Paolo Giarrusso

    Make sure that when compiling USER_OBJS the correct compilation options are
    passed; since they are compiled with USER_CFLAGS which is derived from
    CFLAGS, make sure it is a recursively evaluated variable, so that changes
    to CFLAGS done afterwards the inclusion of arch/$(ARCH)/Makefile are
    reflected in USER_CFLAGS.

    For instance, without this patch userspace objects are never compiled with
    debug info active.

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

    akpm@osdl.org
     
  • Fix commit 5f4c6bc1f369f20807a8e753c2308d1629478c61: it spits out warnings
    about missing syscall prototype (it is in ) and it does not
    recognize that two uses of _syscallX are to be resolved against kernel
    headers in the source tree, not against _syscallX; they in fact do not
    compile and would not work anyway.

    If _syscallX macros will be removed from the kernel tree altogether, the
    only reasonable solution for that piece of code is switching to open-coded
    inline assembly (it's remapping the whole executable from memory, except
    the page containing this code).

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

    Paolo 'Blaisorblade' Giarrusso
     

25 Oct, 2006

1 commit

  • * when we have stop/sysrq/go, we get pt_regs of whatever executes
    mc_work_proc(). Would be better to see what we had at the time of
    interrupt that got us stop.

    * stop/stop/stop..... will give stack overflow. Shouldn't allow stop
    from mconsole_stop().

    * stop/stop/go leaves us inside mconsole_stop() with
    os_set_fd_block(req->originating_fd, 0);
    reactivate_fd(req->originating_fd, MCONSOLE_IRQ);
    just done by nested mconsole_stop(). Ditto.

    * once we'd seen stop, there's a period when INTR commands are executed
    out of order (as they should; we might have the things stuck badly
    enough to never reach mconsole_stop(), but still not badly enough to
    block mconsole_interrupt(); in that situation we _want_ things like
    "cad" to be executed immediately). Once we enter monsole_stop(), all
    INTR commands will be executed in order, mixed with PROC ones. We'd
    better let user see that such change of behaviour has happened.
    (Suggested by lennert).

    * stack footprint of monsole_interrupt() is an atrocity; AFAICS we can
    safely make struct mc_request req; static in function there.

    Signed-off-by: Al Viro
    Acked-by: Jeff Dike
    Signed-off-by: Linus Torvalds

    Al Viro
     

21 Oct, 2006

8 commits

  • When enabling the mmapper driver I got warnings because this "const"
    miscdevice structure is passed to function as non-const pointer; unlike struct
    tty_operations, however, I verified that misc_{de,}register _do_ modify their
    parameter, so this const attribute must be removed.

    Since the purpose of the change was to guarantee that no lock was needed, add
    a comment to prove this differently.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Silence useless warning about undefined symbol in Kconfig.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Freeing the stack is left uselessly to the caller of run_helper in some cases
    - this is taken from run_helper_thread, but here it is useless, so no caller
    needs it and the only place where this happens has a potential leak - in case
    of error neither run_helper() nor xterm_open() call free_stack(). At this
    point passing a pointer is not needed - the stack pointer should be passed
    directly, but this change is not done here.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • This should make sure that, for UML, host's configuration files are not
    considered, which avoids various pains to the user. Our dependency are such
    that the obtained Kconfig will be valid and will lead to successful
    compilation - however they cannot prevent an user from disabling any boot
    device, and if an option is not set in the read .config (say
    /boot/config-XXX), with make menuconfig ARCH=um, it is not set. This always
    disables UBD and all console I/O channels, which leads to non-working UML
    kernels, so this bothers users - especially now, since it will happen on
    almost every machine (/boot/config-`uname -r` exists almost on every machine).
    It can be workarounded with make defconfig ARCH=um, but it is non-obvious and
    can be avoided, so please _do_ merge this patch.

    Given the existence of options, it could be interesting to implement
    (additionally) "option required" - with it, Kconfig will refuse reading a
    .config file (from wherever it comes) if the given option is not set. With
    this, one could mark with it the option characteristic of the given
    architecture (it was an old proposal of Roman Zippel, when I pointed out our
    problem):

    config UML
    option required
    default y

    However this should be further discussed:
    *) for x86, it must support constructs like:

    ==arch/i386/Kconfig==
    config 64BIT
    option required
    default n
    where Kconfig must require that CONFIG_64BIT is disabled or not present in the
    read .config.

    *) do we want to do such checks only for the starting defconfig or also for
    .config? Which leads to:
    *) I may want to port a x86_64 .config to x86 and viceversa, or even among more
    different archs. Should that be allowed, and in which measure (the user may
    force skipping the check for a .config or it is only given a warning by
    default)?

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

    Paolo 'Blaisorblade' Giarrusso
     
  • CONFIG_MODE_TT does not work there, the UML_ prefixed version must be used -
    this causes a link-time failure when CONFIG_MODE_TT is enabled (i.e. always
    here, never by Jeff).

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

    Paolo 'Blaisorblade' Giarrusso
     
  • Fix coding conventions violations is arch/um/os-Linux/helper.c.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • user.h is too generic a header name. I've split out allocation routines from
    it.

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

    Paolo 'Blaisorblade' Giarrusso
     
  • arch/um/sys-x86_64/ptrace.c:20:1: warning: "SC_SS" redefined
    In file included from arch/um/include/sysdep/ptrace.h:18,
    from include/asm/ptrace-generic.h:12,
    from include/asm/ptrace.h:15,
    from arch/um/sys-x86_64/ptrace.c:8:
    arch/um/include/sysdep/sc.h:38:1: warning: this is the location of the previous definition
    arch/um/sys-x86_64/ptrace.c: In function 'putreg':
    arch/um/sys-x86_64/ptrace.c:63: warning: implicit declaration of function 'SC_FS_BASE'
    arch/um/sys-x86_64/ptrace.c:63: error: invalid lvalue in unary '&'
    arch/um/sys-x86_64/ptrace.c:63: warning: implicit declaration of function 'SC_GS_BASE'
    arch/um/sys-x86_64/ptrace.c:63: error: invalid lvalue in unary '&'
    arch/um/sys-x86_64/ptrace.c: In function 'getreg':
    arch/um/sys-x86_64/ptrace.c:101: error: invalid lvalue in unary '&'
    arch/um/sys-x86_64/ptrace.c:101: error: invalid lvalue in unary '&'

    I'd have to say that the fix for this, for now, is this:

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

    Jeff Dike