* TLB flushes on s390
@ 2015-05-06 11:29 Kirill A. Shutemov
2015-05-06 12:00 ` Martin Schwidefsky
0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-05-06 11:29 UTC (permalink / raw)
To: Martin Schwidefsky, Heiko Carstens; +Cc: linux-mm
Hi,
I'm looking though s390 code around page table handling and I found that
in many places s390 does tlb flush before changing page table entry.
Let's look for instance on pmdp_clear_flush() implementation on s390.
It's implemented with pmdp_get_and_clear() which does pmdp_flush_direct()
*before* pmd_clear(). That's invert order comparing to generic
pmdp_flush_direct().
The question is what prevents tlb from being re-fill between flushing tlb
and clearing page table entry?
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: TLB flushes on s390
2015-05-06 11:29 TLB flushes on s390 Kirill A. Shutemov
@ 2015-05-06 12:00 ` Martin Schwidefsky
2015-05-06 12:50 ` Kirill A. Shutemov
0 siblings, 1 reply; 4+ messages in thread
From: Martin Schwidefsky @ 2015-05-06 12:00 UTC (permalink / raw)
To: Kirill A. Shutemov; +Cc: Heiko Carstens, linux-mm
On Wed, 6 May 2015 14:29:39 +0300
"Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> I'm looking though s390 code around page table handling and I found that
> in many places s390 does tlb flush before changing page table entry.
Uhh, have fun with that.. it is complicated :-/
> Let's look for instance on pmdp_clear_flush() implementation on s390.
> It's implemented with pmdp_get_and_clear() which does pmdp_flush_direct()
> *before* pmd_clear(). That's invert order comparing to generic
> pmdp_flush_direct().
>
> The question is what prevents tlb from being re-fill between flushing tlb
> and clearing page table entry?
Look again at pmdp_flush_direct(), either __pmdp_idte_local or __pmdp_idte is
called. Both functions use the IDTE instruction but in two different flavors.
The mnemonic IDTE stands for invalidate-dat-table-entry, the instruction sets
the invalid bit in the PMD and flushes all TLB entries on all CPUs that are
affected by the now invalid PMD. The pmd_clear after the pmdp_flush_direct is
done to set all the other bits of the PMD to the "empty" state. The invalid
bit is already set prior to pmd_clear.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: TLB flushes on s390
2015-05-06 12:00 ` Martin Schwidefsky
@ 2015-05-06 12:50 ` Kirill A. Shutemov
2015-05-06 12:56 ` Martin Schwidefsky
0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-05-06 12:50 UTC (permalink / raw)
To: Martin Schwidefsky; +Cc: Heiko Carstens, linux-mm
On Wed, May 06, 2015 at 02:00:02PM +0200, Martin Schwidefsky wrote:
> On Wed, 6 May 2015 14:29:39 +0300
> "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>
> > I'm looking though s390 code around page table handling and I found that
> > in many places s390 does tlb flush before changing page table entry.
>
> Uhh, have fun with that.. it is complicated :-/
>
> > Let's look for instance on pmdp_clear_flush() implementation on s390.
> > It's implemented with pmdp_get_and_clear() which does pmdp_flush_direct()
> > *before* pmd_clear(). That's invert order comparing to generic
> > pmdp_flush_direct().
> >
> > The question is what prevents tlb from being re-fill between flushing tlb
> > and clearing page table entry?
>
> Look again at pmdp_flush_direct(), either __pmdp_idte_local or __pmdp_idte is
> called. Both functions use the IDTE instruction but in two different flavors.
> The mnemonic IDTE stands for invalidate-dat-table-entry, the instruction sets
> the invalid bit in the PMD and flushes all TLB entries on all CPUs that are
> affected by the now invalid PMD. The pmd_clear after the pmdp_flush_direct is
> done to set all the other bits of the PMD to the "empty" state. The invalid
> bit is already set prior to pmd_clear.
Okay, it makes some sense.
One more question: why does __tlb_flush_full()/__tlb_flush_asce() require
disabling preemption and pmdp_flush_direct() doesn't?
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: TLB flushes on s390
2015-05-06 12:50 ` Kirill A. Shutemov
@ 2015-05-06 12:56 ` Martin Schwidefsky
0 siblings, 0 replies; 4+ messages in thread
From: Martin Schwidefsky @ 2015-05-06 12:56 UTC (permalink / raw)
To: Kirill A. Shutemov; +Cc: Heiko Carstens, linux-mm
On Wed, 6 May 2015 15:50:00 +0300
"Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> On Wed, May 06, 2015 at 02:00:02PM +0200, Martin Schwidefsky wrote:
> > On Wed, 6 May 2015 14:29:39 +0300
> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> >
> > > I'm looking though s390 code around page table handling and I found that
> > > in many places s390 does tlb flush before changing page table entry.
> >
> > Uhh, have fun with that.. it is complicated :-/
> >
> > > Let's look for instance on pmdp_clear_flush() implementation on s390.
> > > It's implemented with pmdp_get_and_clear() which does pmdp_flush_direct()
> > > *before* pmd_clear(). That's invert order comparing to generic
> > > pmdp_flush_direct().
> > >
> > > The question is what prevents tlb from being re-fill between flushing tlb
> > > and clearing page table entry?
> >
> > Look again at pmdp_flush_direct(), either __pmdp_idte_local or __pmdp_idte is
> > called. Both functions use the IDTE instruction but in two different flavors.
> > The mnemonic IDTE stands for invalidate-dat-table-entry, the instruction sets
> > the invalid bit in the PMD and flushes all TLB entries on all CPUs that are
> > affected by the now invalid PMD. The pmd_clear after the pmdp_flush_direct is
> > done to set all the other bits of the PMD to the "empty" state. The invalid
> > bit is already set prior to pmd_clear.
>
> Okay, it makes some sense.
>
> One more question: why does __tlb_flush_full()/__tlb_flush_asce() require
> disabling preemption and pmdp_flush_direct() doesn't?
Easy: for pmdp_flush_direct you are required to hold the pmd-lock as you
modify the pmd. The spinlock provides the preempt_disable.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-06 12:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 11:29 TLB flushes on s390 Kirill A. Shutemov
2015-05-06 12:00 ` Martin Schwidefsky
2015-05-06 12:50 ` Kirill A. Shutemov
2015-05-06 12:56 ` Martin Schwidefsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox