From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Subject: Re: [PATCH 4/4] ARM: KVM: fix use of S2_PGD_SIZE Date: Tue, 30 Apr 2013 18:52:24 +0100 Message-ID: <518004D8.80801@arm.com> References: <1367331446-28030-1-git-send-email-marc.zyngier@arm.com> <1367331446-28030-5-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Cc: linux-arm-kernel , "kvmarm@lists.cs.columbia.edu" , KVM General To: Christoffer Dall Return-path: Received: from service87.mimecast.com ([91.220.42.44]:44604 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932433Ab3D3Rw1 convert rfc822-to-8bit (ORCPT ); Tue, 30 Apr 2013 13:52:27 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 30/04/13 18:40, Christoffer Dall wrote: > On Tue, Apr 30, 2013 at 7:17 AM, Marc Zyngier wrote: >> S2_PGD_SIZE describe the number of pages a used by a stage-2 PGD, >> not the size of the PGD. >> >> Fix the VM_BUG_ON() call that doesn't check much when S2_PGD_SIZE >> is equal to 1. >> >> Signed-off-by: Marc Zyngier >> --- >> arch/arm/kvm/mmu.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c >> index b978ebe..09ece5c 100644 >> --- a/arch/arm/kvm/mmu.c >> +++ b/arch/arm/kvm/mmu.c >> @@ -377,7 +377,7 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm) >> return -ENOMEM; >> >> /* stage-2 pgd must be aligned to its size */ >> - VM_BUG_ON((unsigned long)pgd & (S2_PGD_SIZE - 1)); >> + VM_BUG_ON((unsigned long)pgd & (PAGE_SIZE * S2_PGD_SIZE - 1)); > > I think the define is broken and should be fixed and/or renamed instead. To be fair, I wouldn't mind the whole check to be dropped altogether. If __get_free_pages doesn't give you an aligned allocation, the whole kernel is going the way of the dodo, and we shouldn't really care... Your call, really. M. -- Jazz is not dead. It just smells funny...