]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.3/powerpc-thp-use-access_once-when-loading-pmdp.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / powerpc-thp-use-access_once-when-loading-pmdp.patch
1 From 7e467245bf5226db34c4b12d3cbacfa2f7a15a8b Mon Sep 17 00:00:00 2001
2 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
3 Date: Wed, 13 Aug 2014 12:32:02 +0530
4 Subject: powerpc/thp: Use ACCESS_ONCE when loading pmdp
5
6 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
7
8 commit 7e467245bf5226db34c4b12d3cbacfa2f7a15a8b upstream.
9
10 We would get wrong results in compiler recomputed old_pmd. Avoid
11 that by using ACCESS_ONCE
12
13 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
14 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 arch/powerpc/mm/hugepage-hash64.c | 4 +++-
19 1 file changed, 3 insertions(+), 1 deletion(-)
20
21 --- a/arch/powerpc/mm/hugepage-hash64.c
22 +++ b/arch/powerpc/mm/hugepage-hash64.c
23 @@ -84,7 +84,9 @@ int __hash_page_thp(unsigned long ea, un
24 * atomically mark the linux large page PMD busy and dirty
25 */
26 do {
27 - old_pmd = pmd_val(*pmdp);
28 + pmd_t pmd = ACCESS_ONCE(*pmdp);
29 +
30 + old_pmd = pmd_val(pmd);
31 /* If PMD busy, retry the access */
32 if (unlikely(old_pmd & _PAGE_BUSY))
33 return 0;