1. 04 Apr, 2011 1 commit
    • Linus Torvalds's avatar
      tty: fix endless work loop when the buffer fills up · a5660b41
      Linus Torvalds authored
      Commit f23eb2b2 ('tty: stop using "delayed_work" in the tty layer')
      ended up causing hung machines on UP with no preemption, because the
      work routine to flip the buffer data to the ldisc would endlessly re-arm
      itself if the destination buffer had filled up.
      With the delayed work, that only caused a timer-driving polling of the
      tty state every timer tick, but without the delay we just ended up with
      basically a busy loop instead.
      Stop the insane polling, and instead make the code that opens up the
      receive room re-schedule the buffer flip work.  That's what we should
      have been doing anyway.
      This same "poll for tty room" issue is almost certainly also the cause
      of excessive kworker activity when idle reported by Dave Jones, who also
      reported "flush_to_ldisc executing 2500 times a second" back in Nov 2010:
      which is that silly flushing done every timer tick.  Wasting both power
      and CPU for no good reason.
      Reported-and-tested-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
      Reported-and-tested-by: default avatarSitsofe Wheeler <sitsofe@yahoo.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  2. 30 Mar, 2011 3 commits
  3. 29 Mar, 2011 1 commit
  4. 25 Mar, 2011 1 commit
  5. 24 Mar, 2011 1 commit
  6. 23 Mar, 2011 1 commit
  7. 22 Mar, 2011 1 commit
    • Linus Torvalds's avatar
      tty: stop using "delayed_work" in the tty layer · f23eb2b2
      Linus Torvalds authored
      Using delayed-work for tty flip buffers ends up causing us to wait for
      the next tick to complete some actions.  That's usually not all that
      noticeable, but for certain latency-critical workloads it ends up being
      totally unacceptable.
      As an extreme case of this, passing a token back-and-forth over a pty
      will take two ticks per iteration, so even just a thousand iterations
      will take 8 seconds assuming a common 250Hz configuration.
      Avoiding the whole delayed work issue brings that ping-pong test-case
      down to 0.009s on my machine.
      In more practical terms, this latency has been a performance problem for
      things like dive computer simulators (simulating the serial interface
      using the ptys) and for other environments (Alan mentions a CP/M emulator).
      Reported-by: default avatarJef Driesen <jefdriesen@telenet.be>
      Acked-by: default avatarGreg KH <gregkh@suse.de>
      Acked-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  8. 15 Mar, 2011 1 commit
    • Julia Lawall's avatar
      drivers/serial/ucc_uart.c: Add of_node_put to avoid memory leak · 48a10cdf
      Julia Lawall authored
      Add a call to of_node_put in the error handling code following a call to
      of_find_compatible_node or of_find_node_by_type.
      This patch also substantially reorganizes the error handling code in the
      function, to that it is possible first to jump to code that frees qe_port
      and then to jump to code that also puts np.
      The semantic match that finds this problem is as follows:
      // <smpl>
      @r exists@
      local idexpression x;
      expression E,E1,E2;
      statement S;
      *x =
      if (x == NULL) S
      <... when != x = E
      *if (...) {
        ... when != of_node_put(x)
            when != if (...) { ... of_node_put(x); ... }
        return <+...x...+>;
      *  return ...;
      E2 = x;
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Acked-by: default avatarTimur Tabi <timur@freescale.com>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
  9. 14 Mar, 2011 1 commit
  10. 10 Mar, 2011 2 commits
  11. 09 Mar, 2011 2 commits
    • Konrad Rzeszutek Wilk's avatar
      xen/hvc: Disable probe_irq_on/off from poking the hvc-console IRQ line. · bbd5a762
      Konrad Rzeszutek Wilk authored
      This fixes a particular nasty racing problem found when using
      Xen hypervisor with the console (hvc) output being routed to the
      serial port and the serial port receiving data when
      probe_irq_off(probe_irq_on) is running.
      Specifically the bug manifests itself with:
      [    4.470693] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      [    4.470693] IP: [<ffffffff810a8c65>] handle_IRQ_event+0xe/0xc9
      [    4.470693] Call Trace:
      [    4.470693]  <IRQ>
      [    4.470693]  [<ffffffff810aa645>] handle_percpu_irq+0x3c/0x69
      [    4.470693]  [<ffffffff8123cda7>] __xen_evtchn_do_upcall+0xfd/0x195
      [    4.470693]  [<ffffffff810308cf>] ? xen_restore_fl_direct_end+0x0/0x1
      [    4.470693]  [<ffffffff8123d873>] xen_evtchn_do_upcall+0x32/0x47
      [    4.470693]  [<ffffffff81034dfe>] xen_do_hypervisor_callback+0x1e/0x30
      [    4.470693]  <EOI>
      [    4.470693]  [<ffffffff8100922a>] ? hypercall_page+0x22a/0x1000
      [    4.470693]  [<ffffffff8100922a>] ? hypercall_page+0x22a/0x1000
      [    4.470693]  [<ffffffff810301c5>] ? xen_force_evtchn_callback+0xd/0xf
      [    4.470693]  [<ffffffff810308e2>] ? check_events+0x12/0x20
      [    4.470693]  [<ffffffff81030889>] ? xen_irq_enable_direct_end+0x0/0x7
      [    4.470693]  [<ffffffff810ab0a0>] ? probe_irq_on+0x8f/0x1d7
      [    4.470693]  [<ffffffff812b105e>] ? serial8250_config_port+0x7b7/0x9e6
      [    4.470693]  [<ffffffff812ad66c>] ? uart_add_one_port+0x11b/0x305
      The bug is trigged by three actors working together:
       A). serial_8250_config_port calling
           wherein all of the IRQ handlers are being started and shut off.
           The functions utilize the sleep functions so the minimum time
           they are run is 120 msec.
       B). Xen hypervisor receiving on the serial line any character and
           setting the bits in the event channel - during this 120 msec timeframe.
       C). The hvc API makes a call to 'request_irq' (and hence setting desc->action
           to a valid value), much much later - when user space opens
           /dev/console (hvc_open). To make the console usable during bootup,
           the Xen HVC implementation sets the IRQ chip (and correspondingly
           the event channel) much earlier. The IRQ chip handler that is used
           is the handle_percpu_irq (aaca4964)
      Back to the issue. When A) is being called it ends up calling the
      xen_percpu_chip's chip->startup twice and chip->shutdown once. Those
      are set to the default_startup and mask_irq (events.c) respectivly.
      If (and this seems to depend on what serial concentrator you use), B)
      gets data from the serial port it sets in the event channel a pending bit.
      When A) calls chip->startup(), the masking of the pending bit, and
      unmasking of the event channel mask, and also setting of the upcall_pending
      flag is done (since there is data present on the event channel).
      If before the 120 msec has elapsed, any IRQ handler (Xen IRQ has one
      IRQ handler, which checks the event channels bitmap to figure which one
      to call) is called we end up calling the handle_percpu_irq. The
      handle_percpu_irq calls desc->action (which is NULL) and we blow up.
      Caveats: I could only reproduce this on 2.6.32 pvops. I am not sure
      why this is not showing up on 2.6.38 kernel.
      The probe_irq_on/off has code to disable poking specific IRQ lines. This is
      done by using the set_irq_noprobe() and then we do not have to
      worry about the handle_percpu_irq being called before the IRQ action
      handler has been installed.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    • Eric Bénard's avatar
      n_gsm: fix UIH control byte : P bit should be 0 · ed43b47b
      Eric Bénard authored
      * the GSM 07.10 specification says in that
      'both stations shall set the P bit to 0'
        thanks to Alan Cox for finding this explanation in the spec
      * without this fix, on Telit & Sim.com modems, opening a new DLC
      randomly fails. Not setting PF bit of the control byte gives a
      reliable behaviour on these modems.
      Signed-off-by: default avatarEric Bénard <eric@eukrea.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
  12. 07 Mar, 2011 2 commits
    • Mayank Rana's avatar
      serial: msm_serial_hs: Add MSM high speed UART driver · 55046237
      Mayank Rana authored
      This driver supports UART-DM HW on MSM platforms. It uses the on
      chip DMA to drive data transfers and has optional support for UART
      power management independent of Linux suspend/resume and wakeup
      from Rx.
      The driver was originally developed by Google. It is functionally
      equivalent to the version available at:
      the differences being:
      1) Remove wakelocks and change unsupported DMA API.
      2) Replace clock selection register codes by macros.
      3) Fix checkpatch errors and add inline documentation.
      4) Add runtime PM hooks for active power state transitions.
      5) Handle error path and cleanup resources if required.
      CC: Nick Pelly <npelly@google.com>
      Signed-off-by: default avatarSankalp Bose <sankalpb@codeaurora.org>
      Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    • Xiaotian Feng's avatar
      tty_audit: fix tty_audit_add_data live lock on audit disabled · 00bff392
      Xiaotian Feng authored
      The current tty_audit_add_data code:
              do {
                      size_t run;
                      run = N_TTY_BUF_SIZE - buf->valid;
                      if (run > size)
                              run = size;
                      memcpy(buf->data + buf->valid, data, run);
                      buf->valid += run;
                      data += run;
                      size -= run;
                      if (buf->valid == N_TTY_BUF_SIZE)
              } while (size != 0);
      If the current buffer is full, kernel will then call tty_audit_buf_push_current
      to empty the buffer. But if we disabled audit at the same time, tty_audit_buf_push()
      returns immediately if audit_enabled is zero.  Without emptying the buffer.
      With obvious effect on tty_audit_add_data() that ends up spinning in that loop,
      copying 0 bytes at each iteration and attempting to push each time without any effect.
      Holding the lock all along.
      Suggested-by: default avatarAlexander Viro <aviro@redhat.com>
      Signed-off-by: default avatarXiaotian Feng <dfeng@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
  13. 03 Mar, 2011 1 commit
    • Alexandre Courbot's avatar
      serial: sh-sci: fix deadlock when resuming from S3 sleep · 36003386
      Alexandre Courbot authored
      S3 sleep invokes the shutdown callback of the sh-sci driver, which
      suspends the clocks until they are reactivated by a call to startup.
      However, before the latter is invoked, sci_set_termios may be called on
      the port by uart_resume_port. In such cases it will endlessly wait for
      the TEND bit to raise, which will never happen since the clocks are
      This patch ensures that clocks are enabled when ports registers are
      manipulated within sci_set_termios.
      Signed-off-by: default avatarAlexandre Courbot <gnurou@gmail.com>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
  14. 01 Mar, 2011 4 commits
    • Benjamin Herrenschmidt's avatar
      powerpc/pseries: Reduce HVCS driver insanity · c7704d35
      Benjamin Herrenschmidt authored
      The HVCS driver, for those who don't know, is a driver for the "server" side
      of the IBM virtual terminal mechanism allowing Linux partitions to act as
      terminal servers under IBM PowerVM hypervisor. It's almost never used on
      the field at the moment.
      However, it's part of our configs, and in its current incarnation, will
      allocate the tty driver & major (with 64 minors) and create a kernel thread
      whether it's used or not, ie, whether the hypervisor did put a virtual
      terminal server device node in the partition or not (or whether running on
      a pseries machine or not even).
      This in turns causes modern distro's udev's to start trying to open all
      those 64 minors at boot, which, since they aren't linked to anything,
      causes the driver to spew errors in the kernel log for each of them.
      Not nice.
      This moves all that initialization to a function which is now only called
      the first time a terminal server virtual IO device is actually probed
      (that is almost never).
      There's still a _LOT_ of cleanup that can be done in this driver, some
      simple (almost all printk's statements in there shall either just be
      removed or in some case turned into better written & more informative
      messages, including using the dev_* variants etc...). This is left as
      an exercise for whoever actually cares about that driver.
      One could also try to be smart and dispose of all the tty related
      resources when the last instance of the VIO server device
      is removed (Hotplug anybody ?).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    • Arnd Bergmann's avatar
      drivers: remove extraneous includes of smp_lock.h · 5edc3413
      Arnd Bergmann authored
      These were missed the last time I cleaned this up
      globally, because of code moving around or new code
      getting merged.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    • Tobias Klauser's avatar
      tty: serial: altera_jtaguart: Add device tree support · 9f15444f
      Tobias Klauser authored
      Advertise the possibility to use this driver with device tree if
      CONFIG_OF is set.
      Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
    • Tobias Klauser's avatar
      tty: serial: altera_uart: Add devicetree support · 7c9325d7
      Tobias Klauser authored
      With the recent switch of the (currently still out-of-tree) Nios2 Linux
      port to devicetree we want to be able to retrieve the resources and
      properties from dts.
      The old method to retrieve resources and properties from platform data
      is still supported.
      Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
  15. 28 Feb, 2011 3 commits
  16. 25 Feb, 2011 2 commits
  17. 23 Feb, 2011 1 commit
  18. 22 Feb, 2011 12 commits