Message ID | 20200904104530.1082676-1-maz@kernel.org |
---|---|
State | New |
Headers | show |
Series | [GIT,PULL] KVM/arm64 fixes for 5.9 | expand |
Hi Marc, Noticed this patch while catching up with the lists. Marc Zyngier <maz@kernel.org> writes: > For the obscure cases where PMD and PUD are the same size > (64kB pages with 42bit VA, for example, which results in only > two levels of page tables), we can't map anything as a PUD, > because there is... erm... no PUD to speak of. Everything is > either a PMD or a PTE. > > So let's only try and map a PUD when its size is different from > that of a PMD. > > Cc: stable@vger.kernel.org > Fixes: b8e0ba7c8bea ("KVM: arm64: Add support for creating PUD hugepages at stage 2") > Reported-by: Gavin Shan <gshan@redhat.com> > Reported-by: Eric Auger <eric.auger@redhat.com> > Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> > Reviewed-by: Gavin Shan <gshan@redhat.com> > Tested-by: Gavin Shan <gshan@redhat.com> > Tested-by: Eric Auger <eric.auger@redhat.com> > Tested-by: Alexandru Elisei <alexandru.elisei@arm.com> > Signed-off-by: Marc Zyngier <maz@kernel.org> > --- > arch/arm64/kvm/mmu.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 0121ef2c7c8d..16b8660ddbcc 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -1964,7 +1964,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > (fault_status == FSC_PERM && > stage2_is_exec(mmu, fault_ipa, vma_pagesize)); > > - if (vma_pagesize == PUD_SIZE) { > + /* > + * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and > + * all we have is a 2-level page table. Trying to map a PUD in > + * this case would be fatally wrong. > + */ > + if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) { > pud_t new_pud = kvm_pfn_pud(pfn, mem_type); > > new_pud = kvm_pud_mkhuge(new_pud); Good catch! Missed the 64kb / 42b VA case while adding the initial support. Thanks for fixing it. Punit
On 04/09/20 12:45, Marc Zyngier wrote: > Hi Paolo, > > Here's a bunch of fixes for 5.9. The gist of it is the stolen time > rework from Andrew, but we also have a couple of MM fixes that have > surfaced as people have started to use hugetlbfs in anger. Hi Marc, I'll get to this next Friday. Paolo > Please pull, > > M. > > The following changes since commit 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5: > > Linux 5.9-rc1 (2020-08-16 13:04:57 -0700) > > are available in the Git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvmarm-fixes-5.9-1 > > for you to fetch changes up to 7b75cd5128421c673153efb1236705696a1a9812: > > KVM: arm64: Update page shift if stage 2 block mapping not supported (2020-09-04 10:53:48 +0100) > > ---------------------------------------------------------------- > KVM/arm64 fixes for Linux 5.9, take #1 > > - Multiple stolen time fixes, with a new capability to match x86 > - Fix for hugetlbfs mappings when PUD and PMD are the same level > - Fix for hugetlbfs mappings when PTE mappings are enforced > (dirty logging, for example) > - Fix tracing output of 64bit values > > ---------------------------------------------------------------- > Alexandru Elisei (1): > KVM: arm64: Update page shift if stage 2 block mapping not supported > > Andrew Jones (6): > KVM: arm64: pvtime: steal-time is only supported when configured > KVM: arm64: pvtime: Fix potential loss of stolen time > KVM: arm64: Drop type input from kvm_put_guest > KVM: arm64: pvtime: Fix stolen time accounting across migration > KVM: Documentation: Minor fixups > arm64/x86: KVM: Introduce steal-time cap > > Marc Zyngier (2): > KVM: arm64: Do not try to map PUDs when they are folded into PMD > KVM: arm64: Fix address truncation in traces > > Documentation/virt/kvm/api.rst | 22 ++++++++++++++++++---- > arch/arm64/include/asm/kvm_host.h | 2 +- > arch/arm64/kvm/arm.c | 3 +++ > arch/arm64/kvm/mmu.c | 8 +++++++- > arch/arm64/kvm/pvtime.c | 29 +++++++++++++---------------- > arch/arm64/kvm/trace_arm.h | 16 ++++++++-------- > arch/arm64/kvm/trace_handle_exit.h | 6 +++--- > arch/x86/kvm/x86.c | 3 +++ > include/linux/kvm_host.h | 31 ++++++++++++++++++++++++++----- > include/uapi/linux/kvm.h | 1 + > 10 files changed, 83 insertions(+), 38 deletions(-) >
On 2020-09-09 16:20, Paolo Bonzini wrote: > On 04/09/20 12:45, Marc Zyngier wrote: >> Hi Paolo, >> >> Here's a bunch of fixes for 5.9. The gist of it is the stolen time >> rework from Andrew, but we also have a couple of MM fixes that have >> surfaced as people have started to use hugetlbfs in anger. > > Hi Marc, > > I'll get to this next Friday. Thanks. I may have another one for you by then though... M.
On 09/09/20 19:15, Marc Zyngier wrote: > On 2020-09-09 16:20, Paolo Bonzini wrote: >> On 04/09/20 12:45, Marc Zyngier wrote: >>> Hi Paolo, >>> >>> Here's a bunch of fixes for 5.9. The gist of it is the stolen time >>> rework from Andrew, but we also have a couple of MM fixes that have >>> surfaced as people have started to use hugetlbfs in anger. >> >> Hi Marc, >> >> I'll get to this next Friday. > > Thanks. I may have another one for you by then though... Sure, you can choose whether to send a separate tag or update this one. Paolo