Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-14 Thread Oleg Nesterov
On 06/14, Oleg Nesterov wrote: > > So, unless you are going to remove pgd_lock altogether perhaps we can > rely on it the same way > > mb(); > spin_unlock_wait(&pgd_lock); > rmb(); > > > Avoids the barriers (and comments) on another side, but I can't say > I really like this... >

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-14 Thread Oleg Nesterov
On 06/14, Ingo Molnar wrote: > > So since we have a spin_lock() there already, Yes, I thought about task_lock() or pgd_lock too. > Also, since this is x86 specific code we could rely on the fact that > spinlock-acquire is a full memory barrier? we do not really need the full barrier if we re

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-14 Thread Ingo Molnar
* Oleg Nesterov wrote: > On 06/13, Ingo Molnar wrote: > > > > * Ingo Molnar wrote: > > > > > * Oleg Nesterov wrote: > > > > > > > > > > > Afaics, we need to ensure that: > > > > > > > > > + if (pgd_val(*pgd_src)) > > > > > + WRITE_ONCE(*pgd_dst,

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-13 Thread Oleg Nesterov
On 06/13, Ingo Molnar wrote: > > * Ingo Molnar wrote: > > > * Oleg Nesterov wrote: > > > > > > > > Afaics, we need to ensure that: > > > > > > > + if (pgd_val(*pgd_src)) > > > > + WRITE_ONCE(*pgd_dst, *pgd_src); > > > > > > either we notice the

[PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-13 Thread Ingo Molnar
Prepare for lockless PGD init: enable the arch_pgd_init_late() callback and add a 'careful' implementation of PGD init to it: only copy over non-zero entries. Since PGD entries only ever get added, this method catches any updates to swapper_pg_dir[] that might have occurred between early PGD init

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Ingo Molnar
* Ingo Molnar wrote: > * Oleg Nesterov wrote: > > > On 06/11, Ingo Molnar wrote: > > > > > > +void arch_pgd_init_late(struct mm_struct *mm, pgd_t *pgd) > > > +{ > > > + /* > > > + * This is called after a new MM has been made visible > > > + * in fork() or exec(). > > > + * > > > + * This

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Ingo Molnar
* Oleg Nesterov wrote: > On 06/13, Oleg Nesterov wrote: > > > > Afaics, we need to ensure that: > > > > > + if (pgd_val(*pgd_src)) > > > + WRITE_ONCE(*pgd_dst, *pgd_src); > > > > either we notice the recent update of this PGD, or (say) the subsequent > > s

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Ingo Molnar
* Oleg Nesterov wrote: > On 06/11, Ingo Molnar wrote: > > > > +void arch_pgd_init_late(struct mm_struct *mm, pgd_t *pgd) > > +{ > > + /* > > +* This is called after a new MM has been made visible > > +* in fork() or exec(). > > +* > > +* This barrier makes sure the MM is visibl

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Oleg Nesterov
On 06/13, Oleg Nesterov wrote: > > Afaics, we need to ensure that: > > > + if (pgd_val(*pgd_src)) > > + WRITE_ONCE(*pgd_dst, *pgd_src); > > either we notice the recent update of this PGD, or (say) the subsequent > sync_global_pgds() can miss the child. a

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Oleg Nesterov
On 06/11, Ingo Molnar wrote: > > +void arch_pgd_init_late(struct mm_struct *mm, pgd_t *pgd) > +{ > + /* > + * This is called after a new MM has been made visible > + * in fork() or exec(). > + * > + * This barrier makes sure the MM is visible to new RCU > + * walkers be

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-12 Thread Ingo Molnar
* Boris Ostrovsky wrote: > On 06/11/2015 10:07 AM, Ingo Molnar wrote: > > >diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c > >index fb0a9dd1d6e4..e0bf90470d70 100644 > >--- a/arch/x86/mm/pgtable.c > >+++ b/arch/x86/mm/pgtable.c > >@@ -391,6 +391,63 @@ pgd_t *pgd_alloc(struct mm_struc

Re: [PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-11 Thread Boris Ostrovsky
On 06/11/2015 10:07 AM, Ingo Molnar wrote: diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index fb0a9dd1d6e4..e0bf90470d70 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -391,6 +391,63 @@ pgd_t *pgd_alloc(struct mm_struct *mm) return NULL; } +/* + * Init

[PATCH 06/12] x86/mm: Enable and use the arch_pgd_init_late() method

2015-06-11 Thread Ingo Molnar
Prepare for lockless PGD init: enable the arch_pgd_init_late() callback and add a 'careful' implementation of PGD init to it: only copy over non-zero entries. Since PGD entries only ever get added, this method catches any updates to swapper_pg_dir[] that might have occured between early PGD init a