APEI patches for Linux 3.1
Len Brown
reviewerPATCH 1/1 APEI patches for Linux 3.1
Hi Linus,
please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.git apei-release
This will update the files shown below.
thanks!
Len Brown
Intel Open Source Technology Center
ps. individual patches are available on [email protected]
Documentation/acpi/apei/einj.txt | 11 +- arch/Kconfig | 3 + arch/alpha/Kconfig | 1 + arch/avr32/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/apei/Kconfig | 11 +- drivers/acpi/apei/apei-base.c | 35 +++- drivers/acpi/apei/apei-internal.h | 15 ++- drivers/acpi/apei/einj.c | 43 +++-- drivers/acpi/apei/erst-dbg.c | 6 +- drivers/acpi/apei/erst.c | 12 +- drivers/acpi/apei/ghes.c | 431 ++++++++++++++++++++++++++++++++++--- drivers/acpi/apei/hest.c | 17 +- drivers/acpi/bus.c | 14 +- include/acpi/apei.h | 5 + include/linux/acpi.h | 2 + include/linux/bitmap.h | 1 + include/linux/genalloc.h | 34 +++- include/linux/llist.h | 126 +++++++++++ include/linux/mm.h | 1 + lib/Kconfig | 3 + lib/Makefile | 2 + lib/bitmap.c | 2 - lib/genalloc.c | 300 +++++++++++++++++++++----- lib/llist.c | 129 +++++++++++ mm/memory-failure.c | 92 ++++++++ 35 files changed, 1172 insertions(+), 135 deletions(-) create mode 100644 include/linux/llist.h create mode 100644 lib/llist.c
through these commits:
Chen Gong (1):
ACPI, APEI, ERST, Fix erst-dbg long record reading issue
Huang Ying (16):
ACPI, APEI, ERST, Prevent erst_dbg from loading if ERST is disabled ACPI, APEI, GHES, Do not ratelimit fatal error printk before panic ACPI, APEI, Add apei_exec_run_optional
ACPI, APEI, Use apei_exec_run_optional in APEI EINJ and ERST ACPI, APEI, GHES, Prevent GHES to be built as module ACPI, APEI, GHES, Support disable GHES at boot time ACPI, APEI, Add APEI bit support in generic _OSC call ACPI, APEI, Add WHEA _OSC support
Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG
lib, Add lock-less NULL terminated single list
lib, Make gen_pool memory allocator lockless
ACPI, APEI, GHES, printk support for recoverable error via NMI ACPI, APEI, GHES, Error records content based throttle
HWPoison: add memory_failure_queue()
ACPI, APEI, GHES: Add hardware memory error recovery support ACPI, APEI, EINJ Param support is disabled by default
Len Brown (2):
ACPI: APEI build fix
APEI GHES: 32-bit buildfix
with this log:
commit d0e323b47057f4492b8fa22345f38d80a469bf8d
Merge: c027a47 c3e6088
Author: Len Brown <[email protected]>
Date: Wed Aug 3 11:30:42 2011 -0400
Merge branch 'apei' into apei-release
Some trivial conflicts due to other various merges adding to the end of common lists sooner than this one.
arch/ia64/Kconfig
arch/powerpc/Kconfig
arch/x86/Kconfig
lib/Kconfig
lib/Makefile
commit c3e6088e1036f8084bc7444b38437da136b7588b
Author: Huang Ying <[email protected]> Date: Wed Jul 20 16:09:29 2011 +0800
ACPI, APEI, EINJ Param support is disabled by default
EINJ parameter support is only usable for some specific BIOS. Originally, it is expected to have no harm for BIOS does not support it. But now, we found it will cause issue (memory overwriting) for some BIOS. So param support is disabled by default and only enabled when newly added module parameter named "param_extension" is explicitly specified.
commit 70cb6e1da00db6c9212e6fd69bd96fd41c797077
Author: Len Brown <[email protected]> Date: Tue Aug 2 18:00:21 2011 -0400
APEI GHES: 32-bit buildfix
drivers/acpi/apei/ghes.c:542: warning: integer overflow in expression drivers/acpi/apei/ghes.c:619: warning: integer overflow in expression
ghes.c:(.text+0x46289): undefined reference to `__udivdi3' in function ghes_estatus_cache_add().
commit a7e09d450b2e0b068e850d103b6ee1af537d1910
Author: Len Brown <[email protected]> Date: Sat Jul 16 18:14:21 2011 -0400
ACPI: APEI build fix
as GHES is optional...
When # CONFIG_ACPI_APEI_GHES is not set:
(.init.text+0x4c22): undefined reference to `ghes_disable'
commit ba61ca4aab47441f1c6cec28a9a6aa0489fd1df3
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:28 2011 +0800
ACPI, APEI, GHES: Add hardware memory error recovery support
memory_failure_queue() is called when recoverable memory errors are notified by firmware to do the recovery work.
commit ea8f5fb8a71fddaf5f3a17100d3247855701f732
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:27 2011 +0800
HWPoison: add memory_failure_queue()
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.
commit 152cef40a808d3034e383465b3f7d6783613e458
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:26 2011 +0800
ACPI, APEI, GHES, Error records content based throttle
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.
commit 67eb2e99076708cc790019a6a08ca3e0ae130a3a
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:25 2011 +0800
ACPI, APEI, GHES, printk support for recoverable error via NMI
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.
commit 7f184275aa306046fe7edcbef3229754f0d97402
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:24 2011 +0800
lib, Make gen_pool memory allocator lockless
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.
commit f49f23abf3dd786ddcac1c1e7db3c2013b07413f
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:23 2011 +0800
lib, Add lock-less NULL terminated single list
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.
commit df013ffb8119c89f062ab05b7f544704315db47b
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:22 2011 +0800
Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG
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).
commit 9fb0bfe1408d5506b7b83d13d1eed573fd71d67d
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:21 2011 +0800
ACPI, APEI, Add WHEA _OSC support
APEI firmware first mode must be turned on explicitly on some machines, otherwise there may be no GHES hardware error record for hardware error notification. APEI bit in generic _OSC call can be used to do that, but on some machine, a special WHEA _OSC call must be used. This patch adds the support to that WHEA _OSC call.
commit eccddd32ced0df8f9130024157bf8d37df860d76
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:20 2011 +0800
ACPI, APEI, Add APEI bit support in generic _OSC call
In APEI firmware first mode, hardware error is reported by hardware to firmware firstly, then firmware reports the error to Linux in a GHES error record via POLL/SCI/IRQ/NMI etc.
This may result in some issues if OS has no full APEI support. So some firmware implementation will work in a back-compatible mode by default. Where firmware will only notify OS in old-fashion, without GHES record. For example, for a fatal hardware error, only NMI is signaled, no GHES record.
To gain full APEI power on these machines, APEI bit in generic _OSC call can be specified to tell firmware that Linux has full APEI support. This patch adds the APEI bit support in generic _OSC call.
commit b6a9501658530d8b8374e37f1edb549039a8a260
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:19 2011 +0800
ACPI, APEI, GHES, Support disable GHES at boot time
Some machine may have broken firmware so that GHES and firmware first mode should be disabled. This patch adds support to that.
commit 86cd47334b00b6aa9b5d0ebf389a6fe76f21c641
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:18 2011 +0800
ACPI, APEI, GHES, Prevent GHES to be built as module
GHES (Generic Hardware Error Source) is used to process hardware error notification in firmware first mode. But because firmware first mode can be turned on but can not be turned off, it is unreasonable to unload the GHES module with firmware first mode turned on. To avoid confusion, this patch makes GHES can be enabled/disabled in configuration time, but not built as module and unloaded at run time.
commit 392913de7cc7446531922f29c0a4382d8d09626c
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:17 2011 +0800
ACPI, APEI, Use apei_exec_run_optional in APEI EINJ and ERST
This patch changes APEI EINJ and ERST to use apei_exec_run for mandatory actions, and apei_exec_run_optional for optional actions.
commit eecf2f7124834dd1cad21807526a8ea031ba8217
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:16 2011 +0800
ACPI, APEI, Add apei_exec_run_optional
Some actions in APEI ERST and EINJ tables are optional, for example, ACPI_EINJ_BEGIN_OPERATION action is used to do some preparation for error injection, and firmware may choose to do nothing here. While some other actions are mandatory, for example, firmware must provide ACPI_EINJ_GET_ERROR_TYPE implementation.
Original implementation treats all actions as optional (that is, can have no instructions), that may cause issue if firmware does not provide some mandatory actions. To fix this, this patch adds apei_exec_run_optional, which should be used for optional actions. The original apei_exec_run should be used for mandatory actions.
commit 5588340d46a484da53bbce8136184d9c7fbc259c
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:15 2011 +0800
ACPI, APEI, GHES, Do not ratelimit fatal error printk before panic
printk is used by GHES to report hardware errors. Normally, the printk will be ratelimited 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.
That is different for fatal hardware error, because system will go panic as soon as possible, there will be no more than several error records. And these error records are valuable for system fault diagnosis, so they should not be ratelimited.
commit d37afc50e618271839f001ea653949eefc728167
Author: Chen Gong <[email protected]> Date: Wed Jul 13 13:14:14 2011 +0800
ACPI, APEI, ERST, Fix erst-dbg long record reading issue
When we debug ERST table with erst-dbg, if the error record in ERST table is too long(>4K), it can't be read out. So this patch increases the buffer size to 16K to ensure such error records can be read from ERST table.
commit ca7cc5110a313a609da40ae948978a585352564b
Author: Huang Ying <[email protected]> Date: Wed Jul 13 13:14:13 2011 +0800
ACPI, APEI, ERST, Prevent erst_dbg from loading if ERST is disabled
erst_dbg module can not work when ERST is disabled. So disable module loading to provide clearer information to user.
Len Brown
reviewerQuoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.gitapei-release
typo fixed -- the real tree is here
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git apei-release
Quoted 4 lines · Len Brown
please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.gitapei-release
Hmm:
fatal: Couldn't find remote ref apei-release
Forgot yo push?
Linus
Quoted 3 lines · Linus Torvalds
fatal: Couldn't find remote ref apei-release
Forgot yo push?
Looks like he pushed to the wrong tree. There is a 3 hour old apei-release branch here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git
apei-release
-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · On Wed, 3 Aug 2011 12:10:14 -0700 Tony Luck wrote:
Quoted 3 lines · Linus Torvalds
fatal: Couldn't find remote ref apei-release
Forgot yo push?
Looks like he pushed to the wrong tree. There is a 3 hour old apei-release branch here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git
apei-release
Len did send a follow-up (correction) email that said:
typo fixed -- the real tree is here
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git apei-release
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code *** --
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Len Brown
reviewerQuoted 8 lines
Quoted 2 lines
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.gitapei-releaseHmm:
fatal: Couldn't find remote ref apei-release
Forgot yo push?
Push went here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git apei-release
I fat-fingered the update to my script that formated the pull-request message.
thanks,
-Len
Quoted 4 lines · Len Brown
Push went here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.gitapei-release
No it didn't.
Apparently it went into linux-idle.
Christ, Len. You send me *two* bogus pull requests, and all your pull requests come in at the very end of the merge cycle, when I very clearly asked people to try hard to avoid that since I'm supposed to be on vacation.
And several of those commits are from today, and cannot have had any testing.
In short: even though Tony told me where to look, I'm not seeing any reason to pull this thing. The merge window is not for development, and you're simply not making me get the warm and fuzzies about this late pull request.
Linus
Hi, Linus,
Quoted 15 lines · Linus Torvalds
Quoted 4 lines · Len Brown
Push went here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.gitapei-releaseNo it didn't.
Apparently it went into linux-idle.
Christ, Len. You send me *two* bogus pull requests, and all your pull requests come in at the very end of the merge cycle, when I very clearly asked people to try hard to avoid that since I'm supposed to be on vacation.
Quoted 6 lines
And several of those commits are from today, and cannot have had any testing.
In short: even though Tony told me where to look, I'm not seeing any reason to pull this thing. The merge window is not for development, and you're simply not making me get the warm and fuzzies about this late pull request.
Most APEI patches have been in
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git test
since July 13th, and have been in linux-next since then. I think Len just re-apply these patches in linux-idle tree.
Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 25 lines · On Thu, 4 Aug 2011 09:10:09 +0800 huang ying <[email protected]>…
Quoted 15 lines · Linus Torvalds
Quoted 4 lines · Len Brown
Push went here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.gitapei-releaseNo it didn't.
Apparently it went into linux-idle.
Christ, Len. You send me *two* bogus pull requests, and all your pull requests come in at the very end of the merge cycle, when I very clearly asked people to try hard to avoid that since I'm supposed to be on vacation.
Quoted 6 lines
And several of those commits are from today, and cannot have had any testing.
In short: even though Tony told me where to look, I'm not seeing any reason to pull this thing. The merge window is not for development, and you're simply not making me get the warm and fuzzies about this late pull request.
Quoted 6 lines
Most APEI patches have been in
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.gittestsince July 13th, and have been in linux-next since then. I think Len just re-apply these patches in linux-idle tree.
The same sequence of commits appear in my acpi tree (the last 3 and the origin merge since yesterday, the rest since July 16).
Linus, if you compare commit d7bdc8399c3c ("Merge branch 'apei' into apei-release") from Len's acpi tree to the apei-release branch from the idle tree, then you will see what I mean.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Len Brown
reviewerQuoted 4 lines · Linus Torvalds
...I'm not seeing any
reason to pull this thing. The merge window is not for development, and you're simply not making me get the warm and fuzzies about this late pull request.
I appologize for the the multiple late pull requests.
I was off the grid for a vacation and returned too late to be early.
I split APEI onto its own branch and I doubly botched it -- both in the .git/remotes file and in the script pointing to the repo... I guess the good news is the next time I run the script it will be correct:-)
Please judge apei-release on its own merits rather than the sloppily-addressed envelope I sent it in on Wednesday. I know it isn't a capability that you use, but for the enterprise folks that need it, this batch is an improvement over Linux 3.0.
The code hasn't changed much in months -- most of it was ready for the 3.0 merge window. There were a couple of build fixes recently based-on linux-next feedback, and I also re-based to add more "Acked-by" notations. Finally, I merged it up to your tree so you'd not be irritated with trivial but annoying text merge conflicts on your vacation. (typical case of multiple people appending to shared lists in Kconfig files, if you're interested)
FWIW, I've built 200 x86_64 kernels and 393 i386 kernels and booted on both architectures on multiple machines. Though I don't have the capability to verify correctness of the the APEI features, and must rely on Ying for that.
please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git apei-release
thanks,
-Len