From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH] powerpc: Add user-return-notifier support
Date: Tue, 25 Aug 2015 11:11:10 +0530 [thread overview]
Message-ID: <20150825054110.GD3815@in.ibm.com> (raw)
Add user return notifier support for powerpc. Similar to x86, this feature
keys off of the KVM Kconfig.
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
Documentation/features/debug/user-ret-profiler/arch-support.txt | 2 +-
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/thread_info.h | 2 ++
arch/powerpc/kernel/process.c | 4 ++++
arch/powerpc/kernel/signal.c | 4 ++++
arch/powerpc/kvm/Kconfig | 1 +
6 files changed, 13 insertions(+), 1 deletion(-)
Index: linux-4.2-rc6/Documentation/features/debug/user-ret-profiler/arch-support.txt
===================================================================
--- linux-4.2-rc6.orig/Documentation/features/debug/user-ret-profiler/arch-support.txt
+++ linux-4.2-rc6/Documentation/features/debug/user-ret-profiler/arch-support.txt
@@ -27,7 +27,7 @@
| nios2: | TODO |
| openrisc: | TODO |
| parisc: | TODO |
- | powerpc: | TODO |
+ | powerpc: | ok |
| s390: | TODO |
| score: | TODO |
| sh: | TODO |
Index: linux-4.2-rc6/arch/powerpc/Kconfig
===================================================================
--- linux-4.2-rc6.orig/arch/powerpc/Kconfig
+++ linux-4.2-rc6/arch/powerpc/Kconfig
@@ -106,6 +106,7 @@ config PPC
select HAVE_ARCH_KGDB
select HAVE_KRETPROBES
select HAVE_ARCH_TRACEHOOK
+ select HAVE_USER_RETURN_NOTIFIER
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_DMA_ATTRS
Index: linux-4.2-rc6/arch/powerpc/include/asm/thread_info.h
===================================================================
--- linux-4.2-rc6.orig/arch/powerpc/include/asm/thread_info.h
+++ linux-4.2-rc6/arch/powerpc/include/asm/thread_info.h
@@ -86,6 +86,7 @@ static inline struct thread_info *curren
TIF_NEED_RESCHED */
#define TIF_32BIT 4 /* 32 bit binary */
#define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */
+#define TIF_USER_RETURN_NOTIFY 6 /* notify kernel of userspace return */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_SINGLESTEP 8 /* singlestepping active */
#define TIF_NOHZ 9 /* in adaptive nohz mode */
@@ -109,6 +110,7 @@ static inline struct thread_info *curren
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#define _TIF_32BIT (1<<TIF_32BIT)
#define _TIF_RESTORE_TM (1<<TIF_RESTORE_TM)
+#define _TIF_USER_RETURN_NOTIFY (1<<TIF_USER_RETURN_NOTIFY)
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
#define _TIF_SECCOMP (1<<TIF_SECCOMP)
Index: linux-4.2-rc6/arch/powerpc/kernel/process.c
===================================================================
--- linux-4.2-rc6.orig/arch/powerpc/kernel/process.c
+++ linux-4.2-rc6/arch/powerpc/kernel/process.c
@@ -38,6 +38,7 @@
#include <linux/random.h>
#include <linux/hw_breakpoint.h>
#include <linux/uaccess.h>
+#include <linux/user-return-notifier.h>
#include <asm/pgtable.h>
#include <asm/io.h>
@@ -894,6 +895,9 @@ struct task_struct *__switch_to(struct t
}
#endif /* CONFIG_PPC_BOOK3S_64 */
+ if (unlikely(task_thread_info(prev)->flags & _TIF_USER_RETURN_NOTIFY))
+ propagate_user_return_notify(prev, new);
+
return last;
}
Index: linux-4.2-rc6/arch/powerpc/kernel/signal.c
===================================================================
--- linux-4.2-rc6.orig/arch/powerpc/kernel/signal.c
+++ linux-4.2-rc6/arch/powerpc/kernel/signal.c
@@ -14,6 +14,7 @@
#include <linux/uprobes.h>
#include <linux/key.h>
#include <linux/context_tracking.h>
+#include <linux/user-return-notifier.h>
#include <asm/hw_breakpoint.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -159,6 +160,9 @@ void do_notify_resume(struct pt_regs *re
tracehook_notify_resume(regs);
}
+ if (thread_info_flags & _TIF_USER_RETURN_NOTIFY)
+ fire_user_return_notifiers();
+
user_enter();
}
Index: linux-4.2-rc6/arch/powerpc/kvm/Kconfig
===================================================================
--- linux-4.2-rc6.orig/arch/powerpc/kvm/Kconfig
+++ linux-4.2-rc6/arch/powerpc/kvm/Kconfig
@@ -22,6 +22,7 @@ config KVM
select ANON_INODES
select HAVE_KVM_EVENTFD
select SRCU
+ select USER_RETURN_NOTIFIER
config KVM_BOOK3S_HANDLER
bool
next reply other threads:[~2015-08-25 5:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 5:41 Ananth N Mavinakayanahalli [this message]
2015-08-31 10:35 ` powerpc: Add user-return-notifier support Michael Ellerman
2015-09-01 6:41 ` Ananth N Mavinakayanahalli
2015-09-02 0:03 ` Scott Wood
2015-09-02 2:37 ` Ananth N Mavinakayanahalli
2015-09-02 3:29 ` Scott Wood
2015-09-02 5:09 ` Ananth N Mavinakayanahalli
2015-09-08 9:24 ` Michael Ellerman
2015-09-08 10:51 ` Ananth N Mavinakayanahalli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150825054110.GD3815@in.ibm.com \
--to=ananth@in.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.