All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: KVM: fix use of S2_PGD_SIZE
Date: Tue, 30 Apr 2013 18:52:24 +0100	[thread overview]
Message-ID: <518004D8.80801@arm.com> (raw)
In-Reply-To: <CAEDV+gK5ifY0atTZqku=Y4J=1pfWY4XAz-ayXJ61Sf7MtjOG4A@mail.gmail.com>

On 30/04/13 18:40, Christoffer Dall wrote:
> On Tue, Apr 30, 2013 at 7:17 AM, Marc Zyngier <marc.zyngier@arm.com> 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 <marc.zyngier@arm.com>
>> ---
>>  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...

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Christoffer Dall <cdall@cs.columbia.edu>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	KVM General <kvm@vger.kernel.org>
Subject: Re: [PATCH 4/4] ARM: KVM: fix use of S2_PGD_SIZE
Date: Tue, 30 Apr 2013 18:52:24 +0100	[thread overview]
Message-ID: <518004D8.80801@arm.com> (raw)
In-Reply-To: <CAEDV+gK5ifY0atTZqku=Y4J=1pfWY4XAz-ayXJ61Sf7MtjOG4A@mail.gmail.com>

On 30/04/13 18:40, Christoffer Dall wrote:
> On Tue, Apr 30, 2013 at 7:17 AM, Marc Zyngier <marc.zyngier@arm.com> 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 <marc.zyngier@arm.com>
>> ---
>>  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...


  reply	other threads:[~2013-04-30 17:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 14:17 [PATCH 0/4] ARM: KVM: random mmu related fixes for 3.10 Marc Zyngier
2013-04-30 14:17 ` Marc Zyngier
2013-04-30 14:17 ` [PATCH 1/4] ARM: KVM: be more thorough when invalidating TLBs Marc Zyngier
2013-04-30 14:17   ` Marc Zyngier
2013-04-30 17:17   ` Christoffer Dall
2013-04-30 17:17     ` Christoffer Dall
2013-04-30 18:02     ` Marc Zyngier
2013-04-30 18:02       ` Marc Zyngier
2013-04-30 14:17 ` [PATCH 2/4] ARM: KVM: remove dead prototype for __kvm_tlb_flush_vmid Marc Zyngier
2013-04-30 14:17   ` Marc Zyngier
2013-04-30 14:17 ` [PATCH 3/4] ARM: KVM: relax cache maintainance when building page pables Marc Zyngier
2013-04-30 14:17   ` Marc Zyngier
2013-04-30 14:30   ` Will Deacon
2013-04-30 14:30     ` Will Deacon
2013-04-30 14:17 ` [PATCH 4/4] ARM: KVM: fix use of S2_PGD_SIZE Marc Zyngier
2013-04-30 14:17   ` Marc Zyngier
2013-04-30 17:40   ` Christoffer Dall
2013-04-30 17:40     ` Christoffer Dall
2013-04-30 17:52     ` Marc Zyngier [this message]
2013-04-30 17:52       ` Marc Zyngier
2013-04-30 17:56       ` Christoffer Dall
2013-04-30 17:56         ` Christoffer Dall
2013-04-30 17:59         ` Marc Zyngier
2013-04-30 17:59           ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518004D8.80801@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.