Re: [PATCH] mmu notifiers #v5

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrea Arcangeli
Date: Thursday, January 31, 2008 - 4:28 pm

On Thu, Jan 31, 2008 at 12:18:54PM -0800, Christoph Lameter wrote:

The lock I take already protects up to 512 ptes yes. I call
invalidate_pages only across a _single_ 4k pagetable filled at max
with 512 pte_t mapping virutal addresses in a 2M naturally aligned
virtual range.

There's no smp race even for >4 CPUS. Check it again! I never call
invalidate_pages _outside_ the PT lock specific for that 4k pagetable
(a single PT lock protects 512 pte_t, not only a single one!).

Perhaps if you called it PMD lock there would be no misunderstanding:

    spinlock_t *__ptl = pte_lockptr(mm, pmd);	 \

(the pt lock is a function of the pmd, pte_t not!)


Obviously I checked them all yes, and this was much faster than hand
editing the .c files like you did indeed.


Yes, s390 is the only one.


There's no ptep_clear_flush override on x86 or I would have patched it
like I did to s390.

I had to change 2 lines instead of a single one, not such a big deal.


It is already serialized 100% properly sorry.


If you want I can turn this into a static inline, it would already
work fine. Certainly this isn't a blocker for merging given most
people will have MMU_NOTIFIER=y and this speedup compilation a tiny
bit for the embedded.


This is primarly to turn off the compiler warning, not to check the
parameters, but yes it should also checks the parameter types as a bonus.


You are under the wrong impression that invalidate_page could be
called on a range that spawns over a region that isn't 2M naturally
aligned and <2M in size.


This is a mess I've to say and I'm almost willing to return to a
_safe_rcu + and removing the autodisarming feature. KVM itself isn't
using mm_users but mm_count. then if somebody need to release the mn
inside ->relase they should mmu_notifier_unregister _inside_
->release and then call_rcu to release the mn (synchronize_rcu isn't
allowed inside ->release because of the rcu_spin_lock() that can't
schedule or it'll reach a quiescent point itself allowing the other
structures to be released.


The above is perfectly fine too. If you have doubts and your
misunderstanding of my 100% SMP safe locking isn't immediately clear,
think about this, how could it be safe to modify 512 ptes with a
single lock, regardless of the mmu notifiers?

I appreciate the review! I hope my entirely bug free and
strightforward #v5 will strongly increase the probability of getting
this in sooner than later. If something else it shows the approach I
prefer to cover GRU/KVM 100%, leaving the overkill mutex locking
requirements only to the mmu notifier users that can't deal with the
scalar and finegrined and already-taken/trashed PT lock.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 0/3] [RFC] MMU Notifiers V4, Christoph Lameter, (Wed Jan 30, 9:57 pm)
[PATCH] mmu notifiers #v5, Andrea Arcangeli, (Thu Jan 31, 10:18 am)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Thu Jan 31, 1:18 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Thu Jan 31, 4:09 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Thu Jan 31, 4:28 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Thu Jan 31, 4:41 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Thu Jan 31, 6:37 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Thu Jan 31, 6:44 pm)
Re: [PATCH] mmu notifiers #v5, Robin Holt, (Thu Jan 31, 7:23 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Thu Jan 31, 7:26 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Fri Feb 1, 5:00 am)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Fri Feb 1, 5:09 am)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Fri Feb 1, 12:23 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Sat Feb 2, 7:17 pm)
Re: [PATCH] mmu notifiers #v5, Jack Steiner, (Sat Feb 2, 8:14 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Sat Feb 2, 8:33 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Mon Feb 4, 12:09 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Mon Feb 4, 10:25 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Mon Feb 4, 11:11 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Tue Feb 5, 11:08 am)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Tue Feb 5, 11:17 am)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Tue Feb 5, 1:55 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Tue Feb 5, 3:06 pm)
Re: [PATCH] mmu notifiers #v5, Robin Holt, (Tue Feb 5, 3:12 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Tue Feb 5, 3:26 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Tue Feb 5, 4:10 pm)
Re: [PATCH] mmu notifiers #v5, Andrea Arcangeli, (Tue Feb 5, 4:47 pm)
Re: [PATCH] mmu notifiers #v5, Christoph Lameter, (Tue Feb 5, 5:04 pm)