1. 16 9月, 2009 2 次提交
  2. 15 9月, 2009 1 次提交
  3. 14 9月, 2009 1 次提交
  4. 11 9月, 2009 2 次提交
  5. 10 9月, 2009 1 次提交
  6. 06 9月, 2009 2 次提交
    • L
      pty: don't limit the writes to 'pty_space()' inside 'pty_write()' · ac89a917
      Linus Torvalds 提交于
      The whole write-room thing is something that is up to the _caller_ to
      worry about, not the pty layer itself.  The total buffer space will
      still be limited by the buffering routines themselves, so there is no
      advantage or need in having pty_write() artificially limit the size
      somehow.
      
      And what happened was that the caller (the n_tty line discipline, in
      this case) may have verified that there is room for 2 bytes to be
      written (for NL -> CRNL expansion), and it used to then do those writes
      as two single-byte writes.  And if the first byte written (CR) then
      caused a new tty buffer to be allocated, pty_space() may have returned
      zero when trying to write the second byte (LF), and then incorrectly
      failed the write - leading to a lost newline character.
      
      This should finally fix
      
      	http://bugzilla.kernel.org/show_bug.cgi?id=14015Reported-by: NMikael Pettersson <mikpe@it.uu.se>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ac89a917
    • L
      n_tty: do O_ONLCR translation as a single write · 37f81fa1
      Linus Torvalds 提交于
      When translating CR to CRNL in the n_tty line discipline, we did it as
      two tty_put_char() calls.  Which works, but is stupid, and has caused
      problems before too with bad interactions with the write_room() logic.
      The generic USB serial driver had that problem, for example.
      
      Now the pty layer had similar issues after being moved to the generic
      tty buffering code (in commit d945cb9c:
      "pty: Rework the pty layer to use the normal buffering logic").
      
      So stop doing the silly separate two writes, and do it as a single write
      instead.  That's what the n_tty layer already does for the space
      expansion of tabs (XTABS), and it means that we'll now always have just
      a single write for the CRNL to match the single 'tty_write_room()' test,
      which hopefully means that the next time somebody screws up buffering,
      it won't cause weeks of debugging.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      37f81fa1
  7. 03 9月, 2009 1 次提交
  8. 01 9月, 2009 1 次提交
  9. 26 8月, 2009 1 次提交
    • L
      tty: make sure to flush any pending work when halting the ldisc · 5c58ceff
      Linus Torvalds 提交于
      When I rewrote tty ldisc code to use proper reference counts (commits
      65b77046 and cbe9352f) in order to avoid a race with hangup, the
      test-program that Eric Biederman used to trigger the original problem
      seems to have exposed another long-standing bug: the hangup code did the
      'tty_ldisc_halt()' to stop any buffer flushing activity, but unlike the
      other call sites it never actually flushed any pending work.
      
      As a result, if you get just the right timing, the pending work may be
      just about to execute (ie the timer has already triggered and thus
      cancel_delayed_work() was a no-op), when we then re-initialize the ldisc
      from under it.
      
      That, in turn, results in various random problems, usually seen as a
      NULL pointer dereference in run_timer_softirq() or a BUG() in
      worker_thread (but it can be almost anything).
      
      Fix it by adding the required 'flush_scheduled_work()' after doing the
      tty_ldisc_halt() (this also requires us to move the ldisc halt to before
      taking the ldisc mutex in order to avoid a deadlock with the workqueue
      executing do_tty_hangup, which requires the mutex).
      
      The locking should be cleaned up one day (the requirement to do this
      outside the ldisc_mutex is very annoying, and weakens the lock), but
      that's a larger and separate undertaking.
      Reported-by: NEric W. Biederman <ebiederm@xmission.com>
      Tested-by: NXiaotian Feng <xtfeng@gmail.com>
      Tested-by: NYanmin Zhang <yanmin_zhang@linux.intel.com>
      Tested-by: NDave Young <hidave.darkstar@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5c58ceff
  10. 11 8月, 2009 1 次提交
    • L
      pty: fix data loss when stopped (^S/^Q) · 85dfd81d
      Linus Torvalds 提交于
      Commit d945cb9c ("pty: Rework the pty layer to use the normal buffering
      logic") dropped the test for 'tty->stopped' in pty_write_room(), which
      then causes the n_tty line discipline thing to not throttle the data
      properly when the tty is stopped.
      
      So instead of pausing the write due to the tty being stopped, the ldisc
      layer would go ahead and push it down to the pty.  The pty write()
      routine would then refuse to take the data (because it _did_ check
      'stopped'), and the data wouldn't actually be written.
      
      This whole stopped test should eventually be moved into the tty ldisc
      layer rather than have low-level tty drivers care about these things,
      but right now the fix is to just re-instate the missing pty 'stopped'
      handling.
      Reported-and-tested-by: NArtur Skawina <art.08.09@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      85dfd81d
  11. 05 8月, 2009 3 次提交
    • L
      tty-ldisc: be more careful in 'put_ldisc' locking · cbe9352f
      Linus Torvalds 提交于
      Use 'atomic_dec_and_lock()' to make sure that we always hold the
      tty_ldisc_lock when the ldisc count goes to zero. That way we can never
      race against 'tty_ldisc_try()' increasing the count again.
      Reported-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: NSergey Senozhatsky <sergey.senozhatsky@mail.by>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cbe9352f
    • L
      tty-ldisc: turn ldisc user count into a proper refcount · 65b77046
      Linus Torvalds 提交于
      By using the user count for the actual lifetime rules, we can get rid of
      the silly "wait_for_idle" logic, because any busy ldisc will
      automatically stay around until the last user releases it.  This avoids
      a host of odd issues, and simplifies the code.
      
      So now, when the last ldisc reference is dropped, we just release the
      ldisc operations struct reference, and free the ldisc.
      
      It looks obvious enough, and it does work for me, but the counting
      _could_ be off. It probably isn't (bad counting in the new version would
      generally imply that the old code did something really bad, like free an
      ldisc with a non-zero count), but it does need some testing, and
      preferably somebody looking at it.
      
      With this change, both 'tty_ldisc_put()' and 'tty_ldisc_deref()' are
      just aliases for the new ref-counting 'put_ldisc()'. Both of them
      decrement the ldisc user count and free it if it goes down to zero.
      They're identical functions, in other words.
      
      But the reason they still exist as sepate functions is that one of them
      was exported (tty_ldisc_deref) and had a stupid name (so I don't want to
      use it as the main name), and the other one was used in multiple places
      (and I didn't want to make the patch larger just to rename the users).
      
      In addition to the refcounting, I did do some minimal cleanup. For
      example, now "tty_ldisc_try()" actually returns the ldisc it got under
      the lock, rather than returning true/false and then the caller would
      look up the ldisc again (now without the protection of the lock).
      
      That said, there's tons of dubious use of 'tty->ldisc' without obviously
      proper locking or refcounting left. I expressly did _not_ want to try to
      fix it all, keeping the patch minimal. There may or may not be bugs in
      that kind of code, but they wouldn't be _new_ bugs.
      
      That said, even if the bugs aren't new, the timing and lifetime will
      change. For example, some silly code may depend on the 'tty->ldisc'
      pointer not changing because they hold a refcount on the 'ldisc'. And
      that's no longer true - if you hold a ref on the ldisc, the 'ldisc'
      itself is safe, but tty->ldisc may change.
      
      So the proper locking (remains) to hold tty->ldisc_mutex if you expect
      tty->ldisc to be stable. That's not really a _new_ rule, but it's an
      example of something that the old code might have unintentionally
      depended on and hidden bugs.
      
      Whatever. The patch _looks_ sensible to me. The only users of
      ldisc->users are:
       - get_ldisc() - atomically increment the count
      
       - put_ldisc() - atomically decrements the count and releases if zero
      
       - tty_ldisc_try_get() - creates the ldisc, and sets the count to 1.
         The ldisc should then either be released, or be attached to a tty.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Tested-by: NSergey Senozhatsky <sergey.senozhatsky@mail.by>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      65b77046
    • L
      tty-ldisc: make refcount be atomic_t 'users' count · 18eac1cc
      Linus Torvalds 提交于
      This is pure preparation of changing the ldisc reference counting to be
      a true refcount that defines the lifetime of the ldisc.  But this is a
      purely syntactic change for now to make the next steps easier.
      
      This patch should make no semantic changes at all. But I wanted to make
      the ldisc refcount be an atomic (I will be touching it without locks
      soon enough), and I wanted to rename it so that there isn't quite as
      much confusion between 'ldo->refcount' (ldisk operations refcount) and
      'ld->refcount' (ldisc refcount itself) in the same file.
      
      So it's now an atomic 'ld->users' count. It still starts at zero,
      despite having a reference from 'tty->ldisc', but that will change once
      we turn it into a _real_ refcount.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Tested-by: NSergey Senozhatsky <sergey.senozhatsky@mail.by>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      18eac1cc
  12. 03 8月, 2009 1 次提交
    • I
      debug lockups: Improve lockup detection, fix generic arch fallback · 47cab6a7
      Ingo Molnar 提交于
      As Andrew noted, my previous patch ("debug lockups: Improve lockup
      detection") broke/removed SysRq-L support from architecture that do
      not provide a __trigger_all_cpu_backtrace implementation.
      
      Restore a fallback path and clean up the SysRq-L machinery a bit:
      
       - Rename the arch method to arch_trigger_all_cpu_backtrace()
      
       - Simplify the define
      
       - Document the method a bit - in the hope of more architectures
         adding support for it.
      
      [ The patch touches Sparc code for the rename. ]
      
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      LKML-Reference: <20090802140809.7ec4bb6b.akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      47cab6a7
  13. 02 8月, 2009 2 次提交
    • H
      parisc: parisc-agp.c - use correct page_mask function · c4396232
      Helge Deller 提交于
      Fix those compiler warnings, which indeed point to a bug:
      drivers/char/agp/parisc-agp.c:228: warning: initialization from incompatible pointer type
      drivers/char/agp/parisc-agp.c:201: warning: 'parisc_agp_page_mask_memory' defined but not used
      Signed-off-by: NHelge Deller <deller@gmx.de>
      c4396232
    • I
      debug lockups: Improve lockup detection · c1dc0b9c
      Ingo Molnar 提交于
      When debugging a recent lockup bug i found various deficiencies
      in how our current lockup detection helpers work:
      
       - SysRq-L is not very efficient as it uses a workqueue, hence
         it cannot punch through hard lockups and cannot see through
         most soft lockups either.
      
       - The SysRq-L code depends on the NMI watchdog - which is off
         by default.
      
       - We dont print backtraces from the RCU code's built-in
         'RCU state machine is stuck' debug code. This debug
         code tends to be one of the first (and only) mechanisms
         that show that a lockup has occured.
      
      This patch changes the code so taht we:
      
       - Trigger the NMI backtrace code from SysRq-L instead of using
         a workqueue (which cannot punch through hard lockups)
      
       - Trigger print-all-CPU-backtraces from the RCU lockup detection
         code
      
      Also decouple the backtrace printing code from the NMI watchdog:
      
       - Dont use variable size cpumasks (it might not be initialized
         and they are a bit more fragile anyway)
      
       - Trigger an NMI immediately via an IPI, instead of waiting
         for the NMI tick to occur. This is a lot faster and can
         produce more relevant backtraces. It will also work if the
         NMI watchdog is disabled.
      
       - Dont print the 'dazed and confused' message when we print
         a backtrace from the NMI
      
       - Do a show_regs() plus a dump_stack() to get maximum info
         out of the dump. Worst-case we get two stacktraces - which
         is not a big deal. Sometimes, if register content is
         corrupted, the precise stack walker in show_regs() wont
         give us a full backtrace - in this case dump_stack() will
         do it.
      
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c1dc0b9c
  14. 30 7月, 2009 2 次提交
    • H
      sysrq, kdump: make sysrq-c consistent · cab8bd34
      Hidetoshi Seto 提交于
      commit d6580a9f ("kexec: sysrq: simplify
      sysrq-c handler") changed the behavior of sysrq-c to unconditional
      dereference of NULL pointer.  So in cases with CONFIG_KEXEC, where
      crash_kexec() was directly called from sysrq-c before, now it can be said
      that a step of "real oops" was inserted before starting kdump.
      
      However, in contrast to oops via SysRq-c from keyboard which results in
      panic due to in_interrupt(), oops via "echo c > /proc/sysrq-trigger" will
      not become panic unless panic_on_oops=1.  It means that even if dump is
      properly configured to be taken on panic, the sysrq-c from proc interface
      might not start crashdump while the sysrq-c from keyboard can start
      crashdump.  This confuses traditional users of kdump, i.e.  people who
      expect sysrq-c to do common behavior in both of the keyboard and proc
      interface.
      
      This patch brings the keyboard and proc interface behavior of sysrq-c in
      line, by forcing panic_on_oops=1 before oops in sysrq-c handler.
      
      And some updates in documentation are included, to clarify that there is
      no longer dependency with CONFIG_KEXEC, and that now the system can just
      crash by sysrq-c if no dump mechanism is configured.
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NVivek Goyal <vgoyal@redhat.com>
      Cc: Brayan Arraes <brayan@yack.com.br>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cab8bd34
    • O
      pty: avoid forcing 'low_latency' tty flag · e043e42b
      OGAWA Hirofumi 提交于
      We really don't want to mark the pty as a low-latency device, because as
      Alan points out, the ->write method can be called from an IRQ (ppp?),
      and that means we can't use ->low_latency=1 as we take mutexes in the
      low_latency case.
      
      So rather than using low_latency to force the written data to be pushed
      to the ldisc handling at 'write()' time, just make the reader side (or
      the poll function) do the flush when it checks whether there is data to
      be had.
      
      This also fixes the problem with lost data in an emacs compile buffer
      (bugzilla 13815), and we can thus revert the low_latency pty hack
      (commit 3a542974: "pty: quickfix for the
      pty ENXIO timing problems").
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Tested-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      [ Modified to do the tty_flush_to_ldisc() inside input_available_p() so
        that it triggers for both read and poll()  - Linus]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e043e42b
  15. 29 7月, 2009 1 次提交
  16. 28 7月, 2009 1 次提交
  17. 21 7月, 2009 3 次提交
  18. 17 7月, 2009 5 次提交
  19. 13 7月, 2009 1 次提交
  20. 09 7月, 2009 2 次提交
  21. 03 7月, 2009 2 次提交
  22. 30 6月, 2009 1 次提交
    • A
      tty: Fix the leak in tty_ldisc_release · aef29bc2
      Alan Cox 提交于
      Currently we reinit the ldisc on final tty close which is what the old code
      did to ensure that if the device retained its termios settings then it had the
      right ldisc. tty_ldisc_reinit does that but also leaves us with the reset
      ldisc reference which is then leaked.
      
      At this point we know the port will be recycled so we can kill the ldisc
      off completely rather than try and add another ldisc free up when the kref
      count hits zero.
      
      At this point it is safe to keep the ldisc closed as tty_ldisc waiting
      methods are only used from the user side, and as the final close we are
      the last such reference. Interrupt/driver side methods will always use the
      non wait version and get back a NULL.
      
      Found with kmemleak and investigated/identified by Catalin Marinas.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aef29bc2
  23. 26 6月, 2009 2 次提交
    • S
      powerpc/BSR: Fix BSR to allow mmap of small BSR on 64k kernel · 04a85d12
      Sonny Rao 提交于
      On Mon, Nov 17, 2008 at 01:26:13AM -0600, Sonny Rao wrote:
      > On Fri, Nov 07, 2008 at 04:28:29PM +1100, Paul Mackerras wrote:
      > > Sonny Rao writes:
      > >
      > > > Fix the BSR driver to allow small BSR devices, which are limited to a
      > > > single 4k space, on a 64k page kernel.  Previously the driver would
      > > > reject the mmap since the size was smaller than PAGESIZE (or because
      > > > the size was greater than the size of the device).  Now, we check for
      > > > this case use remap_4k_pfn(). Also, take out code to set vm_flags,
      > > > as the remap_pfn functions will do this for us.
      > >
      > > Thanks.
      > >
      > > Do we know that the BSR size will always be 4k if it's not a multiple
      > > of 64k?  Is it possible that we could get 8k, 16k or 32k or BSRs?
      > > If it is possible, what does the user need to be able to do?  Do they
      > > just want to map 4k, or might then want to map the whole thing?
      >
      >
      > Hi Paul, I took a look at changing the driver to reject a request for
      > mapping more than a single 4k page, however the only indication we get
      > of the requested size in the mmap function is the vma size, and this
      > is always one page at minimum.  So, it's not possible to determine if
      > the user wants one 4k page or more.  As I noted in my first response,
      > there is only one case where this is even possible and I don't think
      > it is a significant concern.
      >
      > I did notice that I left out the check to see if the user is trying to
      > map more than the device length, so I fixed that.  Here's the revised
      > patch.
      
      Alright, I've reworked this now so that if we get one of these cases
      where there's a bsr that's > 4k and < 64k on a 64k kernel we'll only
      advertise that it is a 4k BSR to userspace.  I think this is the best
      solution since user programs are only supposed to look at sysfs to
      determine how much can be mapped, and libbsr does this as well.
      
      Please consider for 2.6.31 as a fix, thanks.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      04a85d12
    • S
      powerpc/BSR: add 4096 byte BSR size · e4031d52
      Sonny Rao 提交于
      Add a 4096 byte BSR size which will be used on new machines.  Also, remove
      the warning when we run into an unknown size, as this can spam the kernel
      log excessively.
      Signed-off-by: NSonny Rao <sonnyrao@us.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e4031d52
  24. 25 6月, 2009 1 次提交