* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
[not found] <014201d1d738$744c8f90$5ce5aeb0$@alibaba-inc.com>
@ 2016-07-06 4:03 ` Hillf Danton
2016-07-06 6:23 ` Martin Schwidefsky
0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2016-07-06 4:03 UTC (permalink / raw)
To: 'Martin Schwidefsky'; +Cc: linux-kernel, linux-mm
>
> +void ptep_invalidate_range(struct mm_struct *mm, unsigned long start,
> + unsigned long end, pte_t *ptep)
> +{
> + unsigned long nr;
> +
> + if (!MACHINE_HAS_IPTE_RANGE || mm_has_pgste(mm))
> + return;
> + preempt_disable();
> + nr = (end - start) >> PAGE_SHIFT;
> + /* If the flush is likely to be local skip the ipte range */
> + if (nr && !cpumask_equal(mm_cpumask(mm),
> + cpumask_of(smp_processor_id())))
s/smp/raw_smp/ to avoid adding schedule entry with page table
lock held?
> + __ptep_ipte_range(start, nr - 1, ptep);
> + preempt_enable();
> +}
> +EXPORT_SYMBOL(ptep_invalidate_range);
> +
thanks
Hillf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
2016-07-06 4:03 ` [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries Hillf Danton
@ 2016-07-06 6:23 ` Martin Schwidefsky
2016-07-06 6:42 ` Hillf Danton
0 siblings, 1 reply; 6+ messages in thread
From: Martin Schwidefsky @ 2016-07-06 6:23 UTC (permalink / raw)
To: Hillf Danton; +Cc: linux-kernel, linux-mm
On Wed, 06 Jul 2016 12:03:28 +0800
"Hillf Danton" <hillf.zj@alibaba-inc.com> wrote:
> >
> > +void ptep_invalidate_range(struct mm_struct *mm, unsigned long start,
> > + unsigned long end, pte_t *ptep)
> > +{
> > + unsigned long nr;
> > +
> > + if (!MACHINE_HAS_IPTE_RANGE || mm_has_pgste(mm))
> > + return;
> > + preempt_disable();
> > + nr = (end - start) >> PAGE_SHIFT;
> > + /* If the flush is likely to be local skip the ipte range */
> > + if (nr && !cpumask_equal(mm_cpumask(mm),
> > + cpumask_of(smp_processor_id())))
>
> s/smp/raw_smp/ to avoid adding schedule entry with page table
> lock held?
There can not be a schedule entry with either the page table lock held
or the preempt_disable() a few lines above.
> > + __ptep_ipte_range(start, nr - 1, ptep);
> > + preempt_enable();
> > +}
> > +EXPORT_SYMBOL(ptep_invalidate_range);
> > +
>
> thanks
> Hillf
>
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
2016-07-06 6:23 ` Martin Schwidefsky
@ 2016-07-06 6:42 ` Hillf Danton
2016-07-06 8:47 ` Martin Schwidefsky
0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2016-07-06 6:42 UTC (permalink / raw)
To: 'Martin Schwidefsky'; +Cc: 'linux-kernel', linux-mm
> > >
> > > +void ptep_invalidate_range(struct mm_struct *mm, unsigned long start,
> > > + unsigned long end, pte_t *ptep)
> > > +{
> > > + unsigned long nr;
> > > +
> > > + if (!MACHINE_HAS_IPTE_RANGE || mm_has_pgste(mm))
> > > + return;
> > > + preempt_disable();
> > > + nr = (end - start) >> PAGE_SHIFT;
> > > + /* If the flush is likely to be local skip the ipte range */
> > > + if (nr && !cpumask_equal(mm_cpumask(mm),
> > > + cpumask_of(smp_processor_id())))
> >
> > s/smp/raw_smp/ to avoid adding schedule entry with page table
> > lock held?
>
> There can not be a schedule entry with either the page table lock held
> or the preempt_disable() a few lines above.
>
Yes, Sir.
> > > + __ptep_ipte_range(start, nr - 1, ptep);
> > > + preempt_enable();
Then would you please, Sir, take a look at another case where
preempt is enabled?
> > > +}
> > > +EXPORT_SYMBOL(ptep_invalidate_range);
> > > +
> >
thanks
Hillf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
2016-07-06 6:42 ` Hillf Danton
@ 2016-07-06 8:47 ` Martin Schwidefsky
2016-07-06 9:26 ` Hillf Danton
0 siblings, 1 reply; 6+ messages in thread
From: Martin Schwidefsky @ 2016-07-06 8:47 UTC (permalink / raw)
To: Hillf Danton; +Cc: 'linux-kernel', linux-mm
On Wed, 06 Jul 2016 14:42:16 +0800
"Hillf Danton" <hillf.zj@alibaba-inc.com> wrote:
> > > >
> > > > +void ptep_invalidate_range(struct mm_struct *mm, unsigned long start,
> > > > + unsigned long end, pte_t *ptep)
> > > > +{
> > > > + unsigned long nr;
> > > > +
> > > > + if (!MACHINE_HAS_IPTE_RANGE || mm_has_pgste(mm))
> > > > + return;
> > > > + preempt_disable();
> > > > + nr = (end - start) >> PAGE_SHIFT;
> > > > + /* If the flush is likely to be local skip the ipte range */
> > > > + if (nr && !cpumask_equal(mm_cpumask(mm),
> > > > + cpumask_of(smp_processor_id())))
> > >
> > > s/smp/raw_smp/ to avoid adding schedule entry with page table
> > > lock held?
> >
> > There can not be a schedule entry with either the page table lock held
> > or the preempt_disable() a few lines above.
> >
> Yes, Sir.
>
> > > > + __ptep_ipte_range(start, nr - 1, ptep);
> > > > + preempt_enable();
>
> Then would you please, Sir, take a look at another case where
> preempt is enabled?
You are still a bit cryptic, are you trying to tell me that your hint is
about trying to avoid the preempt_enable() call?
The reason why I added the preempt_disable()/preempt_enable() pair to
ptep_invalidate_range is that I recently got bitten by a preempt problem
in the ptep_xchg_lazy() function which is used for ptep_get_and_clear().
Now ptep_get_and_clear() is used in vunmap_pte_range() which is called
while preemption is allowed.
To keep things symmetrical it seems sensible to explicitely disable
preemption on all ptep_xxx code paths with cpu mask checks, no?
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
2016-07-06 8:47 ` Martin Schwidefsky
@ 2016-07-06 9:26 ` Hillf Danton
2016-07-06 10:51 ` Martin Schwidefsky
0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2016-07-06 9:26 UTC (permalink / raw)
To: 'Martin Schwidefsky'; +Cc: 'linux-kernel', linux-mm
>
> You are still a bit cryptic,
>
Sorry, Sir, simply because I'm not native English speaker.
> are you trying to tell me that your hint is
> about trying to avoid the preempt_enable() call?
>
Yes, since we are already in the context with page table lock held.
thanks
Hillf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
2016-07-06 9:26 ` Hillf Danton
@ 2016-07-06 10:51 ` Martin Schwidefsky
0 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2016-07-06 10:51 UTC (permalink / raw)
To: Hillf Danton; +Cc: 'linux-kernel', linux-mm
On Wed, 06 Jul 2016 17:26:08 +0800
"Hillf Danton" <hillf.zj@alibaba-inc.com> wrote:
> >
> > You are still a bit cryptic,
> >
> Sorry, Sir, simply because I'm not native English speaker.
>
> > are you trying to tell me that your hint is
> > about trying to avoid the preempt_enable() call?
> >
> Yes, since we are already in the context with page table lock held.
Ok, got it. An option would be to drop the preempt_disable/preempt_enable,
add "BUG_ON(preemptible())" and use raw_smp_processor_id. But I wonder if
it is worth the effort.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-06 10:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <014201d1d738$744c8f90$5ce5aeb0$@alibaba-inc.com>
2016-07-06 4:03 ` [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries Hillf Danton
2016-07-06 6:23 ` Martin Schwidefsky
2016-07-06 6:42 ` Hillf Danton
2016-07-06 8:47 ` Martin Schwidefsky
2016-07-06 9:26 ` Hillf Danton
2016-07-06 10:51 ` Martin Schwidefsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox