1. 03 8月, 2011 6 次提交
    • H
      HWPoison: add memory_failure_queue() · ea8f5fb8
      Huang Ying 提交于
      memory_failure() is the entry point for HWPoison memory error
      recovery.  It must be called in process context.  But commonly
      hardware memory errors are notified via MCE or NMI, so some delayed
      execution mechanism must be used.  In MCE handler, a work queue + ring
      buffer mechanism is used.
      
      In addition to MCE, now APEI (ACPI Platform Error Interface) GHES
      (Generic Hardware Error Source) can be used to report memory errors
      too.  To add support to APEI GHES memory recovery, a mechanism similar
      to that of MCE is implemented.  memory_failure_queue() is the new
      entry point that can be called in IRQ context.  The next step is to
      make MCE handler uses this interface too.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ea8f5fb8
    • H
      ACPI, APEI, GHES, Error records content based throttle · 152cef40
      Huang Ying 提交于
      printk is used by GHES to report hardware errors.  Ratelimit is
      enforced on the printk to avoid too many hardware error reports in
      kernel log.  Because there may be thousands or even millions of
      corrected hardware errors during system running.
      
      Currently, a simple scheme is used.  That is, the total number of
      hardware error reporting is ratelimited.  This may cause some issues
      in practice.
      
      For example, there are two kinds of hardware errors occurred in
      system.  One is corrected memory error, because the fault memory
      address is accessed frequently, there may be hundreds error report
      per-second.  The other is corrected PCIe AER error, it will be
      reported once per-second.  Because they share one ratelimit control
      structure, it is highly possible that only memory error is reported.
      
      To avoid the above issue, an error record content based throttle
      algorithm is implemented in the patch.  Where after the first
      successful reporting, all error records that are same are throttled for
      some time, to let other kinds of error records have the opportunity to
      be reported.
      
      In above example, the memory errors will be throttled for some time,
      after being printked.  Then the PCIe AER error will be printked
      successfully.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      152cef40
    • H
      ACPI, APEI, GHES, printk support for recoverable error via NMI · 67eb2e99
      Huang Ying 提交于
      Some APEI GHES recoverable errors are reported via NMI, but printk is
      not safe in NMI context.
      
      To solve the issue, a lock-less memory allocator is used to allocate
      memory in NMI handler, save the error record into the allocated
      memory, put the error record into a lock-less list.  On the other
      hand, an irq_work is used to delay the operation from NMI context to
      IRQ context.  The irq_work IRQ handler will remove nodes from
      lock-less list, printk the error record and do some further processing
      include recovery operation, then free the memory.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      67eb2e99
    • H
      lib, Make gen_pool memory allocator lockless · 7f184275
      Huang Ying 提交于
      This version of the gen_pool memory allocator supports lockless
      operation.
      
      This makes it safe to use in NMI handlers and other special
      unblockable contexts that could otherwise deadlock on locks.  This is
      implemented by using atomic operations and retries on any conflicts.
      The disadvantage is that there may be livelocks in extreme cases.  For
      better scalability, one gen_pool allocator can be used for each CPU.
      
      The lockless operation only works if there is enough memory available.
      If new memory is added to the pool a lock has to be still taken.  So
      any user relying on locklessness has to ensure that sufficient memory
      is preallocated.
      
      The basic atomic operation of this allocator is cmpxchg on long.  On
      architectures that don't have NMI-safe cmpxchg implementation, the
      allocator can NOT be used in NMI handler.  So code uses the allocator
      in NMI handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Reviewed-by: NAndi Kleen <ak@linux.intel.com>
      Reviewed-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      7f184275
    • H
      lib, Add lock-less NULL terminated single list · f49f23ab
      Huang Ying 提交于
      Cmpxchg is used to implement adding new entry to the list, deleting
      all entries from the list, deleting first entry of the list and some
      other operations.
      
      Because this is a single list, so the tail can not be accessed in O(1).
      
      If there are multiple producers and multiple consumers, llist_add can
      be used in producers and llist_del_all can be used in consumers.  They
      can work simultaneously without lock.  But llist_del_first can not be
      used here.  Because llist_del_first depends on list->first->next does
      not changed if list->first is not changed during its operation, but
      llist_del_first, llist_add, llist_add (or llist_del_all, llist_add,
      llist_add) sequence in another consumer may violate that.
      
      If there are multiple producers and one consumer, llist_add can be
      used in producers and llist_del_all or llist_del_first can be used in
      the consumer.
      
      This can be summarized as follow:
      
                 |   add    | del_first |  del_all
       add       |    -     |     -     |     -
       del_first |          |     L     |     L
       del_all   |          |           |     -
      
      Where "-" stands for no lock is needed, while "L" stands for lock is
      needed.
      
      The list entries deleted via llist_del_all can be traversed with
      traversing function such as llist_for_each etc.  But the list entries
      can not be traversed safely before deleted from the list.  The order
      of deleted entries is from the newest to the oldest added one.  If you
      want to traverse from the oldest to the newest, you must reverse the
      order by yourself before traversing.
      
      The basic atomic operation of this list is cmpxchg on long.  On
      architectures that don't have NMI-safe cmpxchg implementation, the
      list can NOT be used in NMI handler.  So code uses the list in NMI
      handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Reviewed-by: NAndi Kleen <ak@linux.intel.com>
      Reviewed-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      f49f23ab
    • H
      Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG · df013ffb
      Huang Ying 提交于
      cmpxchg() is widely used by lockless code, including NMI-safe lockless
      code.  But on some architectures, the cmpxchg() implementation is not
      NMI-safe, on these architectures the lockless code may need a
      spin_trylock_irqsave() based implementation.
      
      This patch adds a Kconfig option: ARCH_HAVE_NMI_SAFE_CMPXCHG, so that
      NMI-safe lockless code can depend on it or provide different
      implementation according to it.
      
      On many architectures, cmpxchg is only NMI-safe for several specific
      operand sizes. So, ARCH_HAVE_NMI_SAFE_CMPXCHG define in this patch
      only guarantees cmpxchg is NMI-safe for sizeof(unsigned long).
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      Acked-by: NPaul Mundt <lethal@linux-sh.org>
      Acked-by: NHans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NRichard Henderson <rth@twiddle.net>
      CC: Mikael Starvik <starvik@axis.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      CC: Yoshinori Sato <ysato@users.sourceforge.jp>
      CC: Tony Luck <tony.luck@intel.com>
      CC: Hirokazu Takata <takata@linux-m32r.org>
      CC: Geert Uytterhoeven <geert@linux-m68k.org>
      CC: Michal Simek <monstr@monstr.eu>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      CC: Kyle McMartin <kyle@mcmartin.ca>
      CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
      CC: Chen Liqin <liqin.chen@sunplusct.com>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Ingo Molnar <mingo@redhat.com>
      CC: Chris Zankel <chris@zankel.net>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      df013ffb
  2. 14 7月, 2011 10 次提交
  3. 13 7月, 2011 4 次提交
  4. 12 7月, 2011 16 次提交
  5. 11 7月, 2011 4 次提交
    • E
      hp-wmi: fix use after free · 0401846c
      Eric Dumazet 提交于
      [  191.310008] WARNING: kmemcheck: Caught 32-bit read from freed memory (f0d25f14)
      [  191.310011] c056d2f088000000105fd2f00000000050415353040000000000000000000000
      [  191.310020]  i i i i f f f f f f f f f f f f f f f f f f f f f f f f f f f f
      [  191.310027]                                          ^
      [  191.310029]
      [  191.310032] Pid: 737, comm: modprobe Not tainted 3.0.0-rc5+ #268 Hewlett-Packard HP Compaq 6005 Pro SFF PC/3047h
      [  191.310036] EIP: 0060:[<f80b3104>] EFLAGS: 00010286 CPU: 0
      [  191.310039] EIP is at hp_wmi_perform_query+0x104/0x150 [hp_wmi]
      [  191.310041] EAX: f0d25601 EBX: f0d25f00 ECX: 000121cf EDX: 000121ce
      [  191.310043] ESI: f0d25f10 EDI: f0f97ea8 EBP: f0f97ec4 ESP: c173f34c
      [  191.310045]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      [  191.310046] CR0: 8005003b CR2: f540c000 CR3: 30f30000 CR4: 000006d0
      [  191.310048] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
      [  191.310050] DR6: ffff4ff0 DR7: 00000400
      [  191.310051]  [<f80b317b>] hp_wmi_dock_state+0x2b/0x40 [hp_wmi]
      [  191.310054]  [<f80b6093>] hp_wmi_init+0x93/0x1a8 [hp_wmi]
      [  191.310057]  [<c10011f0>] do_one_initcall+0x30/0x170
      [  191.310061]  [<c107ab9f>] sys_init_module+0xef/0x1a60
      [  191.310064]  [<c149f998>] sysenter_do_call+0x12/0x28
      [  191.310067]  [<ffffffff>] 0xffffffff
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      0401846c
    • J
      dell-laptop - using buffer without mutex_lock · b486742a
      Jose Alonso 提交于
      Using buffer->output[1] without mutex_lock()
      Signed-off-by: NJose Alonso <joalonsof@gmail.com>
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      b486742a
    • K
      Revert: "dell-laptop: Toggle the unsupported hardware killswitch" · be65dde8
      Keng-Yu Lin 提交于
      This reverts commit a3d77411,
      
      as it causes a mess in the wireless rfkill status on some models.
      It is probably a bad idea to toggle the rfkill for all dell models
      without the respect to the claim that it is hardware-controlled.
      
      Cc: stable@kernel.org
      Signed-off-by: NKeng-Yu Lin <kengyu@canonical.com>
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      be65dde8
    • C
      PM: Reintroduce dropped call to check_wakeup_irqs · 88759622
      Colin Cross 提交于
      Patch 2e711c04
      (PM: Remove sysdev suspend, resume and shutdown operations)
      deleted sysdev_suspend(), which was being relied on to call
      check_wakeup_irqs() in suspend.  If check_wakeup_irqs() is not
      called, wake interrupts that are pending when suspend is
      entered may be lost.  It also breaks IRQCHIP_MASK_ON_SUSPEND,
      which is handled in check_wakeup_irqs().
      
      This patch adds a call to check_wakeup_irqs() in syscore_suspend(),
      similar to what was deleted in sysdev_suspend().
      Signed-off-by: NColin Cross <ccross@android.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      88759622