Skip to contentSkip to conversation

powerpc: restore current_thread_info()

PATCH In review Yury Norov 3 participants 4 messages May 7, 2019 – May 8, 2019 PowerPC

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

PATCH 1/1 powerpc: restore current_thread_info()

Commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK") removes the function current_thread_info(). It's wrong because the function is used in non-arch code and is part of API.

For my series of arm64/ilp32, after applying the patch
https://github.com/norov/linux/commit/b269e51eee66ffec3008a3effb12363b91754e49
it causes build break.

This patch restores current_thread_info().

---
 arch/powerpc/include/asm/thread_info.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/include/asm/thread_info.h +6 -0
index 8e1d0195ac36..f700bc80a607 100644
@@ -19,6 +19,7 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/cache.h>
+#include <asm/current.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/accounting.h>
@@ -57,6 +58,11 @@ struct thread_info {
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
 /* how to get the thread information struct from C */
+static inline struct thread_info *current_thread_info(void)
+{
+	return (struct thread_info *)current;
+}
+
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 
 #ifdef CONFIG_PPC_BOOK3S_64
Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · Yury Norov

Commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK") removes the function current_thread_info(). It's wrong because the function is used in non-arch code and is part of API.

In include/linux/thread_info.h:

#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
* For CONFIG_THREAD_INFO_IN_TASK kernels we need <asm/current.h> for the
* definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels,
* including <asm/current.h> can cause a circular dependency on some platforms. */
#include <asm/current.h>
#define current_thread_info() ((struct thread_info *)current) #endif

author
#2 lore raw
Quoted 7 lines · Al Viro
Quoted 3 lines · Yury Norov

Commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK") removes the function current_thread_info(). It's wrong because the function is used in non-arch code and is part of API.

In include/linux/thread_info.h:

Quoted 9 lines

#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
* For CONFIG_THREAD_INFO_IN_TASK kernels we need <asm/current.h> for the
* definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels,
* including <asm/current.h> can cause a circular dependency on some platforms. */
#include <asm/current.h>
#define current_thread_info() ((struct thread_info *)current) #endif

Ah, sorry. Then it might be my rebase issue. I was confused because Christophe didn't remove the comment to current_thread_info(), so I decided he removed it erroneously.

#3 lore raw
Quoted 18 lines · Yury Norov
Quoted 7 lines · Al Viro
Quoted 3 lines · Yury Norov

Commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK") removes the function current_thread_info(). It's wrong because the function is used in non-arch code and is part of API.

In include/linux/thread_info.h:

Quoted 9 lines

#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
* For CONFIG_THREAD_INFO_IN_TASK kernels we need <asm/current.h> for the
* definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels,
* including <asm/current.h> can cause a circular dependency on some platforms. */
#include <asm/current.h>
#define current_thread_info() ((struct thread_info *)current) #endif

Quoted 3 lines

Ah, sorry. Then it might be my rebase issue. I was confused because Christophe didn't remove the comment to current_thread_info(), so I decided he removed it erroneously.

Yeah you're right, that comment should have been removed too.

cheers