Skip to content

Commit f7bcd46

Browse files
Peter Zijlstrahansendc
authored andcommitted
x86/mm/pae: Use WRITE_ONCE()
Disallow write-tearing, that would be really unfortunate. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20221022114425.038102604%40infradead.org
1 parent 7a9b8bd commit f7bcd46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/include/asm/pgtable-3level.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
*/
2828
static inline void native_set_pte(pte_t *ptep, pte_t pte)
2929
{
30-
ptep->pte_high = pte.pte_high;
30+
WRITE_ONCE(ptep->pte_high, pte.pte_high);
3131
smp_wmb();
32-
ptep->pte_low = pte.pte_low;
32+
WRITE_ONCE(ptep->pte_low, pte.pte_low);
3333
}
3434

3535
static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -58,16 +58,16 @@ static inline void native_set_pud(pud_t *pudp, pud_t pud)
5858
static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
5959
pte_t *ptep)
6060
{
61-
ptep->pte_low = 0;
61+
WRITE_ONCE(ptep->pte_low, 0);
6262
smp_wmb();
63-
ptep->pte_high = 0;
63+
WRITE_ONCE(ptep->pte_high, 0);
6464
}
6565

6666
static inline void native_pmd_clear(pmd_t *pmdp)
6767
{
68-
pmdp->pmd_low = 0;
68+
WRITE_ONCE(pmdp->pmd_low, 0);
6969
smp_wmb();
70-
pmdp->pmd_high = 0;
70+
WRITE_ONCE(pmdp->pmd_high, 0);
7171
}
7272

7373
static inline void native_pud_clear(pud_t *pudp)

0 commit comments

Comments
 (0)