30 Nov, 2011

1 commit


04 Jun, 2011

1 commit

  • This reverts commit b1c43f82c5aa265442f82dba31ce985ebb7aa71c.

    It was broken in so many ways, and results in random odd pty issues.

    It re-introduced the buggy schedule_work() in flush_to_ldisc() that can
    cause endless work-loops (see commit a5660b41af6a: "tty: fix endless
    work loop when the buffer fills up").

    It also used an "unsigned int" return value fo the ->receive_buf()
    function, but then made multiple functions return a negative error code,
    and didn't actually check for the error in the caller.

    And it didn't actually work at all. BenH bisected down odd tty behavior
    to it:
    "It looks like the patch is causing some major malfunctions of the X
    server for me, possibly related to PTYs. For example, cat'ing a
    large file in a gnome terminal hangs the kernel for -minutes- in a
    loop of what looks like flush_to_ldisc/workqueue code, (some ftrace
    data in the quoted bits further down).

    ...

    Some more data: It -looks- like what happens is that the
    flush_to_ldisc work queue entry constantly re-queues itself (because
    the PTY is full ?) and the workqueue thread will basically loop
    forver calling it without ever scheduling, thus starving the consumer
    process that could have emptied the PTY."

    which is pretty much exactly the problem we fixed in a5660b41af6a.

    Milton Miller pointed out the 'unsigned int' issue.

    Reported-by: Benjamin Herrenschmidt
    Reported-by: Milton Miller
    Cc: Stefan Bigler
    Cc: Toby Gray
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Alan Cox
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

23 Apr, 2011

1 commit

  • it makes it simpler to keep track of the amount of
    bytes received and simplifies how flush_to_ldisc counts
    the remaining bytes. It also fixes a bug of lost bytes
    on n_tty when flushing too many bytes via the USB
    serial gadget driver.

    Tested-by: Stefan Bigler
    Tested-by: Toby Gray
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Felipe Balbi
     

02 Mar, 2011

1 commit


23 Jan, 2011

1 commit

  • Fix locking in read and write code of n_hdlc line discipline.

    2.6.36 replaced lock_kernel() with tty_lock(). The tty mutex is not
    dropped automatically when the thread sleeps like the BKL. This results
    in a blocked read or write holding the tty mutex and stalling operations
    by other devices that use the tty mutex.

    A review of n_hdlc read and write code shows:
    1. neither BKL or tty mutex are required for correct operation
    2. read can block while read data is available if data is posted
    between availability check and call to interruptible_sleep_on()
    3. write does not set process state to TASK_INTERRUPTIBLE
    on each pass through the processing loop which can cause
    unneeded scheduling of the thread

    The unnecessary tty mutex references have been removed.

    Read changed to use same code as n_tty read
    for completing reads and blocking.

    Write corrected to set process state to TASK_INTERRUPTIBLE on each pass
    through processing loop.

    Signed-off-by: Paul Fulghum
    Acked-by: Arnd Bergmann
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Paul Fulghum
     

05 Nov, 2010

1 commit