TLB flushes on s390
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?
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · On Wed, 6 May 2015 14:29:39 +0300 "Kirill A. Shutemov" <[email protected]>…
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 :-/
Quoted 7 lines
Let's look for instance on
pmdp_clear_flush()implementation on s390. It's implemented withpmdp_get_and_clear()which doespmdp_flush_direct()*before*pmd_clear(). That's invert order comparing to genericpmdp_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.
Signature · 10 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 16 lines · Martin Schwidefsky
Quoted 2 lines · On Wed, 6 May 2015 14:29:39 +0300 "Kirill A. Shutemov" <[email protected]>…
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 :-/
Quoted 7 lines
Let's look for instance on
pmdp_clear_flush()implementation on s390. It's implemented withpmdp_get_and_clear()which doespmdp_flush_direct()*before*pmd_clear(). That's invert order comparing to genericpmdp_flush_direct().The question is what prevents tlb from being re-fill between flushing tlb and clearing page table entry?
Quoted 7 lines
Look again at
pmdp_flush_direct(), either__pmdp_idte_localor__pmdp_idteis 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. Thepmd_clearafter thepmdp_flush_directis done to set all the other bits of the PMD to the "empty" state. The invalid bit is already set prior topmd_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?
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 25 lines · On Wed, 6 May 2015 15:50:00 +0300 "Kirill A. Shutemov" <[email protected]>…
Quoted 16 lines · Martin Schwidefsky
Quoted 2 lines · On Wed, 6 May 2015 14:29:39 +0300 "Kirill A. Shutemov" <[email protected]>…
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 :-/
Quoted 7 lines
Let's look for instance on
pmdp_clear_flush()implementation on s390. It's implemented withpmdp_get_and_clear()which doespmdp_flush_direct()*before*pmd_clear(). That's invert order comparing to genericpmdp_flush_direct().The question is what prevents tlb from being re-fill between flushing tlb and clearing page table entry?
Quoted 7 lines
Look again at
pmdp_flush_direct(), either__pmdp_idte_localor__pmdp_idteis 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. Thepmd_clearafter thepmdp_flush_directis done to set all the other bits of the PMD to the "empty" state. The invalid bit is already set prior topmd_clear.
Quoted 4 lines
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.
Signature · 10 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>