All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurentiu Tudor <b10716@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: PPC: e6500: Handle LRAT error exception
Date: Wed, 30 Sep 2015 11:27:27 +0000	[thread overview]
Message-ID: <560BC71F.1070903@freescale.com> (raw)
In-Reply-To: <5603F684.9020501@freescale.com>

On 09/30/2015 01:32 PM, Laurentiu Tudor wrote:
> On 09/25/2015 03:10 AM, Scott Wood wrote:
>> On Thu, 2015-09-24 at 16:11 +0300, Laurentiu Tudor wrote:

[snip]

>>> b/arch/powerpc/kvm/e500_mmu_host.c
>>> index 12d5c67..99ad88a 100644
>>> --- a/arch/powerpc/kvm/e500_mmu_host.c
>>> +++ b/arch/powerpc/kvm/e500_mmu_host.c
>>> @@ -96,6 +96,112 @@ static inline void __write_host_tlbe(struct 
>>> kvm_book3e_206_tlb_entry *stlbe,
>>>                                     stlbe->mas2, stlbe->mas7_3);
>>>  }
>>>  
>>> +#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV)
>>> +static int lrat_next(void)
>>> +{
>>
>> Will anything break by removing the CONFIG_64BIT condition, even if we don't 
>> have a 32-bit target that uses this?
> 
> Not completly certain but i remember getting compile or link errors
> on 32-bit e500mc or e500v2. I can recheck if you want.
> 
>>> +void kvmppc_lrat_map(struct kvm_vcpu *vcpu, gfn_t gfn)
>>> +{
>>> +     struct kvm_memory_slot *slot;
>>> +     unsigned long pfn;
>>> +     unsigned long hva;
>>> +     struct vm_area_struct *vma;
>>> +     unsigned long psize;
>>> +     int tsize;
>>> +     unsigned long tsize_pages;
>>> +
>>> +     slot = gfn_to_memslot(vcpu->kvm, gfn);
>>> +     if (!slot) {
>>> +             pr_err_ratelimited("%s: couldn't find memslot for gfn %lx!\n",
>>> +                                __func__, (long)gfn);
>>> +             return;
>>> +     }
>>> +
>>> +     hva = slot->userspace_addr;
>>
>> What if the faulting address is somewhere in the middle of the slot?  
>> Shouldn't you use gfn_to_hva_memslot() like kvmppc_e500_shadow_map()?  In 
>> fact there's probably a lot of logic that should be shared between these two 
>> functions.
> 
> So if my understanding is correct most of the gfn -> pfn translation
> stuff done in kvmppc_e500_shadow_map() should also be present in here.
> If that's the case maybe i should first extract this code (which includes
> VM_PFNMAP handling) in a separate function and call it from both kvmppc_lrat_map()
> and kvmppc_e500_shadow_map(). 
> 

Off-topic, but just noticed that kvmppc_e500_shadow_map() is marked as inline.
Was that on purpose? Is inlining such a large function worth anything?

---
Best Regards, Laurentiu

  parent reply	other threads:[~2015-09-30 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 13:11 [PATCH 1/2] KVM: PPC: e6500: Handle LRAT error exception Laurentiu Tudor
2015-09-25  0:10 ` Scott Wood
2015-09-30 10:32 ` Laurentiu Tudor
2015-09-30 11:27 ` Laurentiu Tudor [this message]
2015-09-30 16:55 ` Scott Wood
2015-10-01  9:12 ` Laurentiu Tudor

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=560BC71F.1070903@freescale.com \
    --to=b10716@freescale.com \
    --cc=kvm-ppc@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 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.