From: Aneesh Kumar K.V Date: Wed, 13 Aug 2014 07:01:57 +0000 (+0530) Subject: powerpc/thp: Add write barrier after updating the valid bit X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=b0aa44a3dfae3d8f45bd1264349aa87f87b7774f;p=openwrt%2Fstaging%2Fblogic.git powerpc/thp: Add write barrier after updating the valid bit With hugepages, we store the hpte valid information in the pte page whose address is stored in the second half of the PMD. Use a write barrier to make sure clearing pmd busy bit and updating hpte valid info are ordered properly. CC: Signed-off-by: Aneesh Kumar K.V Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c index 826893fcb3a7..11f9a37ca2c6 100644 --- a/arch/powerpc/mm/hugepage-hash64.c +++ b/arch/powerpc/mm/hugepage-hash64.c @@ -172,8 +172,11 @@ repeat: mark_hpte_slot_valid(hpte_slot_array, index, slot); } /* - * No need to use ldarx/stdcx here + * The hpte valid is stored in the pgtable whose address is in the + * second half of the PMD. Order this against clearing of the busy bit in + * huge pmd. */ + smp_wmb(); *pmdp = __pmd(new_pmd & ~_PAGE_BUSY); return 0; }