Re: [PATCH 01 of 11] mmu-notifier-core

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrea Arcangeli
Date: Tuesday, May 6, 2008 - 7:46 am

On Mon, May 05, 2008 at 02:46:25PM -0500, Jack Steiner wrote:

Yes, this will also happen in case the well behaved task receives
SIGKILL, so you can test it that way too.


GRU TLB flushes aren't skipped because your flag is set but because
__mmu_notifier_release already executed
list_del_init_rcu(&grunotifier->hlist) before proceeding with
unmap_vmas.


As long as nobody can write through the already established gru tlbs
and nobody can establish new tlbs after exit_mmap run you don't
strictly need ->release.


You can remove the flag and ->release and ->clear_flush_young (if you
keep clear_flush_young implemented it should return 0). The
synchronize_rcu after mmu_notifier_register can also be dropped thanks
to mm_lock(). gru_drop_mmu_notifier should be careful with current->mm
if you're using an fd and if the fd can be passed to a different task
through unix sockets (you should probably fail any operation if
current->mm != gru->mm).

The way I use ->release in KVM is to set the root hpa to -1UL
(invalid) as a debug trap. That's only for debugging because even if
tlb entries and sptes are still established on the secondary mmu they
are only relevant when the cpu jumps to guest mode and that can never
happen again after exit_mmap is started.


Well that function needs fixing w.r.t. srcu. Are you sure you want to
search for mn->ops == gru_mmuops and not for mn == gmn?  And if you
search for mn why can't you keep track of the mn being registered or
unregistered outside of the mmu_notifier layer? Set a bitflag in the
container after mmu_notifier_register returns and a clear it after
_unregister returns. I doubt saving one bitflag is worth searching the
list and your approach make it obvious that you've to protect the
bitflag and the register/unregister under write-mmap_sem
yourself. Otherwise the find function will return an object that can
be freed at any time if somebody calls unregister and
kfree. (synchronize_srcu in mmu_notifier_unregister won't wait for
anything but some outstanding srcu_read_lock)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00 of 11] mmu notifier #v15, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 01 of 11] mmu-notifier-core, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 02 of 11] get_task_mm, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 03 of 11] invalidate_page outside PT lock, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 04 of 11] free-pgtables, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 05 of 11] unmap vmas tlb flushing, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 06 of 11] rwsem contended, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 07 of 11] i_mmap_rwsem, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 08 of 11] anon-vma-rwsem, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 09 of 11] mm_lock-rwsem, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 10 of 11] export zap_page_range for XPMEM, Andrea Arcangeli, (Fri May 2, 8:05 am)
[PATCH 11 of 11] mmap sems, Andrea Arcangeli, (Fri May 2, 8:05 am)
Re: [PATCH 00 of 11] mmu notifier #v15, Jack Steiner, (Sat May 3, 4:09 am)
Re: [PATCH 01 of 11] mmu-notifier-core, Robin Holt, (Sun May 4, 12:13 pm)
Re: [PATCH 01 of 11] mmu-notifier-core, Andrea Arcangeli, (Sun May 4, 3:08 pm)
Re: [PATCH 01 of 11] mmu-notifier-core, Robin Holt, (Sun May 4, 7:25 pm)
Re: [PATCH 01 of 11] mmu-notifier-core, Jack Steiner, (Mon May 5, 9:21 am)
Re: [PATCH 01 of 11] mmu-notifier-core, Andrea Arcangeli, (Mon May 5, 10:14 am)
Re: [PATCH 01 of 11] mmu-notifier-core, Jack Steiner, (Mon May 5, 10:25 am)
Re: [PATCH 01 of 11] mmu-notifier-core, Andrea Arcangeli, (Mon May 5, 11:34 am)
Re: [PATCH 01 of 11] mmu-notifier-core, Jack Steiner, (Mon May 5, 12:46 pm)
Re: [PATCH 01 of 11] mmu-notifier-core, Andrea Arcangeli, (Tue May 6, 7:46 am)
mmu notifier v15 -> v16 diff, Andrea Arcangeli, (Tue May 6, 10:53 am)