kernel_optimize_test/virt/kvm/arm
James Morse 196f878a7a KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory
Once we enable ARCH_SUPPORTS_MEMORY_FAILURE on arm64, notifications for
broken memory can call memory_failure() in mm/memory-failure.c to offline
pages of memory, possibly signalling user space processes and notifying all
the in-kernel users.

memory_failure() has two modes, early and late. Early is used by
machine-managers like Qemu to receive a notification when a memory error is
notified to the host. These can then be relayed to the guest before the
affected page is accessed. To enable this, the process must set
PR_MCE_KILL_EARLY in PR_MCE_KILL_SET using the prctl() syscall.

Once the early notification has been handled, nothing stops the
machine-manager or guest from accessing the affected page. If the
machine-manager does this the page will fail to be mapped and SIGBUS will
be sent. This patch adds the equivalent path for when the guest accesses
the page, sending SIGBUS to the machine-manager.

These two signals can be distinguished by the machine-manager using their
si_code: BUS_MCEERR_AO for 'action optional' early notifications, and
BUS_MCEERR_AR for 'action required' synchronous/late notifications.

Do as x86 does, and deliver the SIGBUS when we discover pfn ==
KVM_PFN_ERR_HWPOISON. Use the hugepage size as si_addr_lsb if this vma was
allocated as a hugepage. Transparent hugepages will be split by
memory_failure() before we see them here.

Cc: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-06-22 17:37:36 +01:00
..
hyp arm64/kvm: sysreg: fix typo'd SYS_ICC_IGRPEN*_EL1 2017-06-15 09:45:07 +01:00
vgic KVM: arm64: vgic-v3: Log which GICv3 system registers are trapped 2017-06-15 09:45:06 +01:00
aarch32.c KVM: arm64: Make kvm_condition_valid32() accessible from EL2 2017-06-15 09:44:58 +01:00
arch_timer.c KVM: arm/arm64: Disallow userspace control of in-kernel IRQ lines 2017-06-08 17:58:40 +02:00
arm.c KVM: ARM64: fix phy counter access failure in guest. 2017-06-15 09:45:12 +01:00
mmio.c KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
mmu.c KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory 2017-06-22 17:37:36 +01:00
perf.c KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
pmu.c KVM: arm/arm64: Don't assume initialized vgic when setting PMU IRQ 2017-06-08 17:58:54 +02:00
psci.c KVM: arm/arm64: change exit request to sleep request 2017-06-04 16:53:55 +02:00
trace.h KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00