public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Liu Yu-B13201 <B13201@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: PPC: E500: Support hugetlbfs
Date: Mon, 26 Sep 2011 15:04:53 -0500	[thread overview]
Message-ID: <4E80DAE5.2000802@freescale.com> (raw)
In-Reply-To: <6050E2E0-2FAE-4B5C-A847-AC45A9E27506@suse.de>

On 09/24/2011 02:47 AM, Alexander Graf wrote:
> 
> On 22.09.2011, at 08:50, Liu Yu-B13201 wrote:
> 
>>
>>
>>> -----Original Message-----
>>> From: kvm-ppc-owner@vger.kernel.org 
>>> [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Alexander Graf
>>> Sent: Tuesday, September 20, 2011 7:36 AM
>>> To: kvm-ppc@vger.kernel.org
>>> Cc: kvm@vger.kernel.org
>>> Subject: [PATCH] KVM: PPC: E500: Support hugetlbfs
>>>
>>> With hugetlbfs support emerging on e500, we should also support KVM
>>> backing its guest memory by it.
>>>
>>> This patch adds support for hugetlbfs into the e500 shadow mmu code.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>> arch/powerpc/kvm/e500_tlb.c |   22 ++++++++++++++++++++++
>>> 1 files changed, 22 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
>>> index ec17148..64f75eb 100644
>>> --- a/arch/powerpc/kvm/e500_tlb.c
>>> +++ b/arch/powerpc/kvm/e500_tlb.c
>>> @@ -24,6 +24,7 @@
>>> #include <linux/sched.h>
>>> #include <linux/rwsem.h>
>>> #include <linux/vmalloc.h>
>>> +#include <linux/hugetlb.h>
>>> #include <asm/kvm_ppc.h>
>>> #include <asm/kvm_e500.h>
>>>
>>> @@ -673,13 +674,34 @@ static inline void 
>>> kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>>> 				pfn &= ~(tsize_pages - 1);
>>> 				break;
>>> 			}
>>> +		} else if (vma && hva >= vma->vm_start &&
>>> +                           (vma->vm_flags & VM_HUGETLB)) {
>>
>> Why check (vma && hva >= vma->vm_start) twice?
> 
> What would you do? :)

I think he's just complaining about doing the check twice, in which case
the answer could be "it avoids extra indentation and the compiler should
be able to factor out the common subexpression".

> In fact, I only copied the vm_start condition from the pfn code.
> Scott, why do we have to check this in the first place? We're calling
> find_vma. Can that return a vma that does not cover the hva we're
> passing in?

Yes, it can.  From find_vma():

/* Look up the first VMA which satisfies  addr < vm_end,  NULL if none. */

You'll find similar checks in a lot of other places where find_vma() is
used.

-Scott


  reply	other threads:[~2011-09-26 20:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 23:35 [PATCH] KVM: PPC: E500: Support hugetlbfs Alexander Graf
2011-09-20 17:54 ` Scott Wood
2011-09-24  7:44   ` Alexander Graf
2011-09-26 20:28     ` Scott Wood
2011-09-22  6:50 ` Liu Yu-B13201
2011-09-24  7:47   ` Alexander Graf
2011-09-26 20:04     ` Scott Wood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-05 14:37 Alexander Graf
2011-10-05 16:06 ` Scott Wood
2011-10-05 18:55   ` Alexander Graf
2011-10-05 19:53     ` Scott Wood

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=4E80DAE5.2000802@freescale.com \
    --to=scottwood@freescale.com \
    --cc=B13201@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox