Re: [PATCH 0/4 v2] kvm: rework KVM mmu_shrink() code
From: Xiaotian Feng
Date: Tue Aug 24 2010 - 05:50:28 EST
On Tue, Aug 24, 2010 at 10:07 AM, Marcelo Tosatti <mtosatti@xxxxxxxxxx> wrote:
> On Mon, Aug 23, 2010 at 07:11:11PM +0800, Xiaotian Feng wrote:
>> On Mon, Aug 23, 2010 at 6:27 PM, Avi Kivity <avi@xxxxxxxxxx> wrote:
>> > ÂOn 08/23/2010 01:22 PM, Avi Kivity wrote:
>> >>
>> >>
>> >> I see a lot of soft lockups with this patchset:
>> >
>> > This is running the emulator.flat test case, with shadow paging. ÂThis test
>> > triggers a lot (millions) of mmu mode switches.
>> >
>>
>> Does following patch fix your issue?
>>
>> Latest kvm mmu_shrink code rework makes kernel changes
>> kvm->arch.n_used_mmu_pages/
>> kvm->arch.n_max_mmu_pages at kvm_mmu_free_page/kvm_mmu_alloc_page,
>> which is called
>> by kvm_mmu_commit_zap_page. So the kvm->arch.n_used_mmu_pages or
>> kvm_mmu_available_pages(vcpu->kvm) is unchanged after kvm_mmu_commit_zap_page(),
>> This caused kvm_mmu_change_mmu_pages/__kvm_mmu_free_some_pages looping forever.
>> Moving kvm_mmu_commit_zap_page would make the while loop performs as normal.
>>
>> ---
>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index f52a965..7e09a21 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -1726,8 +1726,8 @@ void kvm_mmu_change_mmu_pages(struct kvm *kvm,
>> unsigned int goal_nr_mmu_pages)
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct kvm_mmu_page, link);
>> Â Â Â Â Â Â Â Â Â Â Â Â kvm_mmu_prepare_zap_page(kvm, page,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â&invalid_list);
>> + Â Â Â Â Â Â Â Â Â Â Â kvm_mmu_commit_zap_page(kvm, &invalid_list);
>> Â Â Â Â Â Â Â Â }
>> - Â Â Â Â Â Â Â kvm_mmu_commit_zap_page(kvm, &invalid_list);
>> Â Â Â Â Â Â Â Â goal_nr_mmu_pages = kvm->arch.n_used_mmu_pages;
>> Â Â Â Â }
>>
>> @@ -2976,9 +2976,9 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
>> Â Â Â Â Â Â Â Â sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct kvm_mmu_page, link);
>> Â Â Â Â Â Â Â Â kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list);
>> + Â Â Â Â Â Â Â kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
>> Â Â Â Â Â Â Â Â ++vcpu->kvm->stat.mmu_recycled;
>> Â Â Â Â }
>> - Â Â Â kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
>> Â}
>>
>> Âint kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code)
>
> Please resend with a signed-off-by, and proper subject for the patch.
It's available at: https://patchwork.kernel.org/patch/125431/
Thanks
Xiaotian
>
> Thanks
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/