14 Apr, 2010

1 commit

  • 128 bytes is sufficient for the register window save area, but the
    calling conventions allow the callee to save up to 6 incoming argument
    registers into the stack frame after the register window save area.

    This means a minimal stack frame is 176 bytes (128 + (6 * 8)).

    This fixes random crashes when using the function tracer.

    Reported-by: Frederic Weisbecker
    Signed-off-by: David S. Miller

    David S. Miller
     

13 Apr, 2010

4 commits


11 Dec, 2009

2 commits


09 Dec, 2009

1 commit

  • Commit 4f70f7a91bffdcc39f088748dc678953eb9a3fbd
    (sparc64: Implement IRQ stacks.) has two bugs.

    First, the softirq range check forgets to subtract STACK_BIAS
    before comparing with %sp. Next, on failure the wrong label
    is jumped to, resulting in a bogus stack being loaded.

    Reported-by: Igor Kovalenko
    Signed-off-by: David S. Miller

    David S. Miller
     

30 May, 2009

1 commit


09 Feb, 2009

2 commits

  • This is based upon a report from Chris Torek and his initial patch.
    From Chris's report:

    --------------------
    This came up in testing kgdb, using the built-in tests -- turn
    on CONFIG_KGDB_TESTS, then

    echo V1 > /sys/module/kgdbts/parameters/kgdbts

    -- but it would affect using kgdb if you were debugging and looking
    at bad pointers.
    --------------------

    When we get a copy_{from,to}_user() request and the %asi is set to
    something other than ASI_AIUS (which is userspace) then we branch off
    to a routine called memcpy_user_stub(). It just does a straight
    memcpy since we are copying from kernel to kernel in this case.

    The logic was that since source and destination are both kernel
    pointers we don't need to have exception checks.

    But for what probe_kernel_{read,write}() is trying to do, we have to
    have the checks, otherwise things like kgdb bad kernel pointer
    accesses don't do the right thing.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • This is an implementation of a suggestion made by Chris Torek:
    --------------------
    Something else I noticed in passing: the EX and EX_LD/EX_ST macros
    scattered throughout the various .S files make a fair bit of .fixup
    code, all of which does the same thing. At the cost of one symbol
    in copy_in_user.S, you could just have one common two-instruction
    retl-and-mov-1 fixup that they all share.
    --------------------

    The following is with a defconfig build:

    text data bss dec hex filename
    3972767 344024 584449 4901240 4ac978 vmlinux.orig
    3968887 344024 584449 4897360 4aba50 vmlinux

    Signed-off-by: David S. Miller

    David S. Miller
     

18 Jan, 2009

1 commit

  • Previously PeeCeeI.o was a library but it
    was always pulled in due to insw and friends being exported
    (at least for a modular kernel).

    But this resulted in modpost failures if there where no in-kernel
    users because then insw & friends were not linked in.

    Fix this by including PeeCeeI.o in the kernel unconditionally.

    The only drawback for this solution is that a nonmodular kernel
    will always include insw & friends no matter if they are in use or not.

    Reported-by: Meelis Roos
    Signed-off-by: Sam Ravnborg
    Signed-off-by: David S. Miller

    Sam Ravnborg
     

09 Jan, 2009

2 commits

  • Move all applicable EXPORT_SYMBOL()s to the file where the respective
    symbol is defined.

    Removed all the includes that are no longer needed in sparc_ksyms_64.c

    Comment all remaining EXPORT_SYMBOL()s in sparc_ksyms_64.c

    Signed-off-by: Sam Ravnborg

    Additions by Julian Calaby:
    * Moved EXPORT_SYMBOL()s for prom functions to their rightful places.
    * Made some minor cleanups to the includes and comments of sparc_ksyms_64.c
    * Updated and tidied commit message.
    * Rebased patch over sparc-2.6.git HEAD.
    * Ensured that all modified files have the correct includes.

    Signed-off-by: Julian Calaby
    Signed-off-by: David S. Miller

    Sam Ravnborg
     
  • …sembler in lib/ to this file.

    Remove the duplicate entries from kernel/sparc_ksyms_*.c

    The rationale behind this is that the EXPORT_SYMBOL() should be close to
    their definition and we cannot add designate a symbol to be exported in
    assembler so at least put it in a file in the same directory.

    Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

    Additions by Julian Calaby:
    * Rebased over sparc-2.6.git HEAD

    Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

    Sam Ravnborg
     

09 Dec, 2008

3 commits


05 Dec, 2008

2 commits

  • o Renamed files in sparc64 to _64.S when identical
    to sparc32 files.
    o iomap.c were equal for sparc32 and sparc64
    o adjusted sparc/Makefile now we have only one lib/

    Signed-off-by: Sam Ravnborg
    Signed-off-by: David S. Miller

    Sam Ravnborg
     
  • Identical named files renamed to _32.S
    Refactored Makefile to prepare for unification.

    Linking order was altered slightly - but this is a lib.a file so
    it should not matter.

    Signed-off-by: Sam Ravnborg
    Signed-off-by: David S. Miller

    Sam Ravnborg
     

20 May, 2008

1 commit


29 Apr, 2008

1 commit

  • Almost all implementations of pci_iomap() in the kernel, including the generic
    lib/iomap.c one, copies the content of a struct resource into unsigned long's
    which will break on 32 bits platforms with 64 bits resources.

    This fixes all definitions of pci_iomap() to use resource_size_t. I also
    "fixed" the 64bits arch for consistency.

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

    Benjamin Herrenschmidt
     

01 Feb, 2008

1 commit


27 Aug, 2007

1 commit


25 Jul, 2007

1 commit

  • Sparc optimized memset (arch/sparc/lib/memset.S) does not fill last
    byte of the memory area, if area size is less than 8 bytes and start
    address is not word (4-bytes) aligned.

    Here is code chunk where bug located:
    /* %o0 - memory address, %o1 - size, %g3 - value */
    8:
    add %o0, 1, %o0
    subcc %o1, 1, %o1
    bne,a 8b
    stb %g3, [%o0 - 1]

    This code should write byte every loop iteration, but last time delay
    instruction stb is not executed because branch instruction sets
    "annul" bit.

    Patch replaces bne,a by bne instruction.

    Error can be reproduced by simple kernel module:

    --------------------
    #include
    #include
    #include
    #include
    #include

    static void do_memset(void **p, int size)
    {
    memset(p, 0x00, size);
    }

    static int __init memset_test_init(void)
    {
    char fooc[8];
    int *fooi;
    memset(fooc, 0xba, sizeof(fooc));

    do_memset((void**)(fooc + 3), 1);

    fooi = (int*) fooc;
    printk("%08X %08X\n", fooi[0], fooi[1]);

    return -1;
    }

    static void __exit memset_test_cleanup(void)
    {
    return;
    }

    module_init(memset_test_init);
    module_exit(memset_test_cleanup);

    MODULE_LICENSE("GPL");
    EXPORT_NO_SYMBOLS;
    --------------------

    Signed-off-by: Alexander Shmelev
    Signed-off-by: David S. Miller

    Alexander Shmelev
     

31 May, 2007

1 commit

  • Fix 6197fe4d720ea3e2ee94cdc7ef32d6c0151199de

    arch/sparc/lib/atomic32.c: In function '__cmpxchg_u32':
    arch/sparc/lib/atomic32.c:127: error: 'addr' undeclared (first use in this function)
    arch/sparc/lib/atomic32.c:127: error: (Each undeclared identifier is reported only once
    arch/sparc/lib/atomic32.c:127: error: for each function it appears in.)

    I assume this is what was intended..

    Signed-off-by: Andrew Morton
    Acked-by: William Irwin
    Signed-off-by: David S. Miller

    Andrew Morton
     

29 May, 2007

1 commit


09 May, 2007

1 commit


27 Mar, 2007

1 commit

  • commit b19cbe2a1695c09c74f83646c4b82b51123b3690 [BRIDGE]: Fix fdb RCU
    race

    breaks sparc SMP build because atomic_add_unless is not exported.

    This patch exports atomic_add_unless and atomic_cmpxchg.

    Signed-off-by: Robert Reif
    Signed-off-by: David S. Miller

    Robert Reif
     

18 Dec, 2006

1 commit


09 Oct, 2006

1 commit

  • read_trylock() is broken on sparc32 (doesn't build and didn't work
    right, actually). Proposed fix:

    - make "writer holds lock" distinguishable from "reader tries to grab
    lock"

    - have __raw_read_trylock() try to acquire the mutex (in LSB of lock),
    terminating spin if we see that there's writer holding it. Then do
    the rest as we do in read_lock().

    Thanks to Ingo for discussion...

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

    Al Viro
     

30 Sep, 2006

1 commit


01 Jul, 2006

1 commit


26 Jun, 2006

1 commit


13 Dec, 2005

1 commit

  • This fixes one build error introduced in sparc with the patch of Oct 30,
    resent Nov 4 "[patch 3/5] atomic: atomic_inc_not_zero" I still can't get
    sparc to build, but at least it gets further after I remove this line.
    Apparently, this change was agreed to by Andrew and Nick on Nov 14, but
    everyone thought someone else was doing it.

    Signed-off-by: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Paul Jackson
     

14 Nov, 2005

3 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
     
  • a) in smp_lock.h #include of sched.h and spinlock.h moved under #ifdef
    CONFIG_LOCK_KERNEL.

    b) interrupt.h now explicitly pulls sched.h (not via smp_lock.h from
    hardirq.h as it used to)

    c) in three more places we need changes to compensate for (a) - one place
    in arch/sparc needs string.h now, hardirq.h needs forward declaration of
    task_struct and preempt.h needs direct include of thread_info.h.

    d) thread_info-related helpers in sched.h and thread_info.h put under
    ifndef __HAVE_THREAD_FUNCTIONS. Obviously safe.

    Signed-off-by: Al Viro
    Signed-off-by: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Al Viro
     

12 Sep, 2005

1 commit


11 Sep, 2005

1 commit

  • This patch (written by me and also containing many suggestions of Arjan van
    de Ven) does a major cleanup of the spinlock code. It does the following
    things:

    - consolidates and enhances the spinlock/rwlock debugging code

    - simplifies the asm/spinlock.h files

    - encapsulates the raw spinlock type and moves generic spinlock
    features (such as ->break_lock) into the generic code.

    - cleans up the spinlock code hierarchy to get rid of the spaghetti.

    Most notably there's now only a single variant of the debugging code,
    located in lib/spinlock_debug.c. (previously we had one SMP debugging
    variant per architecture, plus a separate generic one for UP builds)

    Also, i've enhanced the rwlock debugging facility, it will now track
    write-owners. There is new spinlock-owner/CPU-tracking on SMP builds too.
    All locks have lockup detection now, which will work for both soft and hard
    spin/rwlock lockups.

    The arch-level include files now only contain the minimally necessary
    subset of the spinlock code - all the rest that can be generalized now
    lives in the generic headers:

    include/asm-i386/spinlock_types.h | 16
    include/asm-x86_64/spinlock_types.h | 16

    I have also split up the various spinlock variants into separate files,
    making it easier to see which does what. The new layout is:

    SMP | UP
    ----------------------------|-----------------------------------
    asm/spinlock_types_smp.h | linux/spinlock_types_up.h
    linux/spinlock_types.h | linux/spinlock_types.h
    asm/spinlock_smp.h | linux/spinlock_up.h
    linux/spinlock_api_smp.h | linux/spinlock_api_up.h
    linux/spinlock.h | linux/spinlock.h

    /*
    * here's the role of the various spinlock/rwlock related include files:
    *
    * on SMP builds:
    *
    * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
    * initializers
    *
    * linux/spinlock_types.h:
    * defines the generic type and initializers
    *
    * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel
    * implementations, mostly inline assembly code
    *
    * (also included on UP-debug builds:)
    *
    * linux/spinlock_api_smp.h:
    * contains the prototypes for the _spin_*() APIs.
    *
    * linux/spinlock.h: builds the final spin_*() APIs.
    *
    * on UP builds:
    *
    * linux/spinlock_type_up.h:
    * contains the generic, simplified UP spinlock type.
    * (which is an empty structure on non-debug builds)
    *
    * linux/spinlock_types.h:
    * defines the generic type and initializers
    *
    * linux/spinlock_up.h:
    * contains the __raw_spin_*()/etc. version of UP
    * builds. (which are NOPs on non-debug, non-preempt
    * builds)
    *
    * (included on UP-non-debug builds:)
    *
    * linux/spinlock_api_up.h:
    * builds the _spin_*() APIs.
    *
    * linux/spinlock.h: builds the final spin_*() APIs.
    */

    All SMP and UP architectures are converted by this patch.

    arm, i386, ia64, ppc, ppc64, s390/s390x, x64 was build-tested via
    crosscompilers. m32r, mips, sh, sparc, have not been tested yet, but should
    be mostly fine.

    From: Grant Grundler

    Booted and lightly tested on a500-44 (64-bit, SMP kernel, dual CPU).
    Builds 32-bit SMP kernel (not booted or tested). I did not try to build
    non-SMP kernels. That should be trivial to fix up later if necessary.

    I converted bit ops atomic_hash lock to raw_spinlock_t. Doing so avoids
    some ugly nesting of linux/*.h and asm/*.h files. Those particular locks
    are well tested and contained entirely inside arch specific code. I do NOT
    expect any new issues to arise with them.

    If someone does ever need to use debug/metrics with them, then they will
    need to unravel this hairball between spinlocks, atomic ops, and bit ops
    that exist only because parisc has exactly one atomic instruction: LDCW
    (load and clear word).

    From: "Luck, Tony"

    ia64 fix

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Grant Grundler
    Cc: Matthew Wilcox
    Signed-off-by: Hirokazu Takata
    Signed-off-by: Mikael Pettersson
    Signed-off-by: Benoit Boissinot
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

10 Sep, 2005

1 commit