Since commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK")
current_is_64bit() is quivalent to !is_32bit_task().
Remove the redundant function.
Link: https://github.com/linuxppc/issues/issues/275
Link: https://lkml.org/lkml/2019/9/12/540
Fixes: linuxppc#275
Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Michal Suchanek <[email protected]>
---
arch/powerpc/perf/callchain.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index c84bbd4298a0..35d542515faf 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -284,16 +284,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
}
}
-static inline int current_is_64bit(void)
-{
- /*
- * We can't use test_thread_flag() here because we may be on an
- * interrupt stack, and the thread flags don't get copied over
- * from the thread_info on the main stack to the interrupt stack.
- */
- return !test_ti_thread_flag(task_thread_info(current), TIF_32BIT);
-}
-
#else /* CONFIG_PPC64 */
/*
* On 32-bit we just access the address and let hash_page create a
@@ -321,11 +311,6 @@ static inline void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry
{
}
-static inline int current_is_64bit(void)
-{
- return 0;
-}
-
static inline int valid_user_sp(unsigned long sp, int is_64)
{
if (!sp || (sp & 7) || sp > TASK_SIZE - 32)
@@ -486,7 +471,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
void
perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
{
- if (current_is_64bit())
+ if (!is_32bit_task())
perf_callchain_user_64(entry, regs);
else
perf_callchain_user_32(entry, regs);
--
2.23.0
Le 26/11/2019 à 21:13, Michal Suchanek a écrit :
> Since commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK")
> current_is_64bit() is quivalent to !is_32bit_task().
> Remove the redundant function.
>
> Link: https://github.com/linuxppc/issues/issues/275
> Link: https://lkml.org/lkml/2019/9/12/540
>
> Fixes: linuxppc#275
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Michal Suchanek <[email protected]>
This change is already in powerpc/next, see
https://github.com/linuxppc/linux/commit/42484d2c0f82b666292faf6668c77b49a3a04bc0
Christophe
> ---
> arch/powerpc/perf/callchain.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
> index c84bbd4298a0..35d542515faf 100644
> --- a/arch/powerpc/perf/callchain.c
> +++ b/arch/powerpc/perf/callchain.c
> @@ -284,16 +284,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
> }
> }
>
> -static inline int current_is_64bit(void)
> -{
> - /*
> - * We can't use test_thread_flag() here because we may be on an
> - * interrupt stack, and the thread flags don't get copied over
> - * from the thread_info on the main stack to the interrupt stack.
> - */
> - return !test_ti_thread_flag(task_thread_info(current), TIF_32BIT);
> -}
> -
> #else /* CONFIG_PPC64 */
> /*
> * On 32-bit we just access the address and let hash_page create a
> @@ -321,11 +311,6 @@ static inline void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry
> {
> }
>
> -static inline int current_is_64bit(void)
> -{
> - return 0;
> -}
> -
> static inline int valid_user_sp(unsigned long sp, int is_64)
> {
> if (!sp || (sp & 7) || sp > TASK_SIZE - 32)
> @@ -486,7 +471,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
> void
> perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
> {
> - if (current_is_64bit())
> + if (!is_32bit_task())
> perf_callchain_user_64(entry, regs);
> else
> perf_callchain_user_32(entry, regs);
>
On Wed, Nov 27, 2019 at 06:41:09AM +0100, Christophe Leroy wrote:
>
>
> Le 26/11/2019 ? 21:13, Michal Suchanek a ?crit?:
> > Since commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK")
> > current_is_64bit() is quivalent to !is_32bit_task().
> > Remove the redundant function.
> >
> > Link: https://github.com/linuxppc/issues/issues/275
> > Link: https://lkml.org/lkml/2019/9/12/540
> >
> > Fixes: linuxppc#275
> > Suggested-by: Christophe Leroy <[email protected]>
> > Signed-off-by: Michal Suchanek <[email protected]>
>
> This change is already in powerpc/next, see https://github.com/linuxppc/linux/commit/42484d2c0f82b666292faf6668c77b49a3a04bc0
Right, needs rebase.
Thanks
Michal
>
> Christophe
>
> > ---
> > arch/powerpc/perf/callchain.c | 17 +----------------
> > 1 file changed, 1 insertion(+), 16 deletions(-)
> >
> > diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
> > index c84bbd4298a0..35d542515faf 100644
> > --- a/arch/powerpc/perf/callchain.c
> > +++ b/arch/powerpc/perf/callchain.c
> > @@ -284,16 +284,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
> > }
> > }
> > -static inline int current_is_64bit(void)
> > -{
> > - /*
> > - * We can't use test_thread_flag() here because we may be on an
> > - * interrupt stack, and the thread flags don't get copied over
> > - * from the thread_info on the main stack to the interrupt stack.
> > - */
> > - return !test_ti_thread_flag(task_thread_info(current), TIF_32BIT);
> > -}
> > -
> > #else /* CONFIG_PPC64 */
> > /*
> > * On 32-bit we just access the address and let hash_page create a
> > @@ -321,11 +311,6 @@ static inline void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry
> > {
> > }
> > -static inline int current_is_64bit(void)
> > -{
> > - return 0;
> > -}
> > -
> > static inline int valid_user_sp(unsigned long sp, int is_64)
> > {
> > if (!sp || (sp & 7) || sp > TASK_SIZE - 32)
> > @@ -486,7 +471,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
> > void
> > perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
> > {
> > - if (current_is_64bit())
> > + if (!is_32bit_task())
> > perf_callchain_user_64(entry, regs);
> > else
> > perf_callchain_user_32(entry, regs);
> >