From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM swapping with mmu notifiers Date: Tue, 15 Jan 2008 16:40:19 +0200 Message-ID: <478CC5D3.2040201@qumranet.com> References: <20080113133244.GC8736@v2.random> <20080114134539.GB15200@dmt> <478B6CFF.9070801@qumranet.com> <20080114142457.GF7062@v2.random> <478B833E.1020801@qumranet.com> <20080114174447.GA30812@v2.random> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Andrea Arcangeli Return-path: In-Reply-To: <20080114174447.GA30812-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Andrea Arcangeli wrote: > On Mon, Jan 14, 2008 at 05:43:58PM +0200, Avi Kivity wrote: > >> heavy handed. Maybe it can be fixed in some clever way with rcu or with a >> rwlock around the memory slot map. >> > > Ok, first the alias looked superflous so I just dropped it (the whole > point of the alias is to never call get_user_pages in the aliased hva, > so the notifiers should never trigger in those alias gfn ranges). > > Right, good point. Note that we can now replace aliases with slots; simply map the same hva range to two different gpa ranges (using a kvm-private memslot for backward compat). > And the code was doing hva->gfn->rmap, while I'm now doing hva->rmap > directly to avoid two loops over the memslot instead of only one. To > serialize hva_to_rmapp mmap_sem is taken (in any mode) or the mmu_lock > is taken, and it's enough to serialize the insertion with the mmu_lock > and setting userspace_addr to 0 before insertion if the buffer isn't > allocated by userland. Setting userspace_addr atomically will make the > memslot visible. > Can we do the locking change as a separate patch? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/