public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: Christoph Lameter <clameter-sJ/iWh9BUns@public.gmane.org>
Cc: Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>,
	Nick Piggin <npiggin-l3A5Bk7waGM@public.gmane.org>,
	Andrea Arcangeli <andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	steiner-sJ/iWh9BUns@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	daniel.blueman-xqY44rlHlBpWk0Htik3J/w@public.gmane.org,
	holt-sJ/iWh9BUns@public.gmane.org,
	Hugh Dickins <hugh-DTz5qymZ9yRBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH] mmu notifiers #v2
Date: Tue, 15 Jan 2008 15:28:27 +1100	[thread overview]
Message-ID: <1200371307.10470.15.camel@pasglop> (raw)
In-Reply-To: <Pine.LNX.4.64.0801141154240.8300-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>


On Mon, 2008-01-14 at 12:02 -0800, Christoph Lameter wrote:
> On Sun, 13 Jan 2008, Andrea Arcangeli wrote:
> 
> > About the locking perhaps I'm underestimating it, but by following the
> > TLB flushing analogy, by simply clearing the shadow ptes (with kvm
> > mmu_lock spinlock to avoid racing with other vcpu spte accesses of
> > course) and flushing the shadow-pte after clearing the main linux pte,
> > it should be enough to serialize against shadow-pte page faults that
> > would call into get_user_pages. Flushing the host TLB before or after
> > the shadow-ptes shouldn't matter.
> 
> Hmmm... In most of the callsites we hold a writelock on mmap_sem right?

Not in unmap_mapping_range() afaik.

> > Comments welcome... especially from SGI/IBM/Quadrics and all other
> > potential users of this functionality.
> 
> > There are also certain details I'm uncertain about, like passing 'mm'
> > to the lowlevel methods, my KVM usage of the invalidate_page()
> > notifier for example only uses 'mm' for a BUG_ON for example:
> 
> Passing mm is fine as long as mmap_sem is held.

Passing mm is always a good idea, regardless of the mmap_sem, it can be
useful for lots of other things :-)

> > diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
> > --- a/include/asm-generic/pgtable.h
> > +++ b/include/asm-generic/pgtable.h
> > @@ -86,6 +86,7 @@ do {									\
> >  	pte_t __pte;							\
> >  	__pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep);	\
> >  	flush_tlb_page(__vma, __address);				\
> > +	mmu_notifier(invalidate_page, (__vma)->vm_mm, __address);	\
> >  	__pte;								\
> >  })
> >  #endif
> 
> Hmmm... this is ptep_clear_flush? What about the other uses of 
> flush_tlb_page in asm-generic/pgtable.h and related uses in arch code?
> (would help if your patches would mention the function name in the diff 
> headers)

Note that last I looked, a lot of these were stale. Might be time to
resume my spring/summer cleaning of page table accessors...

> > +#define mmu_notifier(function, mm, args...)				\
> > +	do {								\
> > +		struct mmu_notifier *__mn;				\
> > +		struct hlist_node *__n;					\
> > +									\
> > +		hlist_for_each_entry(__mn, __n, &(mm)->mmu_notifier, hlist) \
> > +			if (__mn->ops->function)			\
> > +				__mn->ops->function(__mn, mm, args);	\
> > +	} while (0)
> 
> Does this have to be inline? ptep_clear_flush will become quite big
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo-Bw31MaZKKs0EbZ0PF+XxCw@public.gmane.org  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"> email-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org </a>


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

  parent reply	other threads:[~2008-01-15  4:28 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-13 16:24 [PATCH] mmu notifiers #v2 Andrea Arcangeli
     [not found] ` <20080113162418.GE8736-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-13 21:11   ` Benjamin Herrenschmidt
2008-01-14 20:02   ` Christoph Lameter
     [not found]     ` <Pine.LNX.4.64.0801141154240.8300-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-15  4:28       ` Benjamin Herrenschmidt [this message]
2008-01-15 12:44       ` Andrea Arcangeli
     [not found]         ` <20080115124449.GK30812-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-15 20:18           ` Benjamin Herrenschmidt
2008-01-16  1:06             ` Andrea Arcangeli
2008-01-16 17:42   ` Rik van Riel
     [not found]     ` <20080116124256.44033d48-Fuq27k0DHcCSkoNiqTzCLQ@public.gmane.org>
2008-01-16 17:48       ` Izik Eidus
     [not found]         ` <478E4356.7030303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-17 16:23           ` Andrea Arcangeli
2008-01-17 18:21             ` Izik Eidus
     [not found]               ` <478F9C9C.7070500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-17 19:32                 ` Andrea Arcangeli
     [not found]                   ` <20080117193252.GC24131-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-21 12:52                     ` [PATCH] mmu notifiers #v3 Andrea Arcangeli
     [not found]                       ` <20080121125204.GJ6970-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-22  2:21                         ` Rik van Riel
2008-01-22 14:12                         ` Avi Kivity
     [not found]                           ` <4795F9D2.1050503-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-22 14:43                             ` Andrea Arcangeli
     [not found]                               ` <20080122144332.GE7331-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-22 20:08                                 ` [PATCH] mmu notifiers #v4 Andrea Arcangeli
     [not found]                                   ` <20080122200858.GB15848-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-22 20:34                                     ` [PATCH] export notifier #1 Christoph Lameter
     [not found]                                       ` <Pine.LNX.4.64.0801221232040.28197-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-22 22:31                                         ` Andrea Arcangeli
     [not found]                                           ` <20080122223139.GD15848-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-22 22:53                                             ` Christoph Lameter
     [not found]                                               ` <Pine.LNX.4.64.0801221433080.2271-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-23 10:27                                                 ` Avi Kivity
     [not found]                                                   ` <479716AD.5070708-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-23 10:52                                                     ` Robin Holt
2008-01-23 12:04                                                       ` [kvm-devel] " Andrea Arcangeli
     [not found]                                                         ` <20080123120446.GF15848-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-23 12:34                                                           ` Robin Holt
2008-01-23 19:48                                                           ` Christoph Lameter
     [not found]                                                             ` <Pine.LNX.4.64.0801231147370.13547-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-23 19:58                                                               ` Robin Holt
     [not found]                                                       ` <20080123105246.GG26420-sJ/iWh9BUns@public.gmane.org>
2008-01-23 19:47                                                         ` Christoph Lameter
     [not found]                                                           ` <Pine.LNX.4.64.0801231145210.13547-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-24  5:56                                                             ` Avi Kivity
     [not found]                                                               ` <4798289B.1000007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24 12:26                                                                 ` Andrea Arcangeli
     [not found]                                                                   ` <20080124122623.GK7141-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-24 12:34                                                                     ` Avi Kivity
2008-01-23 11:41                                                 ` Andrea Arcangeli
     [not found]                                                   ` <20080123114136.GE15848-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-23 12:32                                                     ` Robin Holt
     [not found]                                                       ` <20080123123230.GH26420-sJ/iWh9BUns@public.gmane.org>
2008-01-23 17:33                                                         ` Andrea Arcangeli
     [not found]                                                           ` <20080123173325.GG7141-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-23 20:27                                                             ` Christoph Lameter
2008-01-24 15:42                                                               ` [kvm-devel] " Andrea Arcangeli
     [not found]                                                                 ` <20080124154239.GP7141-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-24 20:07                                                                   ` Christoph Lameter
     [not found]                                                                     ` <Pine.LNX.4.64.0801241205510.22285-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-25  6:35                                                                       ` Avi Kivity
2008-01-23 20:18                                                     ` Christoph Lameter
     [not found]                                                       ` <Pine.LNX.4.64.0801231149150.13547-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-24 14:34                                                         ` Andrea Arcangeli
     [not found]                                                           ` <20080124143454.GN7141-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-24 14:41                                                             ` Andrea Arcangeli
2008-01-24 15:15                                                             ` Avi Kivity
     [not found]                                                               ` <4798AB96.4000408-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24 15:18                                                                 ` Avi Kivity
2008-01-24 20:01                                                             ` Christoph Lameter
2008-01-22 23:36                                         ` Benjamin Herrenschmidt
2008-01-23  0:40                                           ` Christoph Lameter
     [not found]                                             ` <Pine.LNX.4.64.0801221640010.3329-RYO/mD75kfhx2SFC9UQUAuF7EQX82lMiAL8bYrjMMd8@public.gmane.org>
2008-01-23  1:21                                               ` Robin Holt
2008-01-23 12:51                                         ` Gerd Hoffmann
     [not found]                                           ` <4797384B.7080200-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-23 13:19                                             ` Robin Holt
     [not found]                                               ` <20080123131939.GJ26420-sJ/iWh9BUns@public.gmane.org>
2008-01-23 14:12                                                 ` Gerd Hoffmann
     [not found]                                                   ` <47974B54.30407-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-23 14:18                                                     ` Robin Holt
     [not found]                                                       ` <20080123141814.GE3058-sJ/iWh9BUns@public.gmane.org>
2008-01-23 14:35                                                         ` Gerd Hoffmann
     [not found]                                                           ` <479750CA.4070101-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-23 15:48                                                             ` Robin Holt
2008-01-23 14:17                                                 ` Avi Kivity
     [not found]                                                   ` <47974C78.7050509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24  4:03                                                     ` Benjamin Herrenschmidt
2008-01-23 15:41                                           ` [kvm-devel] " Andrea Arcangeli
     [not found]                                             ` <20080123154130.GC7141-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-23 17:47                                               ` Gerd Hoffmann
     [not found]                                                 ` <47977DCA.3040904-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-24  6:01                                                   ` Avi Kivity
2008-01-24  6:45                                                 ` [kvm-devel] " Jeremy Fitzhardinge
2008-01-23 20:40                                               ` Christoph Lameter
2008-01-24  2:00                                     ` Enhance mmu notifiers to accomplish a lockless implementation (incomplete) Robin Holt
     [not found]                                       ` <20080124020007.GL26420-sJ/iWh9BUns@public.gmane.org>
2008-01-24  4:05                                         ` Robin Holt
2008-01-22 19:28                       ` [PATCH] mmu notifiers #v3 Peter Zijlstra
2008-01-22 20:31                         ` Christoph Lameter
2008-01-22 20:31                         ` Andrea Arcangeli
     [not found]                           ` <20080122203125.GC15848-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org>
2008-01-22 22:10                             ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1200371307.10470.15.camel@pasglop \
    --to=benh-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
    --cc=akpm-3NddpPZAyC0@public.gmane.org \
    --cc=andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=clameter-sJ/iWh9BUns@public.gmane.org \
    --cc=daniel.blueman-xqY44rlHlBpWk0Htik3J/w@public.gmane.org \
    --cc=holt-sJ/iWh9BUns@public.gmane.org \
    --cc=hugh-DTz5qymZ9yRBDgjK7y7TUQ@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=npiggin-l3A5Bk7waGM@public.gmane.org \
    --cc=steiner-sJ/iWh9BUns@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox