21 Nov, 2015

1 commit

  • The data to audit/record is in the 'from' buffer (ie., the input
    read buffer).

    Fixes: 72586c6061ab ("n_tty: Fix auditing support for cannonical mode")
    Cc: stable # 4.1+
    Cc: Miloslav Trmač
    Signed-off-by: Peter Hurley
    Acked-by: Laura Abbott
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

18 Oct, 2015

5 commits

  • Introduce API functions to restart and cancel tty buffer work, rather
    than manipulate buffer work directly.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • The job_control() check in n_tty_read() has nearly identical purpose
    and results as tty_check_change(). Both functions' purpose is to
    determine if the current task's pgrp is the foreground pgrp for the tty,
    and if not, to signal the current pgrp.

    Introduce __tty_check_change() which takes the signal to send
    and performs the shared operations for job control() and
    tty_check_change().

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • In-tree users of wait_event_interruptible_tty() have been removed;
    remove.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • With the removal of tty_wait_until_sent_from_close(), tty drivers
    no longer wait during open for parallel closes to complete (instead,
    the tty core waits before calling the driver open() method). Thus,
    the close_wait waitqueue is no longer used for waiting.

    Remove struct tty_port::close_wait.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • tty_wait_until_sent_from_close() drops the tty lock while waiting
    for the tty driver to finish sending previously accepted data (ie.,
    data remaining in its write buffer and transmit fifo).

    tty_wait_until_sent_from_close() was added by commit a57a7bf3fc7e
    ("TTY: define tty_wait_until_sent_from_close") to prevent the entire
    tty subsystem from being unable to open new ttys while waiting for
    one tty to close while output drained.

    However, since commit 0911261d4cb6 ("tty: Don't take tty_mutex for tty
    count changes"), holding a tty lock while closing does not prevent other
    ttys from being opened/closed/hung up, but only prevents lifetime event
    changes for the tty under lock.

    Holding the tty lock while waiting for output to drain does prevent
    parallel non-blocking opens (O_NONBLOCK) from advancing or returning
    while the tty lock is held. However, all parallel opens _already_
    block even if the tty lock is dropped while closing and the parallel
    open advances. Blocking in open has been in mainline since at least 2.6.29
    (see tty_port_block_til_ready(); note the test for O_NONBLOCK is _after_
    the wait while ASYNC_CLOSING).

    IOW, before this patch a non-blocking open will sleep anyway for the
    _entire_ duration of a parallel hardware shutdown, and when it wakes, the
    error return will cause a release of its tty, and it will restart with
    a fresh attempt to open. Similarly with a blocking open that is already
    waiting; when it's woken, the hardware shutdown has already completed
    to ASYNC_INITIALIZED is not set, which forces a release and restart as
    well.

    So, holding the tty lock across the _entire_ close (which is what this
    patch does), even while waiting for output to drain, is equivalent to
    the current outcome wrt parallel opens.

    Cc: Alan Cox
    Cc: David Laight
    CC: Arnd Bergmann
    CC: Karsten Keil
    CC: linuxppc-dev@lists.ozlabs.org
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

24 Jul, 2015

1 commit


19 May, 2015

1 commit


11 May, 2015

1 commit

  • A read() from a pty master may mistakenly indicate EOF (errno == -EIO)
    after the pty slave has closed, even though input data remains to be read.
    For example,

    pty slave | input worker | pty master
    | |
    | | n_tty_read()
    pty_write() | | input avail? no
    add data | | sleep
    schedule worker --->| | .
    |---> flush_to_ldisc() | .
    pty_close() | fill read buffer | .
    wait for worker | wakeup reader --->| .
    | read buffer full? |---> input avail ? yes
    |= 4096 so the ldisc read buffer
    is empty
    3. the subsequent read() occurs before the kicked worker has processed
    more input

    However, the underlying cause of the race is that data is pipelined, while
    tty state is not; ie., data already written by the pty slave end is not
    yet visible to the pty master end, but state changes by the pty slave end
    are visible to the pty master end immediately.

    Pipeline the TTY_OTHER_CLOSED state through input worker to the reader.
    1. Introduce TTY_OTHER_DONE which is set by the input worker when
    TTY_OTHER_CLOSED is set and either the input buffers are flushed or
    input processing has completed. Readers/polls are woken when
    TTY_OTHER_DONE is set.
    2. Reader/poll checks TTY_OTHER_DONE instead of TTY_OTHER_CLOSED.
    3. A new input worker is started from pty_close() after setting
    TTY_OTHER_CLOSED, which ensures the TTY_OTHER_DONE state will be
    set if the last input worker is already finished (or just about to
    exit).

    Remove tty_flush_to_ldisc(); no in-tree callers.

    Fixes: 52bce7f8d4fc ("pty, n_tty: Simplify input processing on final close")
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96311
    BugLink: http://bugs.launchpad.net/bugs/1429756
    Cc: # 3.19+
    Reported-by: Andy Whitcroft
    Reported-by: H.J. Lu
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

07 May, 2015

2 commits

  • tty_name no longer uses the buf parameter, so remove it along with all
    the 64 byte stack buffers that used to be passed in.

    Mostly generated by the coccinelle script

    @depends on patch@
    identifier buf;
    constant C;
    expression tty;
    @@
    - char buf[C];

    allmodconfig compiles, so I'm fairly confident the stack buffers
    weren't used for other purposes as well.

    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Peter Hurley
    Acked-by: Jesper Nilsson
    Acked-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Rasmus Villemoes
     
  • All users of tty_name pass the result directly to a printf-like
    function. This means we can actually let tty_name return the literal
    "NULL tty" or tty->name directly, avoiding the strcpy and a lot of
    medium-sized stack buffers. In preparation for that, make the return
    type const char*.

    While at it, we can also constify the tty parameter.

    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Rasmus Villemoes
     

28 Apr, 2015

1 commit


03 Feb, 2015

4 commits

  • tty_set_termios() is an internal helper intended for file scope use.

    UART drivers which are capable of driving the RTS pin must
    properly handle the tiocmset() method, regardless of termios settings.
    A failure to do so is a UART driver bug and should be fixed there.
    Do not use this interface to workaround UART driver bugs.

    Cc: Johan Hedberg
    Cc:
    Signed-off-by: Peter Hurley
    Acked-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • BRKINT and ISIG requires input and output flush when a signal char
    is received. However, the order of operations is significant since
    parallel i/o may be ongoing.

    Merge the signal handling for BRKINT with ISIG handling.

    Process the signal first. This ensures any ongoing i/o is aborted;
    without this, a waiting writer may continue writing after the flush
    occurs and after the signal char has been echoed.

    Write lock the termios_rwsem, which excludes parallel writers from
    pushing new i/o until after the output buffers are flushed; claiming
    the write lock is necessary anyway to exclude parallel readers while
    the read buffer is flushed.

    Subclass the termios_rwsem for ptys since the slave pty performing
    the flush may appear to reorder the termios_rwsem->tty buffer lock
    lock order; adding annotation clarifies that
    slave tty_buffer lock-> slave termios_rwsem -> master tty_buffer lock
    is a valid lock order.

    Flush the echo buffer. In this context, the echo buffer is 'output'.
    Otherwise, the output will appear discontinuous because the output buffer
    was cleared which contains older output than the echo buffer.

    Open-code the read buffer flush since the input worker does not need
    kicking (this is the input worker).

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • The pty driver does not clear its write buffer when commanded.
    This is to avoid an apparent deadlock between parallel flushes from
    both pty ends; specifically when handling either BRK or INTR input.
    However, parallel flushes from this source is not possible since
    the pty master can never be set to BRKINT or ISIG. Parallel flushes
    from other sources are possible but these do not threaten deadlocks.

    Annotate the tty buffer mutex for lockdep to represent the nested
    tty_buffer locking which occurs when the pty slave is processing input
    (its buffer mutex held) and receives INTR or BRK and acquires the
    linked tty buffer mutex via tty_buffer_flush().

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Besides nested legacy_mutex locking which is required on pty pair
    teardown, other nested pty operations require lock subclassing.

    Move lock subclass definition to tty interface header, include/linux/tty.h,
    and document its use.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

07 Nov, 2014

1 commit


06 Nov, 2014

10 commits

  • serial_console_init() is not defined by the tty core; remove
    declaration.

    Note that the powerpc arch boot code contains a serial_console_init()
    declaration in arch/powerpc/boot/ops.h which is restricted to
    the powerpc arch boot.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • pcxe_open() has no definition in mainline; remove declaration.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • tty_ldisc_flush() first clears the line discipline input buffer,
    then clears the tty flip buffers. However, this allows for existing
    data in the tty flip buffers to be added after the ldisc input
    buffer has been cleared, but before the flip buffers have been cleared.

    Add an optional ldisc parameter to tty_buffer_flush() to allow
    tty_ldisc_flush() to pass the ldisc to clear.

    NB: Initially, the plan was to do this automatically in
    tty_buffer_flush(). However, an audit of the behavior of existing
    line disciplines showed that performing a ldisc buffer flush on
    ioctl(TCFLSH) was not always the outcome. For example, some line
    disciplines have flush_buffer() methods but not ioctl() methods,
    so a ->flush_buffer() command would be unexpected.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • The tty_unhangup() function is not defined.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Eliminate the requirement of specifying the tty lock nesting at
    lock time; instead, set the lock subclass for slave ptys at pty
    install (normal ttys and master ptys use subclass 0).

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • When releasing the master pty, the slave pty also needs to be locked
    to prevent concurrent tty count changes for the slave pty and to
    ensure that only one parallel master and slave release observe the
    final close, and proceed to destruct the pty pair. Conversely, when
    releasing the slave pty, locking the master pty is not necessary
    (since the master's state can be inferred by the slave tty count).

    Introduce tty_lock_slave()/tty_unlock_slave() which acquires/releases
    the tty lock of the slave pty. Remove tty_lock_pair()/tty_unlock_pair().

    Dropping the tty_lock is no longer required to re-establish a stable
    lock order.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Passing the 'other' tty to tty_ldisc_release() only makes sense
    for a pty pair; make o_tty function local instead.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Now that re-open is not permitted for a legacy BSD pty master,
    using TTY_CLOSING to indicate when a tty can be torn-down is
    no longer necessary.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Now that tty_ldisc_hangup() does not drop the tty lock, it is no
    longer possible to observe TTY_HUPPING while holding the tty lock
    on another cpu.

    Remove TTY_HUPPING bit definition.

    Reviewed-by: Alan Cox
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • tty_pair_get_pty() has no in-tree users and tty_pair_get_tty()
    has only one file-local user. Remove the external declarations,
    the export declarations, and declare tty_pair_get_tty() static.

    Signed-off-by: Peter Hurley
    Reviewed-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

25 Sep, 2014

1 commit

  • Commit c545b66c6922b002b5fe224a6eaec58c913650b5,
    'tty: Serialize tcflow() with other tty flow control changes' and
    commit 99416322dd16b810ba74098cc50ef2a844091d35,
    'tty: Workaround Alpha non-atomic byte storage in tty_struct' work around
    compiler bugs and non-atomic storage on multiple arches by padding
    bitfields out to the declared type which is unsigned long. However, the
    width varies by arch.

    Pad bitfields to actual width of unsigned long (which is BITS_PER_LONG).

    Reported-by: Fengguang Wu
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

24 Sep, 2014

5 commits

  • The Alpha EV4/EV5 cpus can corrupt adjacent byte and short data because
    those cpus use RMW to store byte and short data. Thus, concurrent adjacent
    byte stores could become corrupted, if serialized by a different lock.
    tty_struct uses different locks to protect certain fields within the
    structure, and thus is vulnerable to byte stores which are not atomic.

    Merge the ->ctrl_status byte and packet mode bit, both protected by the
    ->ctrl_lock, into an unsigned long.

    The padding bits are necessary to force the compiler to allocate the
    type specified; otherwise, gcc will ignore the type specifier and
    allocate the minimum number of bytes required to store the bitfield.
    In turn, this would allow Alpha EV4/EV5 cpus to corrupt adjacent byte
    or short storage (because those cpus use RMW to store byte and short data).

    gcc versions < 4.7.2 will also corrupt storage adjacent to bitfields
    smaller than unsigned long on ia64, ppc64, hppa64, and sparc64, thus
    requiring more than unsigned int storage (which would otherwise be
    sufficient to fix the Alpha non-atomic storage problem).

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Relocate the file-scope function, send_prio_char(), as a global
    helper tty_send_xchar(). Remove the global declarations for
    tty_write_lock()/tty_write_unlock(), as these are file-scope only now.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Use newly-introduced tty->flow_lock to serialize updates to
    tty->flow_stopped (via tcflow()) and with concurrent tty flow
    control changes from other sources.

    Merge the storage for ->stopped and ->flow_stopped, now that both
    flags are serialized by ->flow_lock.

    The padding bits are necessary to force the compiler to allocate the
    type specified; otherwise, gcc will ignore the type specifier and
    allocate the minimum number of bytes necessary to store the bitfield.
    In turn, this would allow Alpha EV4 and EV5 cpus to corrupt adjacent
    byte storage because those cpus use RMW to store byte and short data.

    gcc versions < 4.7.2 will also corrupt storage adjacent to bitfields
    smaller than unsigned long on ia64, ppc64, hppa64 and sparc64, thus
    requiring more than unsigned int storage (which would otherwise be
    sufficient to workaround the Alpha non-atomic byte/short storage problem).

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Without serialization, the flow control state can become inverted
    wrt. the actual hardware state. For example,

    CPU 0 | CPU 1
    stop_tty() |
    lock ctrl_lock |
    tty->stopped = 1 |
    unlock ctrl_lock |
    | start_tty()
    | lock ctrl_lock
    | tty->stopped = 0
    | unlock ctrl_lock
    | driver->start()
    driver->stop() |

    In this case, the flow control state now indicates the tty has
    been started, but the actual hardware state has actually been stopped.

    Introduce tty->flow_lock spinlock to serialize tty flow control changes.
    Split out unlocked __start_tty()/__stop_tty() flavors for use by
    ioctl(TCXONC) in follow-on patch.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • The stopped, hw_stopped, flow_stopped and packet bits are smp-unsafe
    and interrupt-unsafe. For example,

    CPU 0 | CPU 1
    |
    tty->flow_stopped = 1 | tty->hw_stopped = 0

    One of these updates will be corrupted, as the bitwise operation
    on the bitfield is non-atomic.

    Ensure each flag has a separate memory location, so concurrent
    updates do not corrupt orthogonal states. Because DEC Alpha EV4 and EV5
    cpus (from 1995) perform RMW on smaller-than-machine-word storage,
    "separate memory location" must be int instead of byte.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

12 Jul, 2014

1 commit


04 May, 2014

1 commit


25 Apr, 2014

1 commit

  • The race was introduced while development of linux-3.11 by
    e8437d7ecbc50198705331449367d401ebb3181f and
    e9975fdec0138f1b2a85b9624e41660abd9865d4.
    Originally it was found and reproduced on linux-3.12.15 and
    linux-3.12.15-rt25, by sending 500 byte blocks with 115kbaud to the
    target uart in a loop with 100 milliseconds delay.

    In short:
    1. The consumer flush_to_ldisc is on to remove the head tty_buffer.
    2. The producer adds a number of bytes, so that a new tty_buffer must
    be allocated and added by __tty_buffer_request_room.
    3. The consumer removes the head tty_buffer element, without handling
    newly committed data.

    Detailed example:
    * Initial buffer:
    * Head, Tail -> 0: used=250; commit=250; read=240; next=NULL
    * Consumer: ''flush_to_ldisc''
    * consumed 10 Byte
    * buffer:
    * Head, Tail -> 0: used=250; commit=250; read=250; next=NULL
    {{{
    count = head->commit - head->read; // count = 0
    if (!count) { // enter
    // INTERRUPTED BY PRODUCER ->
    if (head->next == NULL)
    break;
    buf->head = head->next;
    tty_buffer_free(port, head);
    continue;
    }
    }}}
    * Producer: tty_insert_flip_... 10 bytes + tty_flip_buffer_push
    * buffer:
    * Head, Tail -> 0: used=250; commit=250; read=250; next=NULL
    * added 6 bytes: head-element filled to maximum.
    * buffer:
    * Head, Tail -> 0: used=256; commit=250; read=250; next=NULL
    * added 4 bytes: __tty_buffer_request_room is called
    * buffer:
    * Head -> 0: used=256; commit=256; read=250; next=1
    * Tail -> 1: used=4; commit=0; read=250 next=NULL
    * push (tty_flip_buffer_push)
    * buffer:
    * Head -> 0: used=256; commit=256; read=250; next=1
    * Tail -> 1: used=4; commit=4; read=250 next=NULL
    * Consumer
    {{{
    count = head->commit - head->read;
    if (!count) {
    // INTERRUPTED BY PRODUCER next == NULL) // -> no break
    break;
    buf->head = head->next;
    tty_buffer_free(port, head);
    // ERROR: tty_buffer head freed -> 6 bytes lost
    continue;
    }
    }}}

    This patch reintroduces a spin_lock to protect this case. Perhaps later
    a lock-less solution could be found.

    Signed-off-by: Manfred Schlaegl
    Cc: stable # 3.11
    Signed-off-by: Greg Kroah-Hartman

    Manfred Schlaegl
     

03 Apr, 2014

1 commit

  • Pull networking updates from David Miller:
    "Here is my initial pull request for the networking subsystem during
    this merge window:

    1) Support for ESN in AH (RFC 4302) from Fan Du.

    2) Add full kernel doc for ethtool command structures, from Ben
    Hutchings.

    3) Add BCM7xxx PHY driver, from Florian Fainelli.

    4) Export computed TCP rate information in netlink socket dumps, from
    Eric Dumazet.

    5) Allow IPSEC SA to be dumped partially using a filter, from Nicolas
    Dichtel.

    6) Convert many drivers to pci_enable_msix_range(), from Alexander
    Gordeev.

    7) Record SKB timestamps more efficiently, from Eric Dumazet.

    8) Switch to microsecond resolution for TCP round trip times, also
    from Eric Dumazet.

    9) Clean up and fix 6lowpan fragmentation handling by making use of
    the existing inet_frag api for it's implementation.

    10) Add TX grant mapping to xen-netback driver, from Zoltan Kiss.

    11) Auto size SKB lengths when composing netlink messages based upon
    past message sizes used, from Eric Dumazet.

    12) qdisc dumps can take a long time, add a cond_resched(), From Eric
    Dumazet.

    13) Sanitize netpoll core and drivers wrt. SKB handling semantics.
    Get rid of never-used-in-tree netpoll RX handling. From Eric W
    Biederman.

    14) Support inter-address-family and namespace changing in VTI tunnel
    driver(s). From Steffen Klassert.

    15) Add Altera TSE driver, from Vince Bridgers.

    16) Optimizing csum_replace2() so that it doesn't adjust the checksum
    by checksumming the entire header, from Eric Dumazet.

    17) Expand BPF internal implementation for faster interpreting, more
    direct translations into JIT'd code, and much cleaner uses of BPF
    filtering in non-socket ocntexts. From Daniel Borkmann and Alexei
    Starovoitov"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1976 commits)
    netpoll: Use skb_irq_freeable to make zap_completion_queue safe.
    net: Add a test to see if a skb is freeable in irq context
    qlcnic: Fix build failure due to undefined reference to `vxlan_get_rx_port'
    net: ptp: move PTP classifier in its own file
    net: sxgbe: make "core_ops" static
    net: sxgbe: fix logical vs bitwise operation
    net: sxgbe: sxgbe_mdio_register() frees the bus
    Call efx_set_channels() before efx->type->dimension_resources()
    xen-netback: disable rogue vif in kthread context
    net/mlx4: Set proper build dependancy with vxlan
    be2net: fix build dependency on VxLAN
    mac802154: make csma/cca parameters per-wpan
    mac802154: allow only one WPAN to be up at any given time
    net: filter: minor: fix kdoc in __sk_run_filter
    netlink: don't compare the nul-termination in nla_strcmp
    can: c_can: Avoid led toggling for every packet.
    can: c_can: Simplify TX interrupt cleanup
    can: c_can: Store dlc private
    can: c_can: Reduce register access
    can: c_can: Make the code readable
    ...

    Linus Torvalds
     

01 Mar, 2014

1 commit

  • The user-settable knob, low_latency, has been the source of
    several BUG reports which stem from flush_to_ldisc() running
    in interrupt context. Since 3.12, which added several sleeping
    locks (termios_rwsem and buf->lock) to the input processing path,
    the frequency of these BUG reports has increased.

    Note that changes in 3.12 did not introduce this regression;
    sleeping locks were first added to the input processing path
    with the removal of the BKL from N_TTY in commit
    a88a69c91256418c5907c2f1f8a0ec0a36f9e6cc,
    'n_tty: Fix loss of echoed characters and remove bkl from n_tty'
    and later in commit 38db89799bdf11625a831c5af33938dcb11908b6,
    'tty: throttling race fix'. Since those changes, executing
    flush_to_ldisc() in interrupt_context (ie, low_latency set), is unsafe.

    However, since most devices do not validate if the low_latency
    setting is appropriate for the context (process or interrupt) in
    which they receive data, some reports are due to misconfiguration.
    Further, serial dma devices for which dma fails, resort to
    interrupt receiving as a backup without resetting low_latency.

    Historically, low_latency was used to force wake-up the reading
    process rather than wait for the next scheduler tick. The
    effect was to trim multiple milliseconds of latency from
    when the process would receive new data.

    Recent tests [1] have shown that the reading process now receives
    data with only 10's of microseconds latency without low_latency set.

    Remove the low_latency rx steering from tty_flip_buffer_push();
    however, leave the knob as an optional hint to drivers that can
    tune their rx fifos and such like. Cleanup stale code comments
    regarding low_latency.

    [1] https://lkml.org/lkml/2014/2/20/434

    "Yay.. thats an annoying historical pain in the butt gone."
    -- Alan Cox

    Reported-by: Beat Bolli
    Reported-by: Pavel Roskin
    Acked-by: David Sterba
    Cc: Grant Edwards
    Cc: Stanislaw Gruszka
    Cc: Hal Murray
    Cc: # 3.12.x+
    Signed-off-by: Peter Hurley
    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

15 Feb, 2014

1 commit

  • The tty core supports two models for handling tty_port lifetimes;
    the tty_port can use the kref supplied by tty_port (which will
    automatically destruct the tty_port when the ref count drops to
    zero) or it can destruct the tty_port manually.

    For tty drivers that choose to use the port kref to manage the
    tty_port lifetime, it is not possible to safely acquire a port
    reference conditionally. If the last reference is released after
    evaluating the condition but before acquiring the reference, a
    bogus reference will be held while the tty_port destruction
    commences.

    Rather, only acquire a port reference if the ref count is non-zero
    and allow the caller to distinguish if a reference has successfully
    been acquired.

    Cc: Jiri Slaby
    Signed-off-by: Peter Hurley
    Acked-by: Greg Kroah-Hartman
    Tested-By: Alexander Holler
    Signed-off-by: Marcel Holtmann

    Peter Hurley
     

21 Jan, 2014

1 commit

  • Pull USB updates from Greg KH:
    "Here's the big USB pull request for 3.14-rc1

    Lots of little things all over the place, and the usual USB gadget
    updates, and XHCI fixes (some for an issue reported by a lot of
    people). USB PHY updates as well as chipidea updates and fixes.

    All of these have been in the linux-next tree with no reported issues"

    * tag 'usb-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (318 commits)
    usb: chipidea: udc: using MultO at TD as real mult value for ISO-TX
    usb: chipidea: need to mask INT_STATUS when write otgsc
    usb: chipidea: put hw_phymode_configure before ci_usb_phy_init
    usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
    usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28
    usb: chipidea: add freescale imx28 special write register method
    usb: ehci: add freescale imx28 special write register method
    usb: core: check for valid id_table when using the RefId feature
    usb: cdc-wdm: resp_count can be 0 even if WDM_READ is set
    usb: core: bail out if user gives an unknown RefId when using new_id
    usb: core: allow a reference device for new_id
    usb: core: add sanity checks when using bInterfaceClass with new_id
    USB: image: correct spelling mistake in comment
    USB: c67x00: correct spelling mistakes in comments
    usb: delete non-required instances of include
    usb:hub set hub->change_bits when over-current happens
    Revert "usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28"
    xhci: Set scatter-gather limit to avoid failed block writes.
    xhci: Avoid infinite loop when sg urb requires too many trbs
    usb: gadget: remove unused variable in gr_queue_int()
    ...

    Linus Torvalds