All of lore.kernel.org
 help / color / mirror / Atom feed
* What will happen to hugetlbfs backed guest memory when nx_huge_pages is enabled?
@ 2020-06-07  3:43 Takuya Yoshikawa
  2020-06-07  7:39 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Takuya Yoshikawa @ 2020-06-07  3:43 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm

Recently I noticed a significant performance issue with some of our KVM guests.
It looked like that the ITLB_MULTIHIT mitigation patch had been
backported to the
Ubuntu kernel on which they were running on, and the KVM was trying to do the
mitigation task on the guest memory backed by hugetlbfs 2MB pages.

    perf showed me that the KVM was busy doing tdp_page_fault(), __direct_map(),
    kvm_mmu_get_page() things. Normally, these were called in a short
period of time
    right after the VM got started because the guest soon touched the
whole memory.

The patch explains when a guest attempts to execute on an NX marked huge page,
KVM will break it down into 4KB pages. I understand how this works for
THP backed
guest memory, but what will happen to hugetlbfs backed guest memory?

When a huge amount of system memory is reserved as the hugetlbfs pool and QEMU
is said to use pages from there by the -mem-path option, is it safe to
enable the
nx_huge_pages mitigation?

We can turn it off now because the KVM guests are not from outside, and we only
execute our applications on them.


  UBUNTU: SAUCE: kvm: mmu: ITLB_MULTIHIT mitigation
  https://git.launchpad.net/~ubuntu-kernel/ubuntu/ source/linux/
git/xenial/commit/arch/x86/kvm?id=c6c9a37b564b8b4f7aad099388c55978ef456bb5

  kvm: mmu: ITLB_MULTIHIT mitigation
  https://github.com/torvalds/linux/commit/b8e8c8303ff28c61046a4d0f6ea99aea609a7dc0

  Takuya

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What will happen to hugetlbfs backed guest memory when nx_huge_pages is enabled?
  2020-06-07  3:43 What will happen to hugetlbfs backed guest memory when nx_huge_pages is enabled? Takuya Yoshikawa
@ 2020-06-07  7:39 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-06-07  7:39 UTC (permalink / raw)
  To: Takuya Yoshikawa; +Cc: kvm

On 07/06/20 05:43, Takuya Yoshikawa wrote:
> I understand how this works for THP backed guest memory, but what 
> will happen to hugetlbfs backed guest memory?
> 
> When a huge amount of system memory is reserved as the hugetlbfs
> pool and QEMU is said to use pages from there by the -mem-path
> option, is it safe to enable the nx_huge_pages mitigation?

The erratum arises when the guest sets up two iTLB entries of different
sizes for the same page.  Using 4 KiB EPT pages for executable areas
ensures that iTLB entries will all be for 4 KiB pages, independent of
the page size from the guest's page tables.

Therefore, even with hugetlbfs the EPT tables will be split.  There's no
requirement for EPT pages to be the same size as the host page tables.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-07  7:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07  3:43 What will happen to hugetlbfs backed guest memory when nx_huge_pages is enabled? Takuya Yoshikawa
2020-06-07  7:39 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.