From mboxrd@z Thu Jan 1 00:00:00 1970
From: Pavel Fedin
Subject: RE: [PATCH] KVM: arm/arm64: Revert to old way of checking for device
mapping in stage2_flush_ptes().
Date: Thu, 03 Dec 2015 10:14:12 +0300
Message-ID: <007c01d12d9a$36dd6eb0$a4984c10$@samsung.com>
References: <1448975032-7156-1-git-send-email-p.fedin@samsung.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8BIT
Cc: kvmarm@lists.cs.columbia.edu,
'KVM devel mailing list' ,
'Marc Zyngier' ,
'Christoffer Dall' ,
stable@vger.kernel.org
To: 'Ard Biesheuvel'
Return-path:
In-reply-to:
Content-language: ru
Sender: stable-owner@vger.kernel.org
List-Id: kvm.vger.kernel.org
Hello!
> > diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> > index 7dace90..51ad98f 100644
> > --- a/arch/arm/kvm/mmu.c
> > +++ b/arch/arm/kvm/mmu.c
> > @@ -310,7 +310,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
> >
> > pte = pte_offset_kernel(pmd, addr);
> > do {
> > - if (!pte_none(*pte) && !kvm_is_device_pfn(__phys_to_pfn(addr)))
> > + if (!pte_none(*pte) &&
> > + (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
>
> I think your analysis is correct, but does that not apply to both instances?
No no, another one is correct, since it operates on real PFN (at least looks like so). I have verified my fix against the original problem (crash on Exynos5410 without generic timer), and it still works fine there.
> And instead of reverting, could we fix this properly instead?
Of course, i'm not against alternate approaches, feel free to. I've just suggested what i could, to fix things quickly. I'm indeed no expert in KVM memory management yet. After all, this is what mailing lists are for.
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia