Revision 9a291a7c9428155e8e623e4a3989f8be47134df5 authored by James Morse on 02 June 2017, 21:46:46 UTC, committed by Linus Torvalds on 02 June 2017, 22:07:38 UTC
KVM uses get_user_pages() to resolve its stage2 faults. KVM sets the FOLL_HWPOISON flag causing faultin_page() to return -EHWPOISON when it finds a VM_FAULT_HWPOISON. KVM handles these hwpoison pages as a special case. (check_user_page_hwpoison()) When huge pages are involved, this doesn't work so well. get_user_pages() calls follow_hugetlb_page(), which stops early if it receives VM_FAULT_HWPOISON from hugetlb_fault(), eventually returning -EFAULT to the caller. The step to map this to -EHWPOISON based on the FOLL_ flags is missing. The hwpoison special case is skipped, and -EFAULT is returned to user-space, causing Qemu or kvmtool to exit. Instead, move this VM_FAULT_ to errno mapping code into a header file and use it from faultin_page() and follow_hugetlb_page(). With this, KVM works as expected. This isn't a problem for arm64 today as we haven't enabled MEMORY_FAILURE, but I can't see any reason this doesn't happen on x86 too, so I think this should be a fix. This doesn't apply earlier than stable's v4.11.1 due to all sorts of cleanup. [james.morse@arm.com: add vm_fault_to_errno() call to faultin_page()] suggested. Link: http://lkml.kernel.org/r/20170525171035.16359-1-james.morse@arm.com [akpm@linux-foundation.org: coding-style fixes] Link: http://lkml.kernel.org/r/20170524160900.28786-1-james.morse@arm.com Signed-off-by: James Morse <james.morse@arm.com> Acked-by: Punit Agrawal <punit.agrawal@arm.com> Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com> Cc: <stable@vger.kernel.org> [4.11.1+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 70feee0
File | Mode | Size |
---|---|---|
Kconfig | -rw-r--r-- | 827 bytes |
Makefile | -rw-r--r-- | 416 bytes |
afs.h | -rw-r--r-- | 5.7 KB |
afs_cm.h | -rw-r--r-- | 1.2 KB |
afs_fs.h | -rw-r--r-- | 2.3 KB |
afs_vl.h | -rw-r--r-- | 3.6 KB |
cache.c | -rw-r--r-- | 10.8 KB |
callback.c | -rw-r--r-- | 11.4 KB |
cell.c | -rw-r--r-- | 10.3 KB |
cmservice.c | -rw-r--r-- | 14.3 KB |
dir.c | -rw-r--r-- | 25.9 KB |
file.c | -rw-r--r-- | 12.4 KB |
flock.c | -rw-r--r-- | 15.7 KB |
fsclient.c | -rw-r--r-- | 43.1 KB |
inode.c | -rw-r--r-- | 12.4 KB |
internal.h | -rw-r--r-- | 29.7 KB |
main.c | -rw-r--r-- | 3.2 KB |
misc.c | -rw-r--r-- | 2.8 KB |
mntpt.c | -rw-r--r-- | 5.2 KB |
netdevices.c | -rw-r--r-- | 1.0 KB |
proc.c | -rw-r--r-- | 14.9 KB |
rxrpc.c | -rw-r--r-- | 19.5 KB |
security.c | -rw-r--r-- | 9.1 KB |
server.c | -rw-r--r-- | 7.9 KB |
super.c | -rw-r--r-- | 12.6 KB |
vlclient.c | -rw-r--r-- | 5.3 KB |
vlocation.c | -rw-r--r-- | 17.5 KB |
vnode.c | -rw-r--r-- | 24.0 KB |
volume.c | -rw-r--r-- | 9.7 KB |
write.c | -rw-r--r-- | 18.7 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...