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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrea Arcangeli
Date: Monday, May 5, 2008 - 10:14 am

On Mon, May 05, 2008 at 11:21:13AM -0500, Jack Steiner wrote:

It'd been better to know about this detail earlier, but frankly this
is a minor problem, the important thing is we all agree together on
the more difficult parts ;).


I don't like this solution very much. Nor GRU nor KVM will call
mmu_notifier_register inside the mmap_sem protected sections, so I
think the default mmu_notifier_register should be smp safe by itself
without requiring additional locks to be artificially taken externally
(especially because the need for mmap_sem in write mode is a very
mmu_notifier internal detail).


The interface would change like this:

#define MMU_NOTIFIER_REGISTER_MMAP_SEM (1<<0)
void mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm,
			   unsigned long mmu_notifier_flags);

A third solution is to add:

/*
 * This must can be called instead of mmu_notifier_register after
 * taking the mmap_sem in write mode (read mode isn't enough).
 */
void __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm);

Do you still prefer the bitflag or you prefer
__mmu_notifier_register. It's ok either ways, except
__mmu_notifier_reigster could be removed in a backwards compatible
way, the bitflag can't.


Sure! In the meantime go ahead this way.

Another very minor change I've been thinking about is to make
->release not mandatory. It happens that with KVM ->release isn't
strictly required because after mm_users reaches 0, no guest could
possibly run anymore. So I'm using ->release only for debugging by
placing -1UL in the root shadow pagetable, to be sure ;). So because
at least one user won't strictly require ->release being consistent in
having all method optional may be nicer. Alternatively we could make
them all mandatory and if somebody doesn't need one of the methods it
should implement it as a dummy function. Both ways have pros and cons,
but they don't make any difference to us in practice. If I've to
change the patch for the mmap_sem taken during registration I may as
well cleanup this minor bit.

Also note the rculist.h patch you sent earlier won't work against
mainline so I can't incorporate it in my patchset, Andrew will have to
apply it as mmu-notifier-core-mm after incorporating mmu-notifier-core
into -mm.

Until a new update is released, mmu-notifier-core v15 remains ok for
merging, no known bugs, here we're talking about a new and simple
feature and a tiny cleanup that nobody can notice anyway.
--
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 -&gt; v16 diff, Andrea Arcangeli, (Tue May 6, 10:53 am)