1. 23 5月, 2011 2 次提交
  2. 19 5月, 2011 2 次提交
  3. 20 4月, 2011 2 次提交
  4. 05 4月, 2011 1 次提交
    • L
      tty: fix endless work loop when the buffer fills up · a5660b41
      Linus Torvalds 提交于
      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:
      
        http://lkml.org/lkml/2010/11/30/592
      
      which is that silly flushing done every timer tick.  Wasting both power
      and CPU for no good reason.
      Reported-and-tested-by: NAlexander Beregalov <a.beregalov@gmail.com>
      Reported-and-tested-by: NSitsofe 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: NLinus Torvalds <torvalds@linux-foundation.org>
      a5660b41
  5. 31 3月, 2011 4 次提交
  6. 30 3月, 2011 2 次提交
  7. 29 3月, 2011 1 次提交
  8. 26 3月, 2011 1 次提交
  9. 25 3月, 2011 1 次提交
  10. 24 3月, 2011 1 次提交
  11. 23 3月, 2011 1 次提交
    • L
      tty: stop using "delayed_work" in the tty layer · f23eb2b2
      Linus Torvalds 提交于
      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: NJef Driesen <jefdriesen@telenet.be>
      Acked-by: NGreg KH <gregkh@suse.de>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f23eb2b2
  12. 16 3月, 2011 1 次提交
    • J
      drivers/serial/ucc_uart.c: Add of_node_put to avoid memory leak · 48a10cdf
      Julia Lawall 提交于
      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:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @r exists@
      local idexpression x;
      expression E,E1,E2;
      statement S;
      @@
      
      *x =
      (of_find_node_by_path
      |of_find_node_by_name
      |of_find_node_by_phandle
      |of_get_parent
      |of_get_next_parent
      |of_get_next_child
      |of_find_compatible_node
      |of_match_node
      |of_find_node_by_type
      |of_find_node_with_property
      |of_find_matching_node
      |of_parse_phandle
      )(...);
      ...
      if (x == NULL) S
      <... when != x = E
      *if (...) {
        ... when != of_node_put(x)
            when != if (...) { ... of_node_put(x); ... }
      (
        return <+...x...+>;
      |
      *  return ...;
      )
      }
      ...>
      (
      E2 = x;
      |
      of_node_put(x);
      )
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Acked-by: NTimur Tabi <timur@freescale.com>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
      48a10cdf
  13. 15 3月, 2011 1 次提交
  14. 10 3月, 2011 4 次提交
    • L
      ARM: 6764/1: pl011: factor out FIFO to TTY code · 29772c4e
      Linus Walleij 提交于
      This piece of code was just slightly different between the DMA
      and IRQ paths, in DMA mode we surely shouldn't read more than
      256 character either, so factor this out in its own function and
      use for both DMA and PIO mode.
      
      Tested on Ux500 and U300.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      29772c4e
    • L
      ARM: 6763/1: pl011: add optional RX DMA to PL011 v2 · ead76f32
      Linus Walleij 提交于
      This adds an optional RX DMA codepath for the devices that
      support this by using the apropriate burst sizes instead of
      pulling single bytes.
      
      Includes portions of code written by Russell King during
      a PL08x hacking session.
      
      This has been tested on U300 and Ux500.
      Tested-by: NJerzy Kasenberg <jerzy.kasenberg@tieto.com>
      Tested-by: NGrzegorz Sygieda <grzegorz.sygieda@tieto.com>
      Tested-by: NMarcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
      Signed-off-by: NPer Forlin <per.friden@stericsson.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ead76f32
    • K
      xen/hvc: Disable probe_irq_on/off from poking the hvc-console IRQ line. · bbd5a762
      Konrad Rzeszutek Wilk 提交于
      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
      ..snip..
      [    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
      	probe_irq_off(probe_irq_on())
           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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      bbd5a762
    • E
      n_gsm: fix UIH control byte : P bit should be 0 · ed43b47b
      Eric Bénard 提交于
      * the GSM 07.10 specification says in 5.4.3.1 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: NEric Bénard <eric@eukrea.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ed43b47b
  15. 08 3月, 2011 2 次提交
    • M
      serial: msm_serial_hs: Add MSM high speed UART driver · 55046237
      Mayank Rana 提交于
      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:
      http://android.git.kernel.org/?p=kernel/experimental.git
      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: NSankalp Bose <sankalpb@codeaurora.org>
      Signed-off-by: NMayank Rana <mrana@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55046237
    • X
      tty_audit: fix tty_audit_add_data live lock on audit disabled · 00bff392
      Xiaotian Feng 提交于
      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)
                              tty_audit_buf_push_current(buf);
              } 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: NAlexander Viro <aviro@redhat.com>
      Signed-off-by: NXiaotian Feng <dfeng@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      00bff392
  16. 04 3月, 2011 1 次提交
    • A
      serial: sh-sci: fix deadlock when resuming from S3 sleep · 36003386
      Alexandre Courbot 提交于
      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
      disabled.
      
      This patch ensures that clocks are enabled when ports registers are
      manipulated within sci_set_termios.
      Signed-off-by: NAlexandre Courbot <gnurou@gmail.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      36003386
  17. 02 3月, 2011 4 次提交
    • B
      powerpc/pseries: Reduce HVCS driver insanity · c7704d35
      Benjamin Herrenschmidt 提交于
      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: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c7704d35
    • A
      drivers: remove extraneous includes of smp_lock.h · 5edc3413
      Arnd Bergmann 提交于
      These were missed the last time I cleaned this up
      globally, because of code moving around or new code
      getting merged.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      5edc3413
    • T
      tty: serial: altera_jtaguart: Add device tree support · 9f15444f
      Tobias Klauser 提交于
      Advertise the possibility to use this driver with device tree if
      CONFIG_OF is set.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      9f15444f
    • T
      tty: serial: altera_uart: Add devicetree support · 7c9325d7
      Tobias Klauser 提交于
      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: NTobias Klauser <tklauser@distanz.ch>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      7c9325d7
  18. 01 3月, 2011 3 次提交
  19. 26 2月, 2011 2 次提交
  20. 24 2月, 2011 1 次提交
  21. 23 2月, 2011 3 次提交