€•BŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ/translations/zh_CN/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/zh_TW/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/it_IT/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ja_JP/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ko_KR/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/pt_BR/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/sp_SP/mm/hwpoison”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒhwpoison”h]”hŒhwpoison”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ9/var/lib/git/docbuild/linux/Documentation/mm/hwpoison.rst”h´Kubh¶)”}”(hhh]”(h»)”}”(hŒWhat is hwpoison?”h]”hŒWhat is hwpoison?”…””}”(hhÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhËh²hh³hÊh´KubhŒ paragraph”“”)”}”(hŒÖUpcoming Intel CPUs have support for recovering from some memory errors (``MCA recovery``). This requires the OS to declare a page "poisoned", kill the processes associated with it and avoid using it in the future.”h]”(hŒIUpcoming Intel CPUs have support for recovering from some memory errors (”…””}”(hhÞh²hh³Nh´NubhŒliteral”“”)”}”(hŒ``MCA recovery``”h]”hŒ MCA recovery”…””}”(hhèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhÞubhŒ). This requires the OS to declare a page “poisonedâ€, kill the processes associated with it and avoid using it in the future.”…””}”(hhÞh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhÝ)”}”(hŒ@This patchkit implements the necessary infrastructure in the VM.”h]”hŒ@This patchkit implements the necessary infrastructure in the VM.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hhËh²hubhÝ)”}”(hŒTo quote the overview comment::”h]”hŒTo quote the overview comment:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhŒ literal_block”“”)”}”(hXñHigh level machine check handler. Handles pages reported by the hardware as being corrupted usually due to a 2bit ECC memory or cache failure. This focusses on pages detected as corrupted in the background. When the current CPU tries to consume corruption the currently running process can just be killed directly instead. This implies that if the error cannot be handled for some reason it's safe to just ignore it because no corruption has been consumed yet. Instead when that happens another machine check will happen. Handles page cache pages in various states. The tricky part here is that we can access any page asynchronous to other VM users, because memory failures could happen anytime and anywhere, possibly violating some of their assumptions. This is why this code has to be extremely careful. Generally it tries to use normal locking rules, as in get the standard locks, even if that means the error handling takes potentially a long time. Some of the operations here are somewhat inefficient and have non linear algorithmic complexity, because the data structures have not been optimized for this case. This is in particular the case for the mapping from a vma to a process. Since this case is expected to be rare we hope we can get away with this.”h]”hXñHigh level machine check handler. Handles pages reported by the hardware as being corrupted usually due to a 2bit ECC memory or cache failure. This focusses on pages detected as corrupted in the background. When the current CPU tries to consume corruption the currently running process can just be killed directly instead. This implies that if the error cannot be handled for some reason it's safe to just ignore it because no corruption has been consumed yet. Instead when that happens another machine check will happen. Handles page cache pages in various states. The tricky part here is that we can access any page asynchronous to other VM users, because memory failures could happen anytime and anywhere, possibly violating some of their assumptions. This is why this code has to be extremely careful. Generally it tries to use normal locking rules, as in get the standard locks, even if that means the error handling takes potentially a long time. Some of the operations here are somewhat inefficient and have non linear algorithmic complexity, because the data structures have not been optimized for this case. This is in particular the case for the mapping from a vma to a process. Since this case is expected to be rare we hope we can get away with this.”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jh³hÊh´KhhËh²hubhÝ)”}”(hŒThe code consists of the high level handler in mm/memory-failure.c, a new page poison bit and various checks in the VM to handle poisoned pages.”h]”hŒThe code consists of the high level handler in mm/memory-failure.c, a new page poison bit and various checks in the VM to handle poisoned pages.”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K)hhËh²hubhÝ)”}”(hŒ„The main target right now is KVM guests, but it works for all kinds of applications. KVM support requires a recent qemu-kvm release.”h]”hŒ„The main target right now is KVM guests, but it works for all kinds of applications. KVM support requires a recent qemu-kvm release.”…””}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hhËh²hubhÝ)”}”(hX,For the KVM use there was need for a new signal type so that KVM can inject the machine check into the guest with the proper address. This in theory allows other applications to handle memory failures too. The expectation is that most applications won't do that, but some very specialized ones might.”h]”hX.For the KVM use there was need for a new signal type so that KVM can inject the machine check into the guest with the proper address. This in theory allows other applications to handle memory failures too. The expectation is that most applications won’t do that, but some very specialized ones might.”…””}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hhËh²hubeh}”(h]”Œwhat-is-hwpoison”ah ]”h"]”Œwhat is hwpoison?”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒFailure recovery modes”h]”hŒFailure recovery modes”…””}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj`h²hh³hÊh´K7ubhÝ)”}”(hŒGThere are two (actually three) modes memory failure recovery can be in:”h]”hŒGThere are two (actually three) modes memory failure recovery can be in:”…””}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K9hj`h²hubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒkvm.memory_failure_recovery sysctl set to zero: All memory failures cause a panic. Do not attempt recovery. ”h]”(hŒterm”“”)”}”(hŒ.vm.memory_failure_recovery sysctl set to zero:”h]”hŒ.vm.memory_failure_recovery sysctl set to zero:”…””}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´K /sys/fs/cgroup/mem/hwpoison/tasks memcg_ino=$(ls -id /sys/fs/cgroup/mem/hwpoison | cut -f1 -d' ') echo $memcg_ino > /debug/hwpoison/corrupt-filter-memcg page-types -p `pidof init` --hwpoison # shall do nothing page-types -p `pidof usemem` --hwpoison # poison its pages corrupt-filter-flags-mask, corrupt-filter-flags-value When specified, only poison pages if ((page_flags & mask) == value). This allows stress testing of many kinds of pages. The page_flags are the same as in /proc/kpageflags. The flag bits are defined in include/linux/kernel-page-flags.h and documented in Documentation/admin-guide/mm/pagemap.rst ”h]”(hÝ)”}”(hŒFhwpoison-inject module through debugfs ``/sys/kernel/debug/hwpoison/``”h]”(hŒ'hwpoison-inject module through debugfs ”…””}”(hjBh²hh³Nh´Nubhç)”}”(hŒ``/sys/kernel/debug/hwpoison/``”h]”hŒ/sys/kernel/debug/hwpoison/”…””}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjBubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kphj>ubj€)”}”(hhh]”(j…)”}”(hŒ“corrupt-pfn Inject hwpoison fault at PFN echoed into this file. This does some early filtering to avoid corrupted unintended pages in test suites. ”h]”(j‹)”}”(hŒ corrupt-pfn”h]”hŒ corrupt-pfn”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´Kthjaubj›)”}”(hhh]”hÝ)”}”(hŒ†Inject hwpoison fault at PFN echoed into this file. This does some early filtering to avoid corrupted unintended pages in test suites.”h]”hŒ†Inject hwpoison fault at PFN echoed into this file. This does some early filtering to avoid corrupted unintended pages in test suites.”…””}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kshjsubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjaubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÊh´Kthj^ubj…)”}”(hŒ÷unpoison-pfn Software-unpoison page at PFN echoed into this file. This way a page can be reused again. This only works for Linux injected failures, not for real memory failures. Once any hardware memory failure happens, this feature is disabled. ”h]”(j‹)”}”(hŒ unpoison-pfn”h]”hŒ unpoison-pfn”…””}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´Kzhjubj›)”}”(hhh]”hÝ)”}”(hŒéSoftware-unpoison page at PFN echoed into this file. This way a page can be reused again. This only works for Linux injected failures, not for real memory failures. Once any hardware memory failure happens, this feature is disabled.”h]”hŒéSoftware-unpoison page at PFN echoed into this file. This way a page can be reused again. This only works for Linux injected failures, not for real memory failures. Once any hardware memory failure happens, this feature is disabled.”…””}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kwhj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÊh´Kzhj^ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj>ubhÝ)”}”(hŒWNote these injection interfaces are not stable and might change between kernel versions”h]”hŒWNote these injection interfaces are not stable and might change between kernel versions”…””}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K|hj>ubj€)”}”(hhh]”(j…)”}”(hŒúcorrupt-filter-dev-major, corrupt-filter-dev-minor Only handle memory failures to pages associated with the file system defined by block device major/minor. -1U is the wildcard value. This should be only used for testing with artificial injection. ”h]”(j‹)”}”(hŒ2corrupt-filter-dev-major, corrupt-filter-dev-minor”h]”hŒ2corrupt-filter-dev-major, corrupt-filter-dev-minor”…””}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´KƒhjÖubj›)”}”(hhh]”hÝ)”}”(hŒÆOnly handle memory failures to pages associated with the file system defined by block device major/minor. -1U is the wildcard value. This should be only used for testing with artificial injection.”h]”hŒÆOnly handle memory failures to pages associated with the file system defined by block device major/minor. -1U is the wildcard value. This should be only used for testing with artificial injection.”…””}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K€hjèubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjÖubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÊh´KƒhjÓubj…)”}”(hX corrupt-filter-memcg Limit injection to pages owned by memgroup. Specified by inode number of the memcg. Example:: mkdir /sys/fs/cgroup/mem/hwpoison usemem -m 100 -s 1000 & echo `jobs -p` > /sys/fs/cgroup/mem/hwpoison/tasks memcg_ino=$(ls -id /sys/fs/cgroup/mem/hwpoison | cut -f1 -d' ') echo $memcg_ino > /debug/hwpoison/corrupt-filter-memcg page-types -p `pidof init` --hwpoison # shall do nothing page-types -p `pidof usemem` --hwpoison # poison its pages ”h]”(j‹)”}”(hŒcorrupt-filter-memcg”h]”hŒcorrupt-filter-memcg”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´K”hjubj›)”}”(hhh]”(hÝ)”}”(hŒSLimit injection to pages owned by memgroup. Specified by inode number of the memcg.”h]”hŒSLimit injection to pages owned by memgroup. Specified by inode number of the memcg.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K†hjubhÝ)”}”(hŒ Example::”h]”hŒExample:”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K‰hjubj)”}”(hX^mkdir /sys/fs/cgroup/mem/hwpoison usemem -m 100 -s 1000 & echo `jobs -p` > /sys/fs/cgroup/mem/hwpoison/tasks memcg_ino=$(ls -id /sys/fs/cgroup/mem/hwpoison | cut -f1 -d' ') echo $memcg_ino > /debug/hwpoison/corrupt-filter-memcg page-types -p `pidof init` --hwpoison # shall do nothing page-types -p `pidof usemem` --hwpoison # poison its pages”h]”hX^mkdir /sys/fs/cgroup/mem/hwpoison usemem -m 100 -s 1000 & echo `jobs -p` > /sys/fs/cgroup/mem/hwpoison/tasks memcg_ino=$(ls -id /sys/fs/cgroup/mem/hwpoison | cut -f1 -d' ') echo $memcg_ino > /debug/hwpoison/corrupt-filter-memcg page-types -p `pidof init` --hwpoison # shall do nothing page-types -p `pidof usemem` --hwpoison # poison its pages”…””}”hj6sbah}”(h]”h ]”h"]”h$]”h&]”j,j-uh1jh³hÊh´K‹hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÊh´K”hjÓubj…)”}”(hX]corrupt-filter-flags-mask, corrupt-filter-flags-value When specified, only poison pages if ((page_flags & mask) == value). This allows stress testing of many kinds of pages. The page_flags are the same as in /proc/kpageflags. The flag bits are defined in include/linux/kernel-page-flags.h and documented in Documentation/admin-guide/mm/pagemap.rst ”h]”(j‹)”}”(hŒ5corrupt-filter-flags-mask, corrupt-filter-flags-value”h]”hŒ5corrupt-filter-flags-mask, corrupt-filter-flags-value”…””}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÊh´K›hjPubj›)”}”(hhh]”hÝ)”}”(hX&When specified, only poison pages if ((page_flags & mask) == value). This allows stress testing of many kinds of pages. The page_flags are the same as in /proc/kpageflags. The flag bits are defined in include/linux/kernel-page-flags.h and documented in Documentation/admin-guide/mm/pagemap.rst”h]”hX&When specified, only poison pages if ((page_flags & mask) == value). This allows stress testing of many kinds of pages. The page_flags are the same as in /proc/kpageflags. The flag bits are defined in include/linux/kernel-page-flags.h and documented in Documentation/admin-guide/mm/pagemap.rst”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K—hjbubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjPubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÊh´K›hjÓubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj>ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j$hj!h²hh³Nh´Nubj%)”}”(hŒArchitecture specific MCE injector x86 has mce-inject, mce-test Some portable hwpoison test programs in mce-test, see below. ”h]”(hÝ)”}”(hŒ"Architecture specific MCE injector”h]”hŒ"Architecture specific MCE injector”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khj‹ubhÝ)”}”(hŒx86 has mce-inject, mce-test”h]”hŒx86 has mce-inject, mce-test”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KŸhj‹ubhÝ)”}”(hŒ