From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 0/2] Simplify RCU freeing of shadow pages Date: Mon, 23 Apr 2012 15:39:14 +0800 Message-ID: <4F950722.2040208@linux.vnet.ibm.com> References: <1334852797-28167-1-git-send-email-avi@redhat.com> <20120421023132.GA18062@amt.cnet> <4F93EDD7.2080704@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from e28smtp09.in.ibm.com ([122.248.162.9]:48606 "EHLO e28smtp09.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257Ab2DWHjW (ORCPT ); Mon, 23 Apr 2012 03:39:22 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Apr 2012 13:09:19 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3N7dGDO4092110 for ; Mon, 23 Apr 2012 13:09:16 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3ND9rQH030328 for ; Mon, 23 Apr 2012 23:09:53 +1000 In-Reply-To: <4F93EDD7.2080704@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/22/2012 07:39 PM, Avi Kivity wrote: > On 04/21/2012 05:31 AM, Marcelo Tosatti wrote: >> On Thu, Apr 19, 2012 at 07:26:35PM +0300, Avi Kivity wrote: >>> This patchset simplifies the freeing by RCU of mmu pages. >>> >>> Xiao, I'm sure you thought of always freeing by RCU. Why didn't you choose >>> this way? I saves a couple of atomics in the fast path. >>> >>> Avi Kivity (2): >>> KVM: MMU: Always free shadow pages using RCU >>> KVM: MMU: Recover space used by rcu_head in struct kvm_mmu_page >>> >>> arch/x86/include/asm/kvm_host.h | 9 +++--- >>> arch/x86/kvm/mmu.c | 58 ++++++++------------------------------- >>> 2 files changed, 15 insertions(+), 52 deletions(-) >> >> Check Documentation/RCU/checklist.txt item 8. >> >> a. Keeping a count of the number of data-structure elements >> used by the RCU-protected data structure, including >> those waiting for a grace period to elapse. Enforce a >> limit on this number, stalling updates as needed to allow >> previously deferred frees to complete. Alternatively, >> limit only the number awaiting deferred free rather than >> the total number of elements. >> > > That's true before and after the patch. Currently the amount of memory > that depends on rcu for freeing is unbounded. > > Maybe we should protect the fast path using local_irq_disable() instead > of rcu_read_lock(), like x86 page tables. That means that > kvm_flush_remote_tlbs() needs to ignore OUTSIDE_GUEST_MODE when IPIing > vcpu threads. So, IPI is unconditionally sent, do we need introduce a new MODE (say STOP_SP_FREE) to reduce IPI?