10 Jan, 2012

1 commit

  • do_notify_resume() can trigger the freezer via the try_to_freeze() path
    (both explicitly through a redundant call in do_signal() or via
    get_signal_to_deliver()). That IRQs were disabled across this callsite
    became apparent with the might_sleep() introduction in try_to_freeze() by
    Tejun in a0acae0e886d44bd5ce6d2f173c1ace0fcf0d9f6, resulting in:

    BUG: sleeping function called from invalid context at include/linux/freezer.h:45
    in_atomic(): 0, irqs_disabled(): 1, pid: 819, name: ntpd
    no locks held by ntpd/819.
    Stack: (0x9c81be80 to 0x9c81c000)
    ...

    Signed-off-by: Paul Mundt

    Paul Mundt
     

08 Feb, 2010

1 commit

  • The address that ret_from_exception and ret_from_irq will return to is
    found in the stack slot for SPC, not PR. This error was causing the
    DWARF unwinder to pick up the wrong return address on the stack and then
    unwind using the unwind tables for the wrong function.

    While I'm here I might as well add CFI annotations for the other
    registers since they could be useful when unwinding.

    Signed-off-by: Matt Fleming
    Signed-off-by: Paul Mundt

    Matt Fleming
     

14 Oct, 2009

2 commits

  • Replace TIF_RESTORE_SIGMASK with TS_RESTORE_SIGMASK and define our own
    set_restore_sigmask() function. This saves the costly SMP-safe set_bit
    operation, which we do not need for the sigmask flag since TIF_SIGPENDING
    always has to be set too.

    Based on the x86 and powerpc change.

    Signed-off-by: Paul Mundt

    Paul Mundt
     
  • The resume_userspace path had TRACE_IRQS_OFF written incorrectly and so
    never handled the transition properly. This was fixed once before but
    seems to have made it back in the tree. Fix it for good.

    Signed-off-by: Paul Mundt

    Paul Mundt
     

24 Aug, 2009

1 commit

  • The SH instruction set has several instructions which accept an 8 bit
    immediate operand. For logical instructions this operand is zero extended,
    for arithmetic instructions the operand is sign extended. After adding an
    option to the assembler to check this, it was found that several pieces
    of assembly code were assuming this behaviour, and in one case
    getting it wrong.

    So this patch explicitly sign extends any immediate operands, which makes
    it obvious what is happening, and fixes the one case which got it wrong.

    Signed-off-by: Stuart Menefy
    Signed-off-by: Paul Mundt

    Stuart Menefy
     

18 Aug, 2009

1 commit

  • save_regs contains an SR modification without an irqflags annotation,
    which resulted in a missing TRACE_IRQS_OFF in the interrupt exception
    path on SH-3/SH4.

    I've also moved the TRACE_IRQS_OFF/ON annotation when returning from the
    interrupt to just before we call __restore_all. This seems like the most
    logical place to put this because the annotation is for when we restore
    the SR register so we should delay the annotation until as last as
    possible.

    We were also missing a TRACE_IRQS_OFF in resume_kernel when
    CONFIG_PREEMPT is enabled.

    The end result is that this fixes up the lockdep engine debugging support
    with CONFIG_PREEMPT enabled on all SH-3/4 parts.

    Signed-off-by: Matt Fleming
    Signed-off-by: Paul Mundt

    Matt Fleming
     

14 Aug, 2009

2 commits


29 Jul, 2009

1 commit

  • This cleans up the irqflags tracing code quite a bit and ties it
    in to various missing callsites that caused an imbalance when
    CONFIG_PROVE_LOCKING was enabled.

    Previously this was catching on:

    987 #ifdef CONFIG_PROVE_LOCKING
    988 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
    989 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
    990 #endif
    991 retval = -EAGAIN;

    with hardirqs being doubly enabled, and subsequently bailing out
    with the following call trace:

    Call trace:
    [] __lock_acquire+0x616/0x6a6
    [] do_fork+0xf8/0x2b0
    [] trace_hardirqs_on_caller+0xd4/0x114
    [] _spin_unlock_irq+0x20/0x64
    [] __lock_acquire+0x616/0x6a6
    [] kernel_thread+0x48/0x70
    [] ____call_usermodehelper+0x0/0x110
    [] ____call_usermodehelper+0x0/0x110
    [] kernel_thread_helper+0x0/0x14
    [] __call_usermodehelper+0x38/0x70
    [] worker_thread+0x150/0x274
    [] lock_release+0x0/0x198
    [] __call_usermodehelper+0x0/0x70
    [] autoremove_wake_function+0x0/0x30
    [] kthread+0x3e/0x70
    [] worker_thread+0x0/0x274
    [] kernel_thread_helper+0x8/0x14
    [] kthread+0x0/0x70
    [] kernel_thread_helper+0x0/0x14

    Reported-by: Nobuhiro Iwamatsu
    Signed-off-by: Stuart Menefy
    Signed-off-by: Matt Fleming
    Signed-off-by: Paul Mundt

    Stuart Menefy
     

06 Jul, 2009

1 commit


22 Dec, 2008

2 commits


31 Oct, 2008

1 commit


21 Sep, 2008

1 commit


05 Sep, 2008

1 commit

  • This patch fixes a problem within the SH implementation of resume_kernel code,
    that implements in assembly the bulk of preempt_schedule_irq function without
    taking care of the extra code needed to handle the BKL preemptible.

    The patch basically consists of removing this asm code and calling the common
    C implementation (see kernel/sched.c) as other archs do.

    Another change is the missing 'cli' macro invocation at the beginning of
    the resume_kernel.

    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: Carmelo Amoroso
    Signed-off-by: Paul Mundt

    Carmelo Amoroso
     

02 Aug, 2008

2 commits


28 Jul, 2008

1 commit


19 May, 2008

1 commit

  • There are a few different types of debug trap exceptions, though now
    that they are all going through a special jump table, the restorer needs
    to be unified as well.

    Presently this is falling through the ret_from_fork path, which more or
    less does the right thing on SH-3/4 whilst being completely unsuitable on
    MMU-less targets.

    Ultimately what we want here is a branch through the platform's
    restore_all directly, without worrying about the retval being clobbered.
    We can accomplish that through a branch to __restore_all directly, so
    switch it so we come back from the jump table and branch to the restorer.

    This fixes up a recursion in the nommu WARN_ON() path, as well as some
    other userspace nastiness where said recursion caused serious stack
    corruption.

    Signed-off-by: Paul Mundt

    Paul Mundt
     

16 May, 2008

1 commit


28 Jan, 2008

2 commits


28 Sep, 2007

1 commit

  • This conditionalizes gUSA support. gUSA is not supported on
    SMP configurations, and it's not necessary there anyways due
    to having other atomicity options (ie, movli.l/movco.l).

    Anything implementing the LL/SC semantics (all SH-4A CPUs)
    can switch to userspace atomicity implementations without
    requiring gUSA. This is left default-enabled on all UP so
    that glibc doesn't break.

    Those that know what they are doing can disable this explicitly.

    Signed-off-by: Paul Mundt

    Paul Mundt
     

05 Mar, 2007

1 commit

  • This takes care of tearing down the UBC so it's not inadvertently
    left configured at the next context switch time. Failure to do
    this results in spurious SIGTRAPs in certain debug sequences.

    Signed-off-by: Stuart Menefy
    Signed-off-by: Paul Mundt

    Stuart Menefy
     

13 Feb, 2007

1 commit

  • This rips out most of the needlessly complicated sh_bios and kgdb
    trap handling, and forces it all through a common fast dispatch path.
    As more debug traps are inserted, it's important to keep them in sync
    for all of the parts, not just SH-3/4.

    As the SH-2 parts are unable to do traps in the >= 0x40 range, we
    restrict the debug traps to the 0x30-0x3f range on all parts, and
    also bump the kgdb breakpoint trap down in to this range (from 0xff
    to 0x3c) so it's possible to use for nommu.

    Optionally, this table can be padded out to catch spurious traps for
    SH-3/4, but we don't do that yet..

    Signed-off-by: Paul Mundt

    Paul Mundt
     

12 Dec, 2006

1 commit

  • This was inadvertently broken when the entry.S code split up,
    restore the missing branch and get subsequent traps working
    under debug again. This manifested itself as a lockup when
    attempting to reload the VBR base.

    Signed-off-by: Paul Mundt

    Paul Mundt
     

06 Dec, 2006

3 commits

  • Wire up all of the essentials for lockdep..

    Signed-off-by: Paul Mundt

    Paul Mundt
     
  • The implementation of system call tracing in the kernel has a
    couple of ordering problems:

    - the validity of the system call number is checked before
    calling out to system call tracing code, and should be
    done after

    - the system call number used when tracing is the one the
    system call was invoked with, while the system call tracing
    code can legitimatly change the call number (for example
    strace permutes fork into clone)

    This patch fixes both of these problems, and also reoders the
    code slightly to make the direct path through the code the
    common case.

    Signed-off-by: Stuart Menefy
    Signed-off-by: Paul Mundt

    Stuart Menefy
     
  • This splits out common bits from the existing exception handler for
    use between SH-2/SH-2A and SH-3/4, and adds support for the SH-2/2A
    exceptions.

    Signed-off-by: Yoshinori Sato
    Signed-off-by: Paul Mundt

    Yoshinori Sato