1 2:Original: Documentation/mm/hwpoison.rst 3 4:������: 5 6 ��������� Yanteng Si <siyanteng@loongson.cn> 7 8:������: 9 10 11======== 12hwpoison 13======== 14 15���������hwpoison? 16=============== 17 18 19������������������������CPU��������������������������������������� ``MCA������`` ��������������������������������� 20������������"poisoned"��������������������������������������������������������������� 21 22������������������������������������������������(������)��������� 23 24������������������������:: 25 26 ������������������������������������������������������������������������������������������������2���ECC��� 27 ��������������������������� 28 29 ���������������������������������������������������������������������CPU������������������������������������������ 30 ������������������������������������������������������������, ������������������������������������������������������ 31 ���������������������. ��������������������������������������������������� 32 33 ������������������������������������������������������������������������������������������������������ ��������������� 34 ��������������������������������������������������������������������������������������������������������������������� 35 ������������������������������������������������������������������������������������������������������������������������ 36 ������������������������������������������������������ 37 38 ��������������������������������������������������������������������������������������������������������������������� 39 ������������������������������vma������������������������������������������������������������������������������������ 40 ������������������������������������������������ 41 42������������mm/memory-failure.c���������������������������������������������poison��������������������� 43���������������������������������poison������������ 44 45���������������������KVM���������������������������������������������������������������KVM���������������qemu-kvm 46��������� 47 48������KVM���������������������������������������������������KVM��������������������������������������������������������� 49������������������������������������������������������������������������������������������������������������������������������ 50������������������������������������������������������������������ 51 52������������������ 53============ 54 55������������������������������������������������������������������������ 56 57vm.memory_failure_recovery sysctl ������: 58 ���������������������������������panic��������������������������� 59 60������������ 61 (���������������������������������������) ���������������������������������������������������SIGBUS��������� 62 ��������������������������������������������������������������������������������������� ������KVM qemu��������� 63 ��������� 64 65������������ 66 ���������������������������������������������������SIGBUS������������������������������������������������������ 67 ������������������������������������������������������������late kill��������� 68 69������������ 70======== 71 72vm.memory_failure_recovery 73 ������ sysctl.txt 74 75vm.memory_failure_early_kill 76 ������������early kill 77 78PR_MCE_KILL 79 ������early/late kill mode/revert ��������������������� 80 81 arg1: PR_MCE_KILL_CLEAR: 82 ������������������������ 83 arg1: PR_MCE_KILL_SET: 84 arg2��������������������������� 85 86 PR_MCE_KILL_EARLY: 87 Early kill 88 PR_MCE_KILL_LATE: 89 Late kill 90 PR_MCE_KILL_DEFAULT 91 ��������������������������� 92 93 ���������������������������������������������������������������SIGBUS(BUS_MCEERR_AO)��������������� 94 ���������������������prctl(PR_MCE_KILL_EARLY)������������SIGBUS��������������������������� 95 96PR_MCE_KILL_GET 97 ������������������ 98 99������ 100==== 101 102* madvise(MADV_HWPOISON, ....) (as root) - ������������������Poison������������ 103 104* ������debugfs ``/sys/kernel/debug/hwpoison/`` hwpoison-inject������ 105 106 corrupt-pfn 107 ���PFN���������hwpoison������������echoed������������������������������������������������������ 108 ��������������������������������������������� 109 unpoison-pfn 110 ���PFN���Software-unpoison������������������������������������������������������������������ 111 ������������������Linux������������������������������������������������������������������ 112 113 ��������������������������������������������������������������������������������������� 114 115 corrupt-filter-dev-major, corrupt-filter-dev-minor 116 ���������������������major/minor������������������������������������������������������-1U������ 117 ������������������������������������������������������ 118 119 corrupt-filter-memcg 120 ���������������memgroup���������������������memcg���inode������������ 121 122 Example:: 123 124 mkdir /sys/fs/cgroup/mem/hwpoison 125 126 usemem -m 100 -s 1000 & 127 echo `jobs -p` > /sys/fs/cgroup/mem/hwpoison/tasks 128 129 memcg_ino=$(ls -id /sys/fs/cgroup/mem/hwpoison | cut -f1 -d' ') 130 echo $memcg_ino > /debug/hwpoison/corrupt-filter-memcg 131 132 page-types -p `pidof init` --hwpoison # shall do nothing 133 page-types -p `pidof usemem` --hwpoison # poison its pages 134 135 corrupt-filter-flags-mask, corrupt-filter-flags-value 136 ������������������������((page_flags & mask) == value)������������������poison��������� 137 ������������������������������������������������������page_flags���/proc/kpageflags��������� 138 ������������������������include/linux/kernel-page-flags.h������������������ 139 Documentation/admin-guide/mm/pagemap.rst������������ 140 141* ���������������MCE��������� 142 143 x86 ��� mce-inject, mce-test 144 145 ���mce-test���������������������hwpoison��������������������������� 146 147������ 148==== 149 150http://halobates.de/mce-lc09-2.pdf 151 09���LinuxCon��������������� 152 153git://git.kernel.org/pub/scm/utils/cpu/mce/mce-test.git 154 ������������������tsrc������hwpoison��������������������������� 155 156git://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git 157 x86������������������ 158 159 160������ 161==== 162- ������������������������������������������������������������������������������������������������������ 163 ������������������LRU������ 164 165--- 166Andi Kleen, 2009���10��� 167