* [PATCH] powerpc, mm: Fix build failure due to CONFIG_PPC_TRANSACTIONAL_MEM
@ 2015-04-21 11:04 Anshuman Khandual
2015-04-21 14:39 ` Aneesh Kumar K.V
0 siblings, 1 reply; 2+ messages in thread
From: Anshuman Khandual @ 2015-04-21 11:04 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mikey, aneesh.kumar
The function flush_hash_page fails to compile when the transaction memory
config option is turned off because there is a label at end of compound
statement. This patch moves the code block into a function tm_abort_tlbi
and calls it after the label thus fixing the build problem.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
arch/powerpc/mm/hash_utils_64.c: In function ‘flush_hash_hugepage’:
arch/powerpc/mm/hash_utils_64.c:1381:1: error: label at end of compound statement
tm_abort:
^
make[1]: *** [arch/powerpc/mm/hash_utils_64.o] Error 1
make: *** [arch/powerpc/mm] Error 2
arch/powerpc/mm/hash_utils_64.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2c2022d..b30b2b5 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -1326,6 +1326,25 @@ void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+static void tm_abort_tlbi(int local)
+{
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+ /* Transactions are not aborted by tlbiel, only tlbie.
+ * Without, syncing a page back to a block device w/ PIO could pick up
+ * transactional data (bad!) so we force an abort here. Before the
+ * sync the page will be made read-only, which will flush_hash_page.
+ * BIG ISSUE here: if the kernel uses a page from userspace without
+ * unmapping it first, it may see the speculated version.
+ */
+ if (local && cpu_has_feature(CPU_FTR_TM) &&
+ current->thread.regs &&
+ MSR_TM_ACTIVE(current->thread.regs->msr)) {
+ tm_enable();
+ tm_abort(TM_CAUSE_TLBI);
+ }
+#endif
+}
+
void flush_hash_hugepage(unsigned long vsid, unsigned long addr,
pmd_t *pmdp, unsigned int psize, int ssize,
unsigned long flags)
@@ -1379,21 +1398,7 @@ void flush_hash_hugepage(unsigned long vsid, unsigned long addr,
MMU_PAGE_16M, ssize, local);
}
tm_abort:
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
- /* Transactions are not aborted by tlbiel, only tlbie.
- * Without, syncing a page back to a block device w/ PIO could pick up
- * transactional data (bad!) so we force an abort here. Before the
- * sync the page will be made read-only, which will flush_hash_page.
- * BIG ISSUE here: if the kernel uses a page from userspace without
- * unmapping it first, it may see the speculated version.
- */
- if (local && cpu_has_feature(CPU_FTR_TM) &&
- current->thread.regs &&
- MSR_TM_ACTIVE(current->thread.regs->msr)) {
- tm_enable();
- tm_abort(TM_CAUSE_TLBI);
- }
-#endif
+ tm_abort_tlbi(local);
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc, mm: Fix build failure due to CONFIG_PPC_TRANSACTIONAL_MEM
2015-04-21 11:04 [PATCH] powerpc, mm: Fix build failure due to CONFIG_PPC_TRANSACTIONAL_MEM Anshuman Khandual
@ 2015-04-21 14:39 ` Aneesh Kumar K.V
0 siblings, 0 replies; 2+ messages in thread
From: Aneesh Kumar K.V @ 2015-04-21 14:39 UTC (permalink / raw)
To: Anshuman Khandual, linuxppc-dev; +Cc: mikey
Anshuman Khandual <khandual@linux.vnet.ibm.com> writes:
> The function flush_hash_page fails to compile when the transaction memory
> config option is turned off because there is a label at end of compound
> statement. This patch moves the code block into a function tm_abort_tlbi
> and calls it after the label thus fixing the build problem.
>
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
> arch/powerpc/mm/hash_utils_64.c: In function =E2=80=98flush_hash_hugepage=
=E2=80=99:
> arch/powerpc/mm/hash_utils_64.c:1381:1: error: label at end of compound s=
tatement
> tm_abort:
> ^
> make[1]: *** [arch/powerpc/mm/hash_utils_64.o] Error 1
> make: *** [arch/powerpc/mm] Error 2
>
> arch/powerpc/mm/hash_utils_64.c | 35 ++++++++++++++++++++---------------
> 1 file changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils=
_64.c
> index 2c2022d..b30b2b5 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -1326,6 +1326,25 @@ void flush_hash_page(unsigned long vpn, real_pte_t=
pte, int psize, int ssize,
> }
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +static void tm_abort_tlbi(int local)
> +{
> +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
> + /* Transactions are not aborted by tlbiel, only tlbie.
> + * Without, syncing a page back to a block device w/ PIO could pick up
> + * transactional data (bad!) so we force an abort here. Before the
> + * sync the page will be made read-only, which will flush_hash_page.
> + * BIG ISSUE here: if the kernel uses a page from userspace without
> + * unmapping it first, it may see the speculated version.
> + */
> + if (local && cpu_has_feature(CPU_FTR_TM) &&
> + current->thread.regs &&
> + MSR_TM_ACTIVE(current->thread.regs->msr)) {
> + tm_enable();
> + tm_abort(TM_CAUSE_TLBI);
> + }
> +#endif
> +}
> +
> void flush_hash_hugepage(unsigned long vsid, unsigned long addr,
> pmd_t *pmdp, unsigned int psize, int ssize,
> unsigned long flags)
> @@ -1379,21 +1398,7 @@ void flush_hash_hugepage(unsigned long vsid, unsig=
ned long addr,
> MMU_PAGE_16M, ssize, local);
> }
> tm_abort:
> -#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
> - /* Transactions are not aborted by tlbiel, only tlbie.
> - * Without, syncing a page back to a block device w/ PIO could pick up
> - * transactional data (bad!) so we force an abort here. Before the
> - * sync the page will be made read-only, which will flush_hash_page.
> - * BIG ISSUE here: if the kernel uses a page from userspace without
> - * unmapping it first, it may see the speculated version.
> - */
> - if (local && cpu_has_feature(CPU_FTR_TM) &&
> - current->thread.regs &&
> - MSR_TM_ACTIVE(current->thread.regs->msr)) {
> - tm_enable();
> - tm_abort(TM_CAUSE_TLBI);
> - }
> -#endif
> + tm_abort_tlbi(local);
> }
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>
> --=20
Why not just do ?. I will send a seperate patch=20
commit 52b6dcc8fe34b9d05b8a0f14d45fcdc3bef6c84f
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Date: Tue Apr 21 19:51:10 2015 +0530
powerpc/mm: Fix build error with CONFIG_PPC_TRANSACTIONAL_MEM disabled
=20=20=20=20
This fix the below build error
=20=20=20=20
arch/powerpc/mm/hash_utils_64.c: In function =E2=80=98flush_hash_hugepa=
ge=E2=80=99:
arch/powerpc/mm/hash_utils_64.c:1381:1: error: label at end of compound=
statement
tm_abort:
^
make[1]: *** [arch/powerpc/mm/hash_utils_64.o] Error 1
=20=20=20=20
Reported-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_6=
4.c
index 2c2022d16059..ac5c4373cd8b 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -1394,6 +1394,7 @@ tm_abort:
tm_abort(TM_CAUSE_TLBI);
}
#endif
+ return;
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
=20
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-21 14:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-21 11:04 [PATCH] powerpc, mm: Fix build failure due to CONFIG_PPC_TRANSACTIONAL_MEM Anshuman Khandual
2015-04-21 14:39 ` Aneesh Kumar K.V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).