1. 23 6月, 2017 2 次提交
    • T
      arm/arm64: KVM: add guest SEA support · 621f48e4
      Tyler Baicar 提交于
      Currently external aborts are unsupported by the guest abort
      handling. Add handling for SEAs so that the host kernel reports
      SEAs which occur in the guest kernel.
      
      When an SEA occurs in the guest kernel, the guest exits and is
      routed to kvm_handle_guest_abort(). Prior to this patch, a print
      message of an unsupported FSC would be printed and nothing else
      would happen. With this patch, the code gets routed to the APEI
      handling of SEAs in the host kernel to report the SEA information.
      Signed-off-by: NTyler Baicar <tbaicar@codeaurora.org>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Acked-by: NChristoffer Dall <cdall@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      621f48e4
    • J
      KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory · 196f878a
      James Morse 提交于
      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: NJames Morse <james.morse@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      196f878a
  2. 15 6月, 2017 27 次提交
  3. 08 6月, 2017 8 次提交
  4. 06 6月, 2017 2 次提交
    • M
      KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages · d6dbdd3c
      Marc Zyngier 提交于
      Under memory pressure, we start ageing pages, which amounts to parsing
      the page tables. Since we don't want to allocate any extra level,
      we pass NULL for our private allocation cache. Which means that
      stage2_get_pud() is allowed to fail. This results in the following
      splat:
      
      [ 1520.409577] Unable to handle kernel NULL pointer dereference at virtual address 00000008
      [ 1520.417741] pgd = ffff810f52fef000
      [ 1520.421201] [00000008] *pgd=0000010f636c5003, *pud=0000010f56f48003, *pmd=0000000000000000
      [ 1520.429546] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [ 1520.435156] Modules linked in:
      [ 1520.438246] CPU: 15 PID: 53550 Comm: qemu-system-aar Tainted: G        W       4.12.0-rc4-00027-g1885c397eaec #7205
      [ 1520.448705] Hardware name: FOXCONN R2-1221R-A4/C2U4N_MB, BIOS G31FB12A 10/26/2016
      [ 1520.463726] task: ffff800ac5fb4e00 task.stack: ffff800ce04e0000
      [ 1520.469666] PC is at stage2_get_pmd+0x34/0x110
      [ 1520.474119] LR is at kvm_age_hva_handler+0x44/0xf0
      [ 1520.478917] pc : [<ffff0000080b137c>] lr : [<ffff0000080b149c>] pstate: 40000145
      [ 1520.486325] sp : ffff800ce04e33d0
      [ 1520.489644] x29: ffff800ce04e33d0 x28: 0000000ffff40064
      [ 1520.494967] x27: 0000ffff27e00000 x26: 0000000000000000
      [ 1520.500289] x25: ffff81051ba65008 x24: 0000ffff40065000
      [ 1520.505618] x23: 0000ffff40064000 x22: 0000000000000000
      [ 1520.510947] x21: ffff810f52b20000 x20: 0000000000000000
      [ 1520.516274] x19: 0000000058264000 x18: 0000000000000000
      [ 1520.521603] x17: 0000ffffa6fe7438 x16: ffff000008278b70
      [ 1520.526940] x15: 000028ccd8000000 x14: 0000000000000008
      [ 1520.532264] x13: ffff7e0018298000 x12: 0000000000000002
      [ 1520.537582] x11: ffff000009241b93 x10: 0000000000000940
      [ 1520.542908] x9 : ffff0000092ef800 x8 : 0000000000000200
      [ 1520.548229] x7 : ffff800ce04e36a8 x6 : 0000000000000000
      [ 1520.553552] x5 : 0000000000000001 x4 : 0000000000000000
      [ 1520.558873] x3 : 0000000000000000 x2 : 0000000000000008
      [ 1520.571696] x1 : ffff000008fd5000 x0 : ffff0000080b149c
      [ 1520.577039] Process qemu-system-aar (pid: 53550, stack limit = 0xffff800ce04e0000)
      [...]
      [ 1521.510735] [<ffff0000080b137c>] stage2_get_pmd+0x34/0x110
      [ 1521.516221] [<ffff0000080b149c>] kvm_age_hva_handler+0x44/0xf0
      [ 1521.522054] [<ffff0000080b0610>] handle_hva_to_gpa+0xb8/0xe8
      [ 1521.527716] [<ffff0000080b3434>] kvm_age_hva+0x44/0xf0
      [ 1521.532854] [<ffff0000080a58b0>] kvm_mmu_notifier_clear_flush_young+0x70/0xc0
      [ 1521.539992] [<ffff000008238378>] __mmu_notifier_clear_flush_young+0x88/0xd0
      [ 1521.546958] [<ffff00000821eca0>] page_referenced_one+0xf0/0x188
      [ 1521.552881] [<ffff00000821f36c>] rmap_walk_anon+0xec/0x250
      [ 1521.558370] [<ffff000008220f78>] rmap_walk+0x78/0xa0
      [ 1521.563337] [<ffff000008221104>] page_referenced+0x164/0x180
      [ 1521.569002] [<ffff0000081f1af0>] shrink_active_list+0x178/0x3b8
      [ 1521.574922] [<ffff0000081f2058>] shrink_node_memcg+0x328/0x600
      [ 1521.580758] [<ffff0000081f23f4>] shrink_node+0xc4/0x328
      [ 1521.585986] [<ffff0000081f2718>] do_try_to_free_pages+0xc0/0x340
      [ 1521.592000] [<ffff0000081f2a64>] try_to_free_pages+0xcc/0x240
      [...]
      
      The trivial fix is to handle this NULL pud value early, rather than
      dereferencing it blindly.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Reviewed-by: NChristoffer Dall <cdall@linaro.org>
      Signed-off-by: NChristoffer Dall <cdall@linaro.org>
      d6dbdd3c
    • C
      KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction · d68356cc
      Christoffer Dall 提交于
      We used to extract PRIbits from the ICH_VT_EL2 which was the upper field
      in the register word, so a mask wasn't necessary, but as we switched to
      looking at PREbits, which is bits 26 through 28 with the PRIbits field
      being potentially non-zero, we really need to mask off the field value,
      otherwise fun things may happen.
      Signed-off-by: NChristoffer Dall <cdall@linaro.org>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      d68356cc
  5. 04 6月, 2017 1 次提交