1. 19 4月, 2012 7 次提交
  2. 06 4月, 2012 1 次提交
    • S
      simple_open: automatically convert to simple_open() · 234e3405
      Stephen Boyd 提交于
      Many users of debugfs copy the implementation of default_open() when
      they want to support a custom read/write function op.  This leads to a
      proliferation of the default_open() implementation across the entire
      tree.
      
      Now that the common implementation has been consolidated into libfs we
      can replace all the users of this function with simple_open().
      
      This replacement was done with the following semantic patch:
      
      <smpl>
      @ open @
      identifier open_f != simple_open;
      identifier i, f;
      @@
      -int open_f(struct inode *i, struct file *f)
      -{
      (
      -if (i->i_private)
      -f->private_data = i->i_private;
      |
      -f->private_data = i->i_private;
      )
      -return 0;
      -}
      
      @ has_open depends on open @
      identifier fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...
      -.open = open_f,
      +.open = simple_open,
      ...
      };
      </smpl>
      
      [akpm@linux-foundation.org: checkpatch fixes]
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      234e3405
  3. 30 3月, 2012 4 次提交
    • J
      x86,kgdb: Fix DEBUG_RODATA limitation using text_poke() · 3751d3e8
      Jason Wessel 提交于
      There has long been a limitation using software breakpoints with a
      kernel compiled with CONFIG_DEBUG_RODATA going back to 2.6.26. For
      this particular patch, it will apply cleanly and has been tested all
      the way back to 2.6.36.
      
      The kprobes code uses the text_poke() function which accommodates
      writing a breakpoint into a read-only page.  The x86 kgdb code can
      solve the problem similarly by overriding the default breakpoint
      set/remove routines and using text_poke() directly.
      
      The x86 kgdb code will first attempt to use the traditional
      probe_kernel_write(), and next try using a the text_poke() function.
      The break point install method is tracked such that the correct break
      point removal routine will get called later on.
      
      Cc: x86@kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: stable@vger.kernel.org # >= 2.6.36
      Inspried-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      3751d3e8
    • J
      kgdbts: (2 of 2) fix single step awareness to work correctly with SMP · 23bbd8e3
      Jason Wessel 提交于
      The do_fork and sys_open tests have never worked properly on anything
      other than a UP configuration with the kgdb test suite.  This is
      because the test suite did not fully implement the behavior of a real
      debugger.  A real debugger tracks the state of what thread it asked to
      single step and can correctly continue other threads of execution or
      conditionally stop while waiting for the original thread single step
      request to return.
      
      Below is a simple method to cause a fatal kernel oops with the kgdb
      test suite on a 2 processor ARM system:
      
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      echo V1I1F100 > /sys/module/kgdbts/parameters/kgdbts
      
      Very soon after starting the test the kernel will start warning with
      messages like:
      
      kgdbts: BP mismatch c002487c expected c0024878
      ------------[ cut here ]------------
      WARNING: at drivers/misc/kgdbts.c:317 check_and_rewind_pc+0x9c/0xc4()
      [<c01f6520>] (check_and_rewind_pc+0x9c/0xc4)
      [<c01f595c>] (validate_simple_test+0x3c/0xc4)
      [<c01f60d4>] (run_simple_test+0x1e8/0x274)
      
      The kernel will eventually recovers, but the test suite has completely
      failed to test anything useful.
      
      This patch implements behavior similar to a real debugger that does
      not rely on hardware single stepping by using only software planted
      breakpoints.
      
      In order to mimic a real debugger, the kgdb test suite now tracks the
      most recent thread that was continued (cont_thread_id), with the
      intent to single step just this thread.  When the response to the
      single step request stops in a different thread that hit the original
      break point that thread will now get continued, while the debugger
      waits for the thread with the single step pending.  Here is a high
      level description of the sequence of events.
      
         cont_instead_of_sstep = 0;
      
      1) set breakpoint at do_fork
      2) continue
      3)   Save the thread id where we stop to cont_thread_id
      4) Remove breakpoint at do_fork
      5) Reset the PC if needed depending on kernel exception type
      6) soft single step
      7)   Check where we stopped
             if current thread != cont_thread_id {
                 if (here for more than 2 times for the same thead) {
                    ### must be a really busy system, start test again ###
      	      goto step 1
                 }
                 goto step 5
             } else {
                 cont_instead_of_sstep = 0;
             }
      8) clean up and run test again if needed
      9) Clear out any threads that were waiting on a break point at the
         point in time the test is ended with get_cont_catch().  This
         happens sometimes because breakpoints are used in place of single
         stepping and some threads could have been in the debugger exception
         handling queue because breakpoints were hit concurrently on
         different CPUs.  This also means we wait at least one second before
         unplumbing the debugger connection at the very end, so as respond
         to any debug threads waiting to be serviced.
      
      Cc: stable@vger.kernel.org # >= 3.0
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      23bbd8e3
    • J
      kgdbts: (1 of 2) fix single step awareness to work correctly with SMP · 486c5987
      Jason Wessel 提交于
      The do_fork and sys_open tests have never worked properly on anything
      other than a UP configuration with the kgdb test suite.  This is
      because the test suite did not fully implement the behavior of a real
      debugger.  A real debugger tracks the state of what thread it asked to
      single step and can correctly continue other threads of execution or
      conditionally stop while waiting for the original thread single step
      request to return.
      
      Below is a simple method to cause a fatal kernel oops with the kgdb
      test suite on a 4 processor x86 system:
      
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
      echo V1I1F1000 > /sys/module/kgdbts/parameters/kgdbts
      
      Very soon after starting the test the kernel will oops with a message like:
      
      kgdbts: BP mismatch 3b7da66480 expected ffffffff8106a590
      WARNING: at drivers/misc/kgdbts.c:303 check_and_rewind_pc+0xe0/0x100()
      Call Trace:
       [<ffffffff812994a0>] check_and_rewind_pc+0xe0/0x100
       [<ffffffff81298945>] validate_simple_test+0x25/0xc0
       [<ffffffff81298f77>] run_simple_test+0x107/0x2c0
       [<ffffffff81298a18>] kgdbts_put_char+0x18/0x20
      
      The warn will turn to a hard kernel crash shortly after that because
      the pc will not get properly rewound to the right value after hitting
      a breakpoint leading to a hard lockup.
      
      This change is broken up into 2 pieces because archs that have hw
      single stepping (2.6.26 and up) need different changes than archs that
      do not have hw single stepping (3.0 and up).  This change implements
      the correct behavior for an arch that supports hw single stepping.
      
      A minor defect was fixed where sys_open should be do_sys_open
      for the sys_open break point test.  This solves the problem of running
      a 64 bit with a 32 bit user space.  The sys_open() never gets called
      when using the 32 bit file system for the kgdb testsuite because the
      32 bit binaries invoke the compat_sys_open() call leading to the test
      never completing.
      
      In order to mimic a real debugger, the kgdb test suite now tracks the
      most recent thread that was continued (cont_thread_id), with the
      intent to single step just this thread.  When the response to the
      single step request stops in a different thread that hit the original
      break point that thread will now get continued, while the debugger
      waits for the thread with the single step pending.  Here is a high
      level description of the sequence of events.
      
         cont_instead_of_sstep = 0;
      
      1) set breakpoint at do_fork
      2) continue
      3)   Save the thread id where we stop to cont_thread_id
      4) Remove breakpoint at do_fork
      5) Reset the PC if needed depending on kernel exception type
      6) if (cont_instead_of_sstep) { continue } else { single step }
      7)   Check where we stopped
             if current thread != cont_thread_id {
                 cont_instead_of_sstep = 1;
                 goto step 5
             } else {
                 cont_instead_of_sstep = 0;
             }
      8) clean up and run test again if needed
      
      Cc: stable@vger.kernel.org # >= 2.6.26
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      486c5987
    • J
      kgdbts: Fix kernel oops with CONFIG_DEBUG_RODATA · 456ca7ff
      Jason Wessel 提交于
      On x86 the kgdb test suite will oops when the kernel is compiled with
      CONFIG_DEBUG_RODATA and you run the tests after boot time. This is
      regression has existed since 2.6.26 by commit: b33cb815 (kgdbts: Use
      HW breakpoints with CONFIG_DEBUG_RODATA).
      
      The test suite can use hw breakpoints for all the tests, but it has to
      execute the hardware breakpoint specific tests first in order to
      determine that the hw breakpoints actually work.  Specifically the
      very first test causes an oops:
      
      # echo V1I1 > /sys/module/kgdbts/parameters/kgdbts
      kgdb: Registered I/O driver kgdbts.
      kgdbts:RUN plant and detach test
      
      Entering kdb (current=0xffff880017aa9320, pid 1078) on processor 0 due to Keyboard Entry
      [0]kdb> kgdbts: ERROR PUT: end of test buffer on 'plant_and_detach_test' line 1 expected OK got $E14#aa
      WARNING: at drivers/misc/kgdbts.c:730 run_simple_test+0x151/0x2c0()
      [...oops clipped...]
      
      This commit re-orders the running of the tests and puts the RODATA
      check into its own function so as to correctly avoid the kernel oops
      by detecting and using the hw breakpoints.
      
      Cc: <stable@vger.kernel.org> # >= 2.6.26
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      456ca7ff
  4. 29 3月, 2012 2 次提交
    • D
      Remove all #inclusions of asm/system.h · 9ffc93f2
      David Howells 提交于
      Remove all #inclusions of asm/system.h preparatory to splitting and killing
      it.  Performed with the following command:
      
      perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      9ffc93f2
    • D
      Add #includes needed to permit the removal of asm/system.h · 96f951ed
      David Howells 提交于
      asm/system.h is a cause of circular dependency problems because it contains
      commonly used primitive stuff like barrier definitions and uncommonly used
      stuff like switch_to() that might require MMU definitions.
      
      asm/system.h has been disintegrated by this point on all arches into the
      following common segments:
      
       (1) asm/barrier.h
      
           Moved memory barrier definitions here.
      
       (2) asm/cmpxchg.h
      
           Moved xchg() and cmpxchg() here.  #included in asm/atomic.h.
      
       (3) asm/bug.h
      
           Moved die() and similar here.
      
       (4) asm/exec.h
      
           Moved arch_align_stack() here.
      
       (5) asm/elf.h
      
           Moved AT_VECTOR_SIZE_ARCH here.
      
       (6) asm/switch_to.h
      
           Moved switch_to() here.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      96f951ed
  5. 21 3月, 2012 3 次提交
  6. 09 3月, 2012 2 次提交
  7. 06 3月, 2012 1 次提交
  8. 03 3月, 2012 1 次提交
  9. 01 3月, 2012 3 次提交
  10. 27 2月, 2012 2 次提交
    • I
      carma-fpga: fix race between data dumping and DMA callback · 6c15d7af
      Ira Snyder 提交于
      When the system is under heavy load, we occasionally saw a problem where
      the system would get a legitimate interrupt when they should be
      disabled.
      
      This was caused by the data_dma_cb() DMA callback unconditionally
      re-enabling FPGA interrupts even when data dumping is disabled. When
      data dumping was re-enabled, the irq handler would fire while a DMA was
      in progress. The "BUG_ON(priv->inflight != NULL);" during the second
      invocation of the DMA callback caused the system to crash.
      
      To fix the issue, the priv->enabled boolean is moved under the
      protection of the priv->lock spinlock. The DMA callback checks the
      boolean to know whether to re-enable FPGA interrupts before it returns.
      
      Now that it is fixed, the driver keeps FPGA interrupts disabled when it
      expects that they are disabled, fixing the bug.
      Signed-off-by: NIra W. Snyder <iws@ovro.caltech.edu>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      6c15d7af
    • I
      carma-fpga: fix lockdep warning · 75ff85a8
      Ira Snyder 提交于
      Lockdep occasionally complains with the message:
      INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
      
      This is caused by calling videobuf_dma_unmap() under spin_lock_irq(). To
      fix the warning, we drop the lock before unmapping and freeing the
      buffer.
      Signed-off-by: NIra W. Snyder <iws@ovro.caltech.edu>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      75ff85a8
  11. 25 2月, 2012 2 次提交
  12. 10 2月, 2012 1 次提交
  13. 04 2月, 2012 1 次提交
  14. 03 2月, 2012 4 次提交
  15. 25 1月, 2012 5 次提交
  16. 13 1月, 2012 1 次提交