From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 06/11] KVM: MMU: cleanup FNAME(invlpg)
Date: Wed, 14 Sep 2011 02:31:37 +0800 [thread overview]
Message-ID: <4E6FA189.7080607@cn.fujitsu.com> (raw)
In-Reply-To: <4E6F37B4.2080405@redhat.com>
On 09/13/2011 07:00 PM, Avi Kivity wrote:
> On 08/30/2011 05:36 AM, Xiao Guangrong wrote:
>> Directly Use mmu_page_zap_pte to zap spte in FNAME(invlpg), also remove the
>> same code between FNAME(invlpg) and FNAME(sync_page)
>>
>>
>> +static gpa_t FNAME(get_first_pte_gpa)(struct kvm_mmu_page *sp)
>
> spte
>
Yes, Will fix.
>> +{
>> + int offset = 0;
>> +
>> + if (PTTYPE == 32)
>> + offset = sp->role.quadrant<< PT64_LEVEL_BITS;
>> +
>> + return gfn_to_gpa(sp->gfn) + offset * sizeof(pt_element_t);
>> +}
>
> Only works for L1 tables, yes? Need a comment so it isn't reused for L2.
>
OK.
>> @@ -663,7 +673,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
>> gpa_t pte_gpa = -1;
>> int level;
>> u64 *sptep;
>> - int need_flush = 0;
>>
>> vcpu_clear_mmio_info(vcpu, gva);
>>
>> @@ -675,36 +684,20 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
>>
>> sp = page_header(__pa(sptep));
>> if (is_last_spte(*sptep, level)) {
>> - int offset, shift;
>> -
>> if (!sp->unsync)
>> break;
>>
>> - shift = PAGE_SHIFT -
>> - (PT_LEVEL_BITS - PT64_LEVEL_BITS) * level;
>> - offset = sp->role.quadrant<< shift;
>> -
>> - pte_gpa = (sp->gfn<< PAGE_SHIFT) + offset;
>> + pte_gpa = FNAME(get_first_pte_gpa)(sp);
>
>
> Here is can be used for L2 - I think we can use 2MB host pages to back 4MB guest mappings.
>
Only unsync shadow page is fetched here, and its level is always 1.
next prev parent reply other threads:[~2011-09-13 18:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 2:34 [PATCH v3 01/11] KVM: MMU: avoid pte_list_desc running out in kvm_mmu_pte_write Xiao Guangrong
2011-08-30 2:34 ` [PATCH v3 02/11] KVM: x86: tag the instructions which are used to write page table Xiao Guangrong
2011-08-30 2:35 ` [PATCH v3 03/11] KVM: x86: retry non-page-table writing instruction Xiao Guangrong
2011-09-13 10:47 ` Avi Kivity
2011-09-13 18:24 ` Xiao Guangrong
2011-09-14 9:53 ` Avi Kivity
2011-09-14 10:19 ` Xiao Guangrong
2011-09-15 4:56 ` Xiao Guangrong
2011-08-30 2:35 ` [PATCH v3 04/11] KVM: x86: cleanup port-in/port-out emulated Xiao Guangrong
2011-08-30 2:35 ` [PATCH v3 05/11] KVM: MMU: do not mark accessed bit on pte write path Xiao Guangrong
2011-09-13 10:53 ` Avi Kivity
2011-09-13 18:29 ` Xiao Guangrong
2011-09-14 9:55 ` Avi Kivity
2011-09-15 13:11 ` Marcelo Tosatti
2011-08-30 2:36 ` [PATCH v3 06/11] KVM: MMU: cleanup FNAME(invlpg) Xiao Guangrong
2011-09-13 11:00 ` Avi Kivity
2011-09-13 18:31 ` Xiao Guangrong [this message]
2011-09-14 9:57 ` Avi Kivity
2011-08-30 2:36 ` [PATCH v3 07/11] KVM: MMU: fast prefetch spte on invlpg path Xiao Guangrong
2011-08-30 2:37 ` [PATCH v3 08/11] KVM: MMU: remove unnecessary kvm_mmu_free_some_pages Xiao Guangrong
2011-08-30 2:37 ` [PATCH v3 09/11] KVM: MMU: split kvm_mmu_pte_write function Xiao Guangrong
2011-08-30 2:37 ` [PATCH v3 10/11] KVM: MMU: fix detecting misaligned accessed Xiao Guangrong
2011-08-30 2:38 ` [PATCH v3 11/11] KVM: MMU: improve write flooding detected Xiao Guangrong
2011-09-13 11:07 ` Avi Kivity
2011-09-13 19:19 ` Xiao Guangrong
2011-09-14 9:59 ` Avi Kivity
2011-09-13 9:51 ` [PATCH v3 01/11] KVM: MMU: avoid pte_list_desc running out in kvm_mmu_pte_write Avi Kivity
2011-09-13 10:24 ` Xiao Guangrong
2011-09-13 10:50 ` Avi Kivity
2011-09-13 19:31 ` Xiao Guangrong
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=4E6FA189.7080607@cn.fujitsu.com \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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