From: Alexander Graf <agraf@suse.de>
To: Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH 1/2] KVM: PPC: Add generic hpte management functions
Date: Tue, 22 Jun 2010 12:04:24 +0000 [thread overview]
Message-ID: <4C20A6C8.4070002@suse.de> (raw)
In-Reply-To: <4C20A64D.2070805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Avi Kivity wrote:
> On 06/21/2010 04:44 PM, Alexander Graf wrote:
>> Currently the shadow paging code keeps an array of entries it knows
>> about.
>> Whenever the guest invalidates an entry, we loop through that entry,
>> trying to invalidate matching parts.
>>
>> While this is a really simple implementation, it is probably the most
>> ineffective one possible. So instead, let's keep an array of lists
>> around
>> that are indexed by a hash. This way each PTE can be added by 4
>> list_add,
>> removed by 4 list_del invocations and the search only needs to loop
>> through
>> entries that share the same hash.
>>
>> This patch implements said lookup and exports generic functions that
>> both
>> the 32-bit and 64-bit backend can use.
>>
>
> Mind explaining the all list in there?
The all list is used to flush all entries when we need to get rid of all
entries, for example when we write a BAT.
>
>>
>> +
>> +static inline u64 kvmppc_mmu_hash_pte(u64 eaddr) {
>> + return hash_64(eaddr>> PTE_SIZE, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte(u64 vpage) {
>> + return hash_64(vpage& 0xfffffffffULL, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage) {
>> + return hash_64((vpage& 0xffffff000ULL)>> 12, HPTEG_HASH_BITS);
>> +}
>>
>
> Please use ordinary formatting for the functions above.
Ouch.
>
>> +/* Flush with mask 0xffffff000 */
>> +static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64
>> guest_vp)
>> +{
>> + struct list_head *list;
>> + struct hpte_cache *pte, *tmp;
>> + u64 vp_mask = 0xffffff000ULL;
>> +
>> + list
>> =&vcpu->arch.hpte_hash_vpte_long[kvmppc_mmu_hash_vpte_long(guest_vp)];
>> +
>> + /* No entries to flush */
>> + if (!list)
>> + return;
>> +
>> + /* Check the list for matching entries */
>> + list_for_each_entry_safe(pte, tmp, list, list_vpte_long)
>> + /* Jump over the helper entry */
>> + if (&pte->list_vpte_long = list)
>> + continue;
>> +
>> + if ((pte->pte.vpage& vp_mask) = guest_vp)
>> + invalidate_pte(vcpu, pte);
>> +}
>>
>
> C wants brackets around blocks.
>
Even more ouch.
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Avi Kivity <avi@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: PPC: Add generic hpte management functions
Date: Tue, 22 Jun 2010 14:04:24 +0200 [thread overview]
Message-ID: <4C20A6C8.4070002@suse.de> (raw)
In-Reply-To: <4C20A64D.2070805@redhat.com>
Avi Kivity wrote:
> On 06/21/2010 04:44 PM, Alexander Graf wrote:
>> Currently the shadow paging code keeps an array of entries it knows
>> about.
>> Whenever the guest invalidates an entry, we loop through that entry,
>> trying to invalidate matching parts.
>>
>> While this is a really simple implementation, it is probably the most
>> ineffective one possible. So instead, let's keep an array of lists
>> around
>> that are indexed by a hash. This way each PTE can be added by 4
>> list_add,
>> removed by 4 list_del invocations and the search only needs to loop
>> through
>> entries that share the same hash.
>>
>> This patch implements said lookup and exports generic functions that
>> both
>> the 32-bit and 64-bit backend can use.
>>
>
> Mind explaining the all list in there?
The all list is used to flush all entries when we need to get rid of all
entries, for example when we write a BAT.
>
>>
>> +
>> +static inline u64 kvmppc_mmu_hash_pte(u64 eaddr) {
>> + return hash_64(eaddr>> PTE_SIZE, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte(u64 vpage) {
>> + return hash_64(vpage& 0xfffffffffULL, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage) {
>> + return hash_64((vpage& 0xffffff000ULL)>> 12, HPTEG_HASH_BITS);
>> +}
>>
>
> Please use ordinary formatting for the functions above.
Ouch.
>
>> +/* Flush with mask 0xffffff000 */
>> +static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64
>> guest_vp)
>> +{
>> + struct list_head *list;
>> + struct hpte_cache *pte, *tmp;
>> + u64 vp_mask = 0xffffff000ULL;
>> +
>> + list
>> =&vcpu->arch.hpte_hash_vpte_long[kvmppc_mmu_hash_vpte_long(guest_vp)];
>> +
>> + /* No entries to flush */
>> + if (!list)
>> + return;
>> +
>> + /* Check the list for matching entries */
>> + list_for_each_entry_safe(pte, tmp, list, list_vpte_long)
>> + /* Jump over the helper entry */
>> + if (&pte->list_vpte_long == list)
>> + continue;
>> +
>> + if ((pte->pte.vpage& vp_mask) == guest_vp)
>> + invalidate_pte(vcpu, pte);
>> +}
>>
>
> C wants brackets around blocks.
>
Even more ouch.
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
To: Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH 1/2] KVM: PPC: Add generic hpte management functions
Date: Tue, 22 Jun 2010 14:04:24 +0200 [thread overview]
Message-ID: <4C20A6C8.4070002@suse.de> (raw)
In-Reply-To: <4C20A64D.2070805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Avi Kivity wrote:
> On 06/21/2010 04:44 PM, Alexander Graf wrote:
>> Currently the shadow paging code keeps an array of entries it knows
>> about.
>> Whenever the guest invalidates an entry, we loop through that entry,
>> trying to invalidate matching parts.
>>
>> While this is a really simple implementation, it is probably the most
>> ineffective one possible. So instead, let's keep an array of lists
>> around
>> that are indexed by a hash. This way each PTE can be added by 4
>> list_add,
>> removed by 4 list_del invocations and the search only needs to loop
>> through
>> entries that share the same hash.
>>
>> This patch implements said lookup and exports generic functions that
>> both
>> the 32-bit and 64-bit backend can use.
>>
>
> Mind explaining the all list in there?
The all list is used to flush all entries when we need to get rid of all
entries, for example when we write a BAT.
>
>>
>> +
>> +static inline u64 kvmppc_mmu_hash_pte(u64 eaddr) {
>> + return hash_64(eaddr>> PTE_SIZE, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte(u64 vpage) {
>> + return hash_64(vpage& 0xfffffffffULL, HPTEG_HASH_BITS);
>> +}
>> +
>> +static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage) {
>> + return hash_64((vpage& 0xffffff000ULL)>> 12, HPTEG_HASH_BITS);
>> +}
>>
>
> Please use ordinary formatting for the functions above.
Ouch.
>
>> +/* Flush with mask 0xffffff000 */
>> +static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64
>> guest_vp)
>> +{
>> + struct list_head *list;
>> + struct hpte_cache *pte, *tmp;
>> + u64 vp_mask = 0xffffff000ULL;
>> +
>> + list
>> =&vcpu->arch.hpte_hash_vpte_long[kvmppc_mmu_hash_vpte_long(guest_vp)];
>> +
>> + /* No entries to flush */
>> + if (!list)
>> + return;
>> +
>> + /* Check the list for matching entries */
>> + list_for_each_entry_safe(pte, tmp, list, list_vpte_long)
>> + /* Jump over the helper entry */
>> + if (&pte->list_vpte_long == list)
>> + continue;
>> +
>> + if ((pte->pte.vpage& vp_mask) == guest_vp)
>> + invalidate_pte(vcpu, pte);
>> +}
>>
>
> C wants brackets around blocks.
>
Even more ouch.
Alex
next prev parent reply other threads:[~2010-06-22 12:04 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 13:44 [PATCH 1/2] KVM: PPC: Add generic hpte management functions Alexander Graf
2010-06-21 13:44 ` Alexander Graf
2010-06-21 13:44 ` Alexander Graf
2010-06-21 13:44 ` [PATCH 2/2] KVM: PPC: Make use of hash based Shadow MMU Alexander Graf
2010-06-21 13:44 ` Alexander Graf
2010-06-21 13:44 ` Alexander Graf
[not found] ` <1277127841-32704-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-06-22 12:02 ` [PATCH 1/2] KVM: PPC: Add generic hpte management functions Avi Kivity
2010-06-22 12:02 ` Avi Kivity
2010-06-22 12:02 ` Avi Kivity
[not found] ` <4C20A64D.2070805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-22 12:04 ` Alexander Graf [this message]
2010-06-22 12:04 ` Alexander Graf
2010-06-22 12:04 ` Alexander Graf
2010-06-22 12:07 ` Avi Kivity
2010-06-22 12:07 ` Avi Kivity
2010-06-22 12:07 ` Avi Kivity
2010-06-22 12:10 ` Alexander Graf
2010-06-22 12:10 ` Alexander Graf
2010-06-22 12:10 ` Alexander Graf
[not found] ` <4C20A836.2010908-l3A5Bk7waGM@public.gmane.org>
2010-06-22 12:12 ` Avi Kivity
2010-06-22 12:12 ` Avi Kivity
2010-06-22 12:12 ` Avi Kivity
2010-06-22 12:14 ` Alexander Graf
2010-06-22 12:14 ` Alexander Graf
2010-06-22 12:14 ` Alexander Graf
[not found] ` <4C20A91A.1080607-l3A5Bk7waGM@public.gmane.org>
2010-06-22 12:20 ` Avi Kivity
2010-06-22 12:20 ` Avi Kivity
2010-06-22 12:20 ` Avi Kivity
[not found] ` <4C20AA9B.8000807-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-26 22:58 ` Benjamin Herrenschmidt
2010-06-26 22:58 ` Benjamin Herrenschmidt
2010-06-26 22:58 ` Benjamin Herrenschmidt
2010-06-27 7:53 ` Avi Kivity
2010-06-27 7:53 ` Avi Kivity
2010-06-27 7:53 ` Avi Kivity
2010-06-27 22:10 ` Benjamin Herrenschmidt
2010-06-27 22:10 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2010-06-30 13:18 [PATCH 0/2] Faster MMU lookups for Book3s v3 Alexander Graf
[not found] ` <1277903926-12786-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-06-30 13:18 ` [PATCH 1/2] KVM: PPC: Add generic hpte management functions Alexander Graf
2010-06-30 13:18 ` Alexander Graf
2010-06-30 13:18 ` Alexander Graf
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=4C20A6C8.4070002@suse.de \
--to=agraf@suse.de \
--cc=avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.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.