From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758944AbcBYHdW (ORCPT ); Thu, 25 Feb 2016 02:33:22 -0500 Received: from mga01.intel.com ([192.55.52.88]:58042 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbcBYHdV (ORCPT ); Thu, 25 Feb 2016 02:33:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,497,1449561600"; d="scan'208";a="659000043" Subject: Re: [PATCH 08/12] KVM: MMU: move zap/flush to kvm_mmu_get_page To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1456319873-34182-1-git-send-email-pbonzini@redhat.com> <1456319873-34182-9-git-send-email-pbonzini@redhat.com> Cc: yoshikawa_takuya_b1@lab.ntt.co.jp, mtosatti@redhat.com From: Xiao Guangrong Message-ID: <56CEAE21.90601@linux.intel.com> Date: Thu, 25 Feb 2016 15:32:49 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1456319873-34182-9-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/24/2016 09:17 PM, Paolo Bonzini wrote: > kvm_mmu_get_page is the only caller of kvm_sync_page_transient > and kvm_sync_pages. Moving the handling of the invalid_list there > removes the need for the underdocumented kvm_sync_page_transient > function. > > Signed-off-by: Paolo Bonzini > --- > Guangrong, at this point I am confused about why > kvm_sync_page_transient didn't clear sp->unsync. Do > you remember? Or perhaps kvm_mmu_get_page could just > call kvm_sync_page now? > It is the optimization to reduce write-protect as changing unsync to sync need to write-protect the page and sync all sptes pointing to the same gfn. However, after syncing the content between unsync-ed spte and guest pte, we can reuse this spte perfectly. > Also, can you explain the need_sync variable in > kvm_mmu_get_page? This is because we need to to protect the semanteme of 'unsync spte' as only the spte on last level (level = 1) can be unsync so that if a spte on the upper level is created we should eliminate all the unsync sptes pointing to the same gfn. As you have already merged this patchset to the kvm tree, i will post a patch to comment these cases to make the code be more understandable.