[PATCH 1/2] x86: Move is_ia32_task to asm/thread_info.h from asm/compat.h

March 13th, 2012 - 09:10 am ET by Srikar Dronamraju | Report spam
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

is_ia32_task is useful even in !CONFIG_COMPAT cases. Hence move it
to a more generic file asm/thread_info.h

Also now is_ia32_task returns true if CONFIG_X86_32 is defined.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

arch/x86/include/asm/compat.h | 9
arch/x86/include/asm/thread_info.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 355edc0..d680579 100644
a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -235,15 +235,6 @@ static inline void __user *arch_compat_alloc_user_space(long len)
return (void __user *)round_down(sp - len, 16);
}

-static inline bool is_ia32_task(void)
-{
-#ifdef CONFIG_IA32_EMULATION
- if (current_thread_info()->status & TS_COMPAT)
- return true;
-#endif
- return false;
-}
-
static inline bool is_x32_task(void)
{
#ifdef CONFIG_X86_X32_ABI
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index af1db7e..130fd4e 100644
a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -266,6 +266,18 @@ static inline void set_restore_sigmask(void)
ti->status |= TS_RESTORE_SIGMASK;
set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags);
}
+
+static inline bool is_ia32_task(void)
+{
+#ifdef CONFIG_X86_32
+ return true;
+#endif
+#if defined CONFIG_X86_64 && defined CONFIG_IA32_EMULATION
+ if (current_thread_info()->status & TS_COMPAT)
+ return true;
+#endif
+ return false;
+}
#endif /* !__ASSEMBLY__ */

#ifndef __ASSEMBLY__


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussionReplies 3 repliesReplies Make a reply

Similar topics

Replies

#1 Ingo Molnar
March 13th, 2012 - 10:40 am ET | Report spam
* Srikar Dronamraju wrote:

diff --git a/kernel/fork.c b/kernel/fork.c
index 26a7a67..36508b9 100644
a/kernel/fork.c
+++ b/kernel/fork.c
@@ -67,6 +67,7 @@
#include <linux/oom.h>
#include <linux/khugepaged.h>
#include <linux/signalfd.h>
+#include <linux/uprobes.h>

#include <asm/pgtable.h>
#include <asm/pgalloc.h>
@@ -731,6 +732,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
exit_pi_state_list(tsk);
#endif

+ uprobe_free_utask(tsk);
+
/* Get rid of any cached register state */
deactivate_mm(tsk, mm);

@@ -1322,6 +1325,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
INIT_LIST_HEAD(&p->pi_state_list);
p->pi_state_cache = NULL;
#endif
+#ifdef CONFIG_UPROBES
+ p->utask = NULL;
+ p->uprobe_srcu_id = -1;
+#endif
/*
* sigaltstack should be cleared when sharing the same VM
*/



Hm, I suspect by looking at the first two hunks you can guess
how the third hunk should be done more cleanly?

Thanks,

Ingo
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#2 tip-bot for Srikar Dronamraju
March 13th, 2012 - 11:20 am ET | Report spam
Commit-ID: ef334a20d84f52407a8a2afd02ddeaecbef0ad3d
Gitweb: http://git.kernel.org/tip/ef334a20d...ecbef0ad3d
Author: Srikar Dronamraju
AuthorDate: Tue, 13 Mar 2012 19:33:03 +0530
Committer: Ingo Molnar
CommitDate: Tue, 13 Mar 2012 16:31:09 +0100

x86: Move is_ia32_task to asm/thread_info.h from asm/compat.h

is_ia32_task() is useful even in !CONFIG_COMPAT cases - utrace will
use it for example. Hence move it to a more generic file: asm/thread_info.h

Also now is_ia32_task() returns true if CONFIG_X86_32 is defined.

Signed-off-by: Srikar Dronamraju
Acked-by: H. Peter Anvin
Cc: Linus Torvalds
Cc: Ananth N Mavinakayanahalli
Cc: Jim Keniston
Cc: Linux-mm
Cc: Oleg Nesterov
Cc: Andi Kleen
Cc: Christoph Hellwig
Cc: Steven Rostedt
Cc: Arnaldo Carvalho de Melo
Cc: Masami Hiramatsu
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/
[ Performed minor cleanup ]
Signed-off-by: Ingo Molnar

arch/x86/include/asm/compat.h | 9
arch/x86/include/asm/thread_info.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 355edc0..d680579 100644
a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -235,15 +235,6 @@ static inline void __user *arch_compat_alloc_user_space(long len)
return (void __user *)round_down(sp - len, 16);
}

-static inline bool is_ia32_task(void)
-{
-#ifdef CONFIG_IA32_EMULATION
- if (current_thread_info()->status & TS_COMPAT)
- return true;
-#endif
- return false;
-}
-
static inline bool is_x32_task(void)
{
#ifdef CONFIG_X86_X32_ABI
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index af1db7e..ad6df8c 100644
a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -266,6 +266,18 @@ static inline void set_restore_sigmask(void)
ti->status |= TS_RESTORE_SIGMASK;
set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags);
}
+
+static inline bool is_ia32_task(void)
+{
+#ifdef CONFIG_X86_32
+ return true;
+#endif
+#ifdef CONFIG_IA32_EMULATION
+ if (current_thread_info()->status & TS_COMPAT)
+ return true;
+#endif
+ return false;
+}
#endif /* !__ASSEMBLY__ */

#ifndef __ASSEMBLY__
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#3 Srikar Dronamraju
March 13th, 2012 - 01:10 pm ET | Report spam

> diff --git a/kernel/fork.c b/kernel/fork.c
> index 26a7a67..36508b9 100644
> a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -67,6 +67,7 @@
> #include <linux/oom.h>
> #include <linux/khugepaged.h>
> #include <linux/signalfd.h>
> +#include <linux/uprobes.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -731,6 +732,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
> exit_pi_state_list(tsk);
> #endif
>
> + uprobe_free_utask(tsk);
> +
> /* Get rid of any cached register state */
> deactivate_mm(tsk, mm);
>
> @@ -1322,6 +1325,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> INIT_LIST_HEAD(&p->pi_state_list);
> p->pi_state_cache = NULL;
> #endif
> +#ifdef CONFIG_UPROBES
> + p->utask = NULL;
> + p->uprobe_srcu_id = -1;
> +#endif
> /*
> * sigaltstack should be cleared when sharing the same VM
> */

Hm, I suspect by looking at the first two hunks you can guess
how the third hunk should be done more cleanly?




Resent just this patch after addressing this comment.

thanks and regards
Srikar

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search