Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437400 > unrolled thread

Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries

Started by"Hillf Danton" <hillf.zj@alibaba-inc.com>
First post2016-07-06 06:10 +0200
Last post2016-07-06 13:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-07-06 06:10 +0200
    Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page  table entries Martin Schwidefsky <schwidefsky@de.ibm.com> - 2016-07-06 08:30 +0200
      Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-07-06 08:50 +0200
        Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page  table entries Martin Schwidefsky <schwidefsky@de.ibm.com> - 2016-07-06 10:50 +0200
          Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-07-06 11:30 +0200
            Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page  table entries Martin Schwidefsky <schwidefsky@de.ibm.com> - 2016-07-06 13:00 +0200

#1437400 — Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries

From"Hillf Danton" <hillf.zj@alibaba-inc.com>
Date2016-07-06 06:10 +0200
SubjectRe: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
Message-ID<rRMjT-4hL-9@gated-at.bofh.it>
> 
> +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

[toc] | [next] | [standalone]


#1437468 — Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries

FromMartin Schwidefsky <schwidefsky@de.ibm.com>
Date2016-07-06 08:30 +0200
SubjectRe: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
Message-ID<rROvo-5Cf-35@gated-at.bofh.it>
In reply to#1437400
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.

[toc] | [prev] | [next] | [standalone]


#1437485

From"Hillf Danton" <hillf.zj@alibaba-inc.com>
Date2016-07-06 08:50 +0200
Message-ID<rROOJ-5IG-9@gated-at.bofh.it>
In reply to#1437468
> > >
> > > +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

[toc] | [prev] | [next] | [standalone]


#1437553 — Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries

FromMartin Schwidefsky <schwidefsky@de.ibm.com>
Date2016-07-06 10:50 +0200
SubjectRe: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
Message-ID<rRQGS-6SL-29@gated-at.bofh.it>
In reply to#1437485
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.

[toc] | [prev] | [next] | [standalone]


#1437585

From"Hillf Danton" <hillf.zj@alibaba-inc.com>
Date2016-07-06 11:30 +0200
Message-ID<rRRjA-7oL-13@gated-at.bofh.it>
In reply to#1437553
> 
> 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

[toc] | [prev] | [next] | [standalone]


#1437633 — Re: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries

FromMartin Schwidefsky <schwidefsky@de.ibm.com>
Date2016-07-06 13:00 +0200
SubjectRe: [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries
Message-ID<rRSIF-88t-7@gated-at.bofh.it>
In reply to#1437585
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web