1. 28 10月, 2015 5 次提交
  2. 17 10月, 2015 1 次提交
    • P
      cpufreq: intel_pstate: Fix intel_pstate powersave min_perf_pct value · 51443fbf
      Prarit Bhargava 提交于
      On systems that initialize the intel_pstate driver with the performance
      governor, and then switch to the powersave governor will not transition to
      lower cpu frequencies until /sys/devices/system/cpu/intel_pstate/min_perf_pct
      is set to a low value.
      
      The behavior of governor switching changed after commit a0475992
      ("[cpufreq] intel_pstate: honor user space min_perf_pct override on
       resume").  The commit introduced tracking of performance percentage
      changes via sysfs in order to restore userspace changes during
      suspend/resume.  The problem occurs because the global values of the newly
      introduced max_sysfs_pct and min_sysfs_pct are not lowered on the governor
      change and this causes the powersave governor to inherit the performance
      governor's settings.
      
      A simple change would have been to reset max_sysfs_pct to 100 and
      min_sysfs_pct to 0 on a governor change, which fixes the problem with
      governor switching.  However, since we cannot break userspace[1] the fix
      is now to give each governor its own limits storage area so that governor
      specific changes are tracked.
      
      I successfully tested this by booting with both the performance governor
      and the powersave governor by default, and switching between the two
      governors (while monitoring /sys/devices/system/cpu/intel_pstate/ values,
      and looking at the output of cpupower frequency-info).  Suspend/Resume
      testing was performed by Doug Smythies.
      
      [1] Systems which suspend/resume using the unmaintained pm-utils package
      will always transition to the performance governor before the suspend and
      after the resume.  This means a system using the powersave governor will
      go from powersave to performance, then suspend/resume, performance to
      powersave.  The simple change during governor changes would have been
      overwritten when the governor changed before and after the suspend/resume.
      I have submitted https://bugzilla.redhat.com/show_bug.cgi?id=1271225
      against Fedora to remove the 94cpufreq file that causes the problem.  It
      should be noted that pm-utils is obsoleted with newer versions of systemd.
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Acked-by: NKristen Carlson Accardi <kristen@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      51443fbf
  3. 16 10月, 2015 1 次提交
  4. 15 10月, 2015 4 次提交
  5. 14 10月, 2015 1 次提交
  6. 10 10月, 2015 1 次提交
  7. 09 10月, 2015 9 次提交
  8. 08 10月, 2015 3 次提交
  9. 07 10月, 2015 1 次提交
  10. 06 10月, 2015 1 次提交
  11. 05 10月, 2015 11 次提交
    • A
      mcb: Fix error handling in mcb_pci_probe() · 41ada9df
      Alexey Khoroshilov 提交于
      If a MCB PCI Carrier device is IO mapped insted of memory-mapped,
      the memory of the PCI device is still not unmapped.
      
      Also the patch adds deallocation of the bus
      if chameleon_parse_cells() fails.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: NAlexey Khoroshilov <khoroshilov@ispras.ru>
      Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41ada9df
    • C
      staging: speakup: fix speakup-r regression · b1d562ac
      covici@ccs.covici.com 提交于
      Here is a patch to make speakup-r work again.
      
      It broke in 3.6 due to commit 4369c64c
      "Input: Send events one packet at a time)
      
      The problem was that the fakekey.c routine to fake a down arrow no
      longer functioned properly and putting the input_sync fixed it.
      
      Fixes: 4369c64c
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
      Signed-off-by: NJohn Covici <covici@ccs.covici.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1d562ac
    • J
      drivers/tty: require read access for controlling terminal · 0c556271
      Jann Horn 提交于
      This is mostly a hardening fix, given that write-only access to other
      users' ttys is usually only given through setgid tty executables.
      Signed-off-by: NJann Horn <jann@thejh.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c556271
    • M
      serial: 8250: add uart_config entry for PORT_RT2880 · 3c5a0357
      Mans Rullgard 提交于
      This adds an entry to the uart_config table for PORT_RT2880
      enabling rx/tx FIFOs.  The UART is actually a Palmchip BK-3103
      which is found in several devices from Alchemy/RMI, Ralink, and
      Sigma Designs.
      Signed-off-by: NMans Rullgard <mans@mansr.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c5a0357
    • D
      tty: fix data race on tty_buffer.commit · facd885c
      Dmitry Vyukov 提交于
      Race on buffer data happens when newly committed data is
      picked up by an old flush work in the following scenario:
      __tty_buffer_request_room does a plain write of tail->commit,
      no barriers were executed before that.
      At this point flush_to_ldisc reads this new value of commit,
      and reads buffer data, no barriers in between.
      The committed buffer data is not necessary visible to flush_to_ldisc.
      
      Similar bug happens when tty_schedule_flip commits data.
      
      Update commit with smp_store_release and read commit with
      smp_load_acquire, as it is commit that signals data readiness.
      This is orthogonal to the existing synchronization on tty_buffer.next,
      which is required to not dismiss a buffer with unconsumed data.
      
      The data race was found with KernelThreadSanitizer (KTSAN).
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      facd885c
    • D
      tty: fix data race in tty_buffer_flush · 9e6b7cd7
      Dmitry Vyukov 提交于
      tty_buffer_flush frees not acquired buffers.
      As the result, for example, read of b->size in tty_buffer_free
      can return garbage value which will lead to a huge buffer
      hanging in the freelist. This is just the benignest
      manifestation of freeing of a not acquired object.
      If the object is passed to kfree, heap can be corrupted.
      
      Acquire visibility over the buffer before freeing it.
      
      The data race was found with KernelThreadSanitizer (KTSAN).
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e6b7cd7
    • D
      tty: fix data race in flush_to_ldisc · 7098296a
      Dmitry Vyukov 提交于
      flush_to_ldisc reads port->itty and checks that it is not NULL,
      concurrently release_tty sets port->itty to NULL. It is possible
      that flush_to_ldisc loads port->itty once, ensures that it is
      not NULL, but then reloads it again and uses. The second load
      can already return NULL, which will cause a crash.
      
      Use READ_ONCE to read port->itty.
      
      The data race was found with KernelThreadSanitizer (KTSAN).
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7098296a
    • K
      tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c · e81107d4
      Kosuke Tatsukawa 提交于
      My colleague ran into a program stall on a x86_64 server, where
      n_tty_read() was waiting for data even if there was data in the buffer
      in the pty.  kernel stack for the stuck process looks like below.
       #0 [ffff88303d107b58] __schedule at ffffffff815c4b20
       #1 [ffff88303d107bd0] schedule at ffffffff815c513e
       #2 [ffff88303d107bf0] schedule_timeout at ffffffff815c7818
       #3 [ffff88303d107ca0] wait_woken at ffffffff81096bd2
       #4 [ffff88303d107ce0] n_tty_read at ffffffff8136fa23
       #5 [ffff88303d107dd0] tty_read at ffffffff81368013
       #6 [ffff88303d107e20] __vfs_read at ffffffff811a3704
       #7 [ffff88303d107ec0] vfs_read at ffffffff811a3a57
       #8 [ffff88303d107f00] sys_read at ffffffff811a4306
       #9 [ffff88303d107f50] entry_SYSCALL_64_fastpath at ffffffff815c86d7
      
      There seems to be two problems causing this issue.
      
      First, in drivers/tty/n_tty.c, __receive_buf() stores the data and
      updates ldata->commit_head using smp_store_release() and then checks
      the wait queue using waitqueue_active().  However, since there is no
      memory barrier, __receive_buf() could return without calling
      wake_up_interactive_poll(), and at the same time, n_tty_read() could
      start to wait in wait_woken() as in the following chart.
      
              __receive_buf()                         n_tty_read()
      ------------------------------------------------------------------------
      if (waitqueue_active(&tty->read_wait))
      /* Memory operations issued after the
         RELEASE may be completed before the
         RELEASE operation has completed */
                                              add_wait_queue(&tty->read_wait, &wait);
                                              ...
                                              if (!input_available_p(tty, 0)) {
      smp_store_release(&ldata->commit_head,
                        ldata->read_head);
                                              ...
                                              timeout = wait_woken(&wait,
                                                TASK_INTERRUPTIBLE, timeout);
      ------------------------------------------------------------------------
      
      The second problem is that n_tty_read() also lacks a memory barrier
      call and could also cause __receive_buf() to return without calling
      wake_up_interactive_poll(), and n_tty_read() to wait in wait_woken()
      as in the chart below.
      
              __receive_buf()                         n_tty_read()
      ------------------------------------------------------------------------
                                              spin_lock_irqsave(&q->lock, flags);
                                              /* from add_wait_queue() */
                                              ...
                                              if (!input_available_p(tty, 0)) {
                                              /* Memory operations issued after the
                                                 RELEASE may be completed before the
                                                 RELEASE operation has completed */
      smp_store_release(&ldata->commit_head,
                        ldata->read_head);
      if (waitqueue_active(&tty->read_wait))
                                              __add_wait_queue(q, wait);
                                              spin_unlock_irqrestore(&q->lock,flags);
                                              /* from add_wait_queue() */
                                              ...
                                              timeout = wait_woken(&wait,
                                                TASK_INTERRUPTIBLE, timeout);
      ------------------------------------------------------------------------
      
      There are also other places in drivers/tty/n_tty.c which have similar
      calls to waitqueue_active(), so instead of adding many memory barrier
      calls, this patch simply removes the call to waitqueue_active(),
      leaving just wake_up*() behind.
      
      This fixes both problems because, even though the memory access before
      or after the spinlocks in both wake_up*() and add_wait_queue() can
      sneak into the critical section, it cannot go past it and the critical
      section assures that they will be serialized (please see "INTER-CPU
      ACQUIRING BARRIER EFFECTS" in Documentation/memory-barriers.txt for a
      better explanation).  Moreover, the resulting code is much simpler.
      
      Latency measurement using a ping-pong test over a pty doesn't show any
      visible performance drop.
      Signed-off-by: NKosuke Tatsukawa <tatsu@ab.jp.nec.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e81107d4
    • U
      serial: atmel: fix error path of probe function · 8f1bd8f2
      Uwe Kleine-König 提交于
      If atmel_init_gpios fails the port has already been marked as busy (in
      line 2629), so this must be undone in the error path.
      
      This bug was introduced because I created the patch that finally
      became 722ccf41 ("serial: atmel: fix error handling when
      mctrl_gpio_init fails") on top of 3.19 which didn't have commit
      6fbb9bdf ("tty/serial: at91: fix error handling in
      atmel_serial_probe()") yet.
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Fixes: 722ccf41 ("serial: atmel: fix error handling when mctrl_gpio_init fails")
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f1bd8f2
    • L
      tty: don't leak cdev in tty_cdev_add() · c1a752ba
      Leon Yu 提交于
      Commit a3a10ce3 ("Avoid usb reset crashes by making tty_io cdevs truly
      dynamic") which mixes using cdev_alloc() and cdev_init() is problematic.
      Subsequent call to cdev_init() after cdev_alloc() sets kobj release method
      from cdev_dynamic_release() to cdev_default_release() and thus makes it
      impossible to free allocated cdev.
      
      This patch also consolidates error path of cdev_add() as cdev can also leak
      here if things went wrong.
      Signed-off-by: NLeon Yu <chianglungyu@gmail.com>
      Fixes: a3a10ce3 ("Avoid usb reset crashes by making tty_io cdevs truly dynamic")
      Acked-by: NRichard Watts <rrw@kynesim.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1a752ba
    • F
      Revert "serial: imx: remove unbalanced clk_prepare" · 0c727a42
      Fabio Estevam 提交于
      This reverts commit 9e7b399d.
      
      Commit ("9e7b399d") causes the following warning and sometimes
      also hangs the system:
      
      ------------[ cut here ]------------
       WARNING: CPU: 0 PID: 0 at kernel/locking/mutex.c:868 mutex_trylock+0x20c/0x22c()
       DEBUG_LOCKS_WARN_ON(in_interrupt())
       Modules linked in:
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc7-next-20150818-00001-g14418a6 #4
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
      [<80012f08>] (dump_backtrace) from [<800130a4>] (show_stack+0x18/0x1c)
      r6:00000364 r5:00000000 r4:00000000 r3:00000000
      [<8001308c>] (show_stack) from [<807902b8>] (dump_stack+0x88/0xa4)
      [<80790230>] (dump_stack) from [<8002a604>] (warn_slowpath_common+0x80/0xbc)
      r5:807945c4 r4:80ab3b50
      [<8002a584>] (warn_slowpath_common) from [<8002a6e4>] (warn_slowpath_fmt+0x38/0x40)
      r8:00000000 r7:8131100c r6:8054c3cc r5:8131300c r4:80b0a570
      [<8002a6b0>] (warn_slowpath_fmt) from [<807945c4>] (mutex_trylock+0x20c/0x22c)
      r3:8095d0d8 r2:8095ab28
      [<807943b8>] (mutex_trylock) from [<8054c3cc>] (clk_prepare_lock+0x14/0xf4)
      r7:8131100c r6:be3f0c80 r5:00000037 r4:be3f0c80
      [<8054c3b8>] (clk_prepare_lock) from [<8054dbfc>] (clk_prepare+0x18/0x30)
      r5:00000037 r4:be3f0c80
      [<8054dbe4>] (clk_prepare) from [<8036a600>] (imx_console_write+0x30/0x244)
      r4:812d0bc8 r3:8132b9a4
      
      To reproduce the problem we only need to let the board idle for something
      like 30 seconds.
      
      Tested on a imx6q-sabresd.
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Reviewed-by: NEduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c727a42
  12. 04 10月, 2015 2 次提交