15 Feb, 2006

1 commit

  • Currently, copy-on-write may change the physical address of a page even if the
    user requested that the page is pinned in memory (either by mlock or by
    get_user_pages). This happens if the process forks meanwhile, and the parent
    writes to that page. As a result, the page is orphaned: in case of
    get_user_pages, the application will never see any data hardware DMA's into
    this page after the COW. In case of mlock'd memory, the parent is not getting
    the realtime/security benefits of mlock.

    In particular, this affects the Infiniband modules which do DMA from and into
    user pages all the time.

    This patch adds madvise options to control whether memory range is inherited
    across fork. Useful e.g. for when hardware is doing DMA from/into these
    pages. Could also be useful to an application wanting to speed up its forks
    by cutting large areas out of consideration.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: Hugh Dickins
    Cc: Michael Kerrisk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael S. Tsirkin
     

04 Feb, 2006

1 commit

  • "[PATCH] m68knommu: fix find_next_zero_bit in bitops.h" fixed a typo in
    m68knommu implementation of find_next_zero_bit().

    grep(1) shows that cris, frv, h8300, v850 are also affected.

    Signed-off-by: Alexey Dobriyan
    Cc: Mikael Starvik
    Cc: David Howells
    Cc: Yoshinori Sato
    Cc: Miles Bader
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

19 Jan, 2006

1 commit

  • Handle TIF_RESTORE_SIGMASK as added by David Woodhouse's patch entitled:

    [PATCH] 2/3 Add TIF_RESTORE_SIGMASK support for arch/powerpc
    [PATCH] 3/3 Generic sys_rt_sigsuspend

    It does the following:

    (1) Declares TIF_RESTORE_SIGMASK for FRV.

    (2) Invokes it over to do_signal() when TIF_RESTORE_SIGMASK is set.

    (3) Makes do_signal() support TIF_RESTORE_SIGMASK, using the signal mask saved
    in current->saved_sigmask.

    (4) Discards sys_rt_sigsuspend() from the arch, using the generic one instead.

    (5) Makes sys_sigsuspend() save the signal mask and set TIF_RESTORE_SIGMASK
    rather than attempting to fudge the return registers.

    (6) Makes sys_sigsuspend() return -ERESTARTNOHAND rather than looping
    intrinsically.

    (7) Makes setup_frame(), setup_rt_frame() and handle_signal() return 0 or
    -EFAULT rather than true/false to be consistent with the rest of the
    kernel.

    Due to the fact do_signal() is then only called from one place:

    (8) Make do_signal() no longer have a return value is it was just being
    ignored; force_sig() takes care of this.

    (9) Discards the old sigmask argument to do_signal() as it's no longer
    necessary.

    This patch depends on the FRV signalling patches as well as the
    sys_rt_sigsuspend patch.

    Signed-off-by: David Howells
    Signed-off-by: David Woodhouse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

13 Jan, 2006

1 commit


11 Jan, 2006

1 commit


10 Jan, 2006

2 commits


09 Jan, 2006

5 commits

  • Fix a number of miscellanous items:

    (1) Declare lock sections in the linker script.

    (2) Recurse in the correct manner in the arch makefile.

    (3) asm/bug.h requires asm/linkage.h to be included first. One C file puts
    asm/bug.h first.

    (4) Add an empty RTC header file to avoid missing header file errors.

    (5) sg_dma_address() should use the dma_address member of a scatter list.

    (6) Add trivial pci_unmap support.

    (7) Add pgprot_noncached()

    (8) Discard u_quad_t.

    (9) Use ~0UL rather than ULONG_MAX in unistd.h in case the latter isn't
    declared.

    (10) Add an empty VGA header file to avoid missing header file errors.

    (11) Add an XOR header file to use the generic XOR stuff.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Make the get_user macro cast the source pointer to an appropriate type for the
    specified size.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add stubs for FRV module support.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Supply various I/O access primitives that are missing for the FRV arch:

    (*) mmiowb()

    (*) read*_relaxed()

    (*) ioport_*map()

    (*) ioread*(), iowrite*(), ioread*_rep() and iowrite*_rep()

    (*) pci_io*map()

    (*) check_signature()

    The patch also makes __is_PCI_addr() more efficient.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Drop support for 8-bit and 16-bit xchg and cmpxchg emulation and implements
    32-bit xchg with the SWAP/SWAPI instruction.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

07 Jan, 2006

4 commits

  • The attached patch improves the signal handling:

    (1) It makes do_signal() static as it isn't called from anywhere outside of
    the arch code.

    (2) It removes the regs argument to all the static functions within that file,
    using __frame instead (which is the same thing held in a global register).

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • The attached patch implements futex operations for the FRV architecture. The
    operations are applicable to both MMU and no-MMU modes; though the EFAULT
    handling will be a little bit of wasted space on the latter.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Several counters already have the need to use 64 atomic variables on 64 bit
    platforms (see mm_counter_t in sched.h). We have to do ugly ifdefs to fall
    back to 32 bit atomic on 32 bit platforms.

    The VM statistics patch that I am working on will also make more extensive
    use of atomic64.

    This patch introduces a new type atomic_long_t by providing definitions in
    asm-generic/atomic.h that works similar to the c "long" type. Its 32 bits
    on 32 bit platforms and 64 bits on 64 bit platforms.

    Also cleans up the determination of the mm_counter_t in sched.h.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Here is the patch to implement madvise(MADV_REMOVE) - which frees up a
    given range of pages & its associated backing store. Current
    implementation supports only shmfs/tmpfs and other filesystems return
    -ENOSYS.

    "Some app allocates large tmpfs files, then when some task quits and some
    client disconnect, some memory can be released. However the only way to
    release tmpfs-swap is to MADV_REMOVE". - Andrea Arcangeli

    Databases want to use this feature to drop a section of their bufferpool
    (shared memory segments) - without writing back to disk/swap space.

    This feature is also useful for supporting hot-plug memory on UML.

    Concerns raised by Andrew Morton:

    - "We have no plan for holepunching! If we _do_ have such a plan (or
    might in the future) then what would the API look like? I think
    sys_holepunch(fd, start, len), so we should start out with that."

    - Using madvise is very weird, because people will ask "why do I need to
    mmap my file before I can stick a hole in it?"

    - None of the other madvise operations call into the filesystem in this
    manner. A broad question is: is this capability an MM operation or a
    filesytem operation? truncate, for example, is a filesystem operation
    which sometimes has MM side-effects. madvise is an mm operation and with
    this patch, it gains FS side-effects, only they're really, really
    significant ones."

    Comments:

    - Andrea suggested the fs operation too but then it's more efficient to
    have it as a mm operation with fs side effects, because they don't
    immediatly know fd and physical offset of the range. It's possible to
    fixup in userland and to use the fs operation but it's more expensive,
    the vmas are already in the kernel and we can use them.

    Short term plan & Future Direction:

    - We seem to need this interface only for shmfs/tmpfs files in the short
    term. We have to add hooks into the filesystem for correctness and
    completeness. This is what this patch does.

    - In the future, plan is to support both fs and mmap apis also. This
    also involves (other) filesystem specific functions to be implemented.

    - Current patch doesn't support VM_NONLINEAR - which can be addressed in
    the future.

    Signed-off-by: Badari Pulavarty
    Cc: Hugh Dickins
    Cc: Andrea Arcangeli
    Cc: Michael Kerrisk
    Cc: Ulrich Drepper
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Badari Pulavarty
     

04 Jan, 2006

1 commit


29 Nov, 2005

1 commit

  • The attached patch implements a bunch of small changes to the FRV arch to
    make it work again.

    It deals with the following problems:

    (1) SEM_DEBUG should be SEMAPHORE_DEBUG.

    (2) The argument list to pcibios_penalize_isa_irq() has changed.

    (3) CONFIG_HIGHMEM can't be used directly in #if as it may not be defined.

    (4) page->private is no longer directly accessible.

    (5) linux/hardirq.h assumes asm/hardirq.h will include linux/irq.h

    (6) The IDE MMIO access functions are given pointers, not integers, and so
    get type casting errors.

    (7) __pa() is passed an explicit u64 type in drivers/char/mem.c, but that
    can't be cast directly to a pointer on a 32-bit platform.

    (8) SEMAPHORE_DEBUG should not be contingent on WAITQUEUE_DEBUG as that no
    longer exists.

    (9) PREEMPT_ACTIVE is too low a value.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

14 Nov, 2005

2 commits

  • Introduce an atomic_inc_not_zero operation. Make this a special case of
    atomic_add_unless because lockless pagecache actually wants
    atomic_inc_not_negativeone due to its offset refcount.

    Signed-off-by: Nick Piggin
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • Introduce an atomic_cmpxchg operation.

    Signed-off-by: Nick Piggin
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

07 Nov, 2005

1 commit

  • Fix more include file problems that surfaced since I submitted the previous
    fix-missing-includes.patch. This should now allow not to include sched.h
    from module.h, which is done by a followup patch.

    Signed-off-by: Tim Schmielau
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

31 Oct, 2005

2 commits

  • __MUTEX_INITIALIZER() has no users, and equates to the more commonly used
    DECLARE_MUTEX(), thus making it pretty much redundant. Remove it for good.

    Signed-off-by: Arthur Othieno
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arthur Othieno
     
  • This patch removes page_pte_prot and page_pte macros from all
    architectures. Some architectures define both, some only page_pte (broken)
    and others none. These macros are not used anywhere.

    page_pte_prot(page, prot) is identical to mk_pte(page, prot) and
    page_pte(page) is identical to page_pte_prot(page, __pgprot(0)).

    * The following architectures define both page_pte_prot and page_pte

    arm, arm26, ia64, sh64, sparc, sparc64

    * The following architectures define only page_pte (broken)

    frv, i386, m32r, mips, sh, x86-64

    * All other architectures define neither

    Signed-off-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

28 Oct, 2005

1 commit


22 Sep, 2005

1 commit

  • As recently done by Russell King for ARM, commit
    4732efbeb997189d9f9b04708dc26bf8613ed721 introduces a generic asm/futex.h copied
    along most arches, which includes a "-ENOSYS support" to be changed if needed.
    However, it includes an unused var (taken from the "real" version) which GCC
    warns about.

    Remove it from all arches having that file version (i.e. same GIT id).
    $ git-diff-tree -r HEAD
    and
    $ git-ls-tree -r HEAD include/|grep 9feff4ce1424bc390608326240be369eb13aa648

    may be more interesting than looking at the patch itself, to make sure I've
    just copied the arm header to all other archs having the original dummy version
    of this file.

    Cc: Jakub Jelinek
    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     

13 Sep, 2005

1 commit


08 Sep, 2005

8 commits

  • This patch gathers all the struct flock64 definitions (and the operations),
    puts them under !CONFIG_64BIT and cleans up the arch files.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • This patch just gathers together all the struct flock definitions except
    xtensa into asm-generic/fcntl.h.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • This patch puts the most popular of each fcntl operation/flag into
    asm-generic/fcntl.h and cleans up the arch files.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • This patch puts the most popular of each open flag into asm-generic/fcntl.h
    and cleans up the arch files.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • This set of patches creates asm-generic/fcntl.h and consolidates as much as
    possible from the asm-*/fcntl.h files into it.

    This patch just gathers all the identical bits of the asm-*/fcntl.h files into
    asm-generic/fcntl.h.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Yoichi Yuasa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • Remove the deprecated (and unused) verify_area() from various uaccess.h
    headers.

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

    Jesper Juhl
     
  • The size of auxiliary vector is fixed at 42 in linux/sched.h. But it isn't
    very obvious when looking at linux/elf.h. This patch adds AT_VECTOR_SIZE
    so that we can change it if necessary when a new vector is added.

    Because of include file ordering problems, doing this necessitated the
    extraction of the AT_* symbols into a standalone header file.

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

    H. J. Lu
     
  • ATM pthread_cond_signal is unnecessarily slow, because it wakes one waiter
    (which at least on UP usually means an immediate context switch to one of
    the waiter threads). This waiter wakes up and after a few instructions it
    attempts to acquire the cv internal lock, but that lock is still held by
    the thread calling pthread_cond_signal. So it goes to sleep and eventually
    the signalling thread is scheduled in, unlocks the internal lock and wakes
    the waiter again.

    Now, before 2003-09-21 NPTL was using FUTEX_REQUEUE in pthread_cond_signal
    to avoid this performance issue, but it was removed when locks were
    redesigned to the 3 state scheme (unlocked, locked uncontended, locked
    contended).

    Following scenario shows why simply using FUTEX_REQUEUE in
    pthread_cond_signal together with using lll_mutex_unlock_force in place of
    lll_mutex_unlock is not enough and probably why it has been disabled at
    that time:

    The number is value in cv->__data.__lock.
    thr1 thr2 thr3
    0 pthread_cond_wait
    1 lll_mutex_lock (cv->__data.__lock)
    0 lll_mutex_unlock (cv->__data.__lock)
    0 lll_futex_wait (&cv->__data.__futex, futexval)
    0 pthread_cond_signal
    1 lll_mutex_lock (cv->__data.__lock)
    1 pthread_cond_signal
    2 lll_mutex_lock (cv->__data.__lock)
    2 lll_futex_wait (&cv->__data.__lock, 2)
    2 lll_futex_requeue (&cv->__data.__futex, 0, 1, &cv->__data.__lock)
    # FUTEX_REQUEUE, not FUTEX_CMP_REQUEUE
    2 lll_mutex_unlock_force (cv->__data.__lock)
    0 cv->__data.__lock = 0
    0 lll_futex_wake (&cv->__data.__lock, 1)
    1 lll_mutex_lock (cv->__data.__lock)
    0 lll_mutex_unlock (cv->__data.__lock)
    # Here, lll_mutex_unlock doesn't know there are threads waiting
    # on the internal cv's lock

    Now, I believe it is possible to use FUTEX_REQUEUE in pthread_cond_signal,
    but it will cost us not one, but 2 extra syscalls and, what's worse, one of
    these extra syscalls will be done for every single waiting loop in
    pthread_cond_*wait.

    We would need to use lll_mutex_unlock_force in pthread_cond_signal after
    requeue and lll_mutex_cond_lock in pthread_cond_*wait after lll_futex_wait.

    Another alternative is to do the unlocking pthread_cond_signal needs to do
    (the lock can't be unlocked before lll_futex_wake, as that is racy) in the
    kernel.

    I have implemented both variants, futex-requeue-glibc.patch is the first
    one and futex-wake_op{,-glibc}.patch is the unlocking inside of the kernel.
    The kernel interface allows userland to specify how exactly an unlocking
    operation should look like (some atomic arithmetic operation with optional
    constant argument and comparison of the previous futex value with another
    constant).

    It has been implemented just for ppc*, x86_64 and i?86, for other
    architectures I'm including just a stub header which can be used as a
    starting point by maintainers to write support for their arches and ATM
    will just return -ENOSYS for FUTEX_WAKE_OP. The requeue patch has been
    (lightly) tested just on x86_64, the wake_op patch on ppc64 kernel running
    32-bit and 64-bit NPTL and x86_64 kernel running 32-bit and 64-bit NPTL.

    With the following benchmark on UP x86-64 I get:

    for i in nptl-orig nptl-requeue nptl-wake_op; do echo time elf/ld.so --library-path .:$i /tmp/bench; \
    for j in 1 2; do echo ( time elf/ld.so --library-path .:$i /tmp/bench ) 2>&1; done; done
    time elf/ld.so --library-path .:nptl-orig /tmp/bench
    real 0m0.655s user 0m0.253s sys 0m0.403s
    real 0m0.657s user 0m0.269s sys 0m0.388s
    time elf/ld.so --library-path .:nptl-requeue /tmp/bench
    real 0m0.496s user 0m0.225s sys 0m0.271s
    real 0m0.531s user 0m0.242s sys 0m0.288s
    time elf/ld.so --library-path .:nptl-wake_op /tmp/bench
    real 0m0.380s user 0m0.176s sys 0m0.204s
    real 0m0.382s user 0m0.175s sys 0m0.207s

    The benchmark is at:
    http://sourceware.org/ml/libc-alpha/2005-03/txt00001.txt
    Older futex-requeue-glibc.patch version is at:
    http://sourceware.org/ml/libc-alpha/2005-03/txt00002.txt
    Older futex-wake_op-glibc.patch version is at:
    http://sourceware.org/ml/libc-alpha/2005-03/txt00003.txt
    Will post a new version (just x86-64 fixes so that the patch
    applies against pthread_cond_signal.S) to libc-hacker ml soon.

    Attached is the kernel FUTEX_WAKE_OP patch as well as a simple-minded
    testcase that will not test the atomicity of the operation, but at least
    check if the threads that should have been woken up are woken up and
    whether the arithmetic operation in the kernel gave the expected results.

    Acked-by: Ingo Molnar
    Cc: Ulrich Drepper
    Cc: Jamie Lokier
    Cc: Rusty Russell
    Signed-off-by: Yoichi Yuasa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jakub Jelinek
     

05 Sep, 2005

2 commits

  • This is used only in slab.c and each architecture gets to define whcih
    underlying type is to be used.

    Seems a bit silly - move it to slab.c and use the same type for all
    architectures: unsigned int.

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

    Kyle Moffett
     
  • Someone mentioned that almost all the architectures used basically the same
    implementation of get_order. This patch consolidates them into
    asm-generic/page.h and includes that in the appropriate places. The
    exceptions are ia64 and ppc which have their own (presumably optimised)
    versions.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     

30 Aug, 2005

1 commit


27 Jul, 2005

1 commit

  • When the kernel is working well and we want to restart cleanly
    kernel_restart is the function to use. But in many instances
    the kernel wants to reboot when thing are expected to be working
    very badly such as from panic or a software watchdog handler.

    This patch adds the function emergency_restart() so that
    callers can be clear what semantics they expect when calling
    restart. emergency_restart() is expected to be callable
    from interrupt context and possibly reliable in even more
    trying circumstances.

    This is an initial generic implementation for all architectures.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

28 Jun, 2005

2 commits

  • With CONFIG_PCI=n:

    In file included from include/linux/pci.h:917,
    from lib/iomap.c:6:
    include/asm/pci.h:104: warning: `enum pci_dma_burst_strategy' declared inside parameter list
    include/asm/pci.h:104: warning: its scope is only this definition or declaration, which is probably not what you want.
    include/asm/pci.h: In function `pci_dma_burst_advice':
    include/asm/pci.h:106: dereferencing pointer to incomplete type
    include/asm/pci.h:106: `PCI_DMA_BURST_INFINITY' undeclared (first use in this function)
    include/asm/pci.h:106: (Each undeclared identifier is reported only once
    include/asm/pci.h:106: for each function it appears in.)
    make[1]: *** [lib/iomap.o] Error 1

    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Andrew Morton
     
  • After seeing, at best, "guesses" as to the following kind
    of information in several drivers, I decided that we really
    need a way for platforms to specifically give advice in this
    area for what works best with their PCI controller implementation.

    Basically, this new interface gives DMA bursting advice on
    PCI. There are three forms of the advice:

    1) Burst as much as possible, it is not necessary to end bursts
    on some particular boundary for best performance.

    2) Burst on some byte count multiple. A DMA burst to some multiple of
    number of bytes may be done, but it is important to end the burst
    on an exact multiple for best performance.

    The best example of this I am aware of are the PPC64 PCI
    controllers, where if you end a burst mid-cacheline then
    chip has to refetch the data and the IOMMU translations
    which hurts performance a lot.

    3) Burst on a single byte count multiple. Bursts shall end
    exactly on the next multiple boundary for best performance.

    Sparc64 and Alpha's PCI controllers operate this way. They
    disconnect any device which tries to burst across a cacheline
    boundary.

    Actually, newer sparc64 PCI controllers do not have this behavior.
    That is why the "pdev" is passed into the interface, so I can
    add code later to check which PCI controller the system is using
    and give advice accordingly.

    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller