From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Holt Subject: Re: [patch 1/3] mmu_notifier: Core code Date: Thu, 31 Jan 2008 21:52:49 -0600 Message-ID: <20080201035249.GE26420@sgi.com> References: <20080131045750.855008281@sgi.com> <20080131045812.553249048@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Andrea Arcangeli , Peter Zijlstra , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, steiner-sJ/iWh9BUns@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Avi Kivity , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, daniel.blueman-xqY44rlHlBpWk0Htik3J/w@public.gmane.org, Robin Holt To: Christoph Lameter Return-path: Content-Disposition: inline In-Reply-To: <20080131045812.553249048-sJ/iWh9BUns@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 > Index: linux-2.6/include/linux/mmu_notifier.h ... > +struct mmu_notifier_ops { ... > + /* > + * invalidate_range_begin() and invalidate_range_end() must paired. > + * Multiple invalidate_range_begin/ends may be nested or called > + * concurrently. That is legit. However, no new external references > + * may be established as long as any invalidate_xxx is running or > + * any invalidate_range_begin() and has not been completed through a > + * corresponding call to invalidate_range_end(). > + * > + * Locking within the notifier needs to serialize events correspondingly. > + * > + * If all invalidate_xx notifier calls take a driver lock then it is possible > + * to run follow_page() under the same lock. The lock can then guarantee > + * that no page is removed. That way we can avoid increasing the refcount > + * of the pages. > + * > + * invalidate_range_begin() must clear all references in the range > + * and stop the establishment of new references. > + * > + * invalidate_range_end() reenables the establishment of references. > + * > + * atomic indicates that the function is called in an atomic context. > + * We can sleep if atomic == 0. > + */ > + void (*invalidate_range_begin)(struct mmu_notifier *mn, > + struct mm_struct *mm, > + unsigned long start, unsigned long end, > + int atomic); > + > + void (*invalidate_range_end)(struct mmu_notifier *mn, > + struct mm_struct *mm, int atomic); I think we need to pass in the same start-end here as well. Without it, the first invalidate_range would have to block faulting for all addresses and would need to remain blocked until the last invalidate_range has completed. While this would work, (and will probably be how we implement it for the short term), it is far from ideal. Thanks, Robin ------------------------------------------------------------------------- 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/