* [PATCH -tip ] kprobes: Move __kprobes definition into compiler.h
@ 2013-04-04 10:40 Masami Hiramatsu
2013-04-04 11:18 ` Masami Hiramatsu
2013-04-10 9:21 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
0 siblings, 2 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2013-04-04 10:40 UTC (permalink / raw)
To: Ingo Molnar, linux-kernel
Cc: Timo Juhani Lindfors, Ananth N Mavinakayanahalli, Pavel Emelyanov,
Jiri Kosina, Ingo Molnar, Nadia Yvette Chambers,
yrl.pp-manager.tt, David S. Miller
Currently, __kprobes is defined in linux/kprobes.h which
is too big to be included in small or basic headers
only for using this attribute.
This moves __kprobes definition into linux/compiler.h
in which other compiler attributes are defined.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Nadia Yvette Chambers <nyc@holomorphy.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Ingo Molnar <mingo@kernel.org>
---
include/linux/compiler.h | 6 ++++++
include/linux/kprobes.h | 6 +-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 10b8f23..9382db2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
*/
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+#ifdef CONFIG_KPROBES
+/* Attach to insert probes on any functions which should be ignored */
+#define __kprobes __attribute__((__section__(".kprobes.text")))
+#else
+#define __kprobes
+#endif
#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 4b6ef4d..ca1d27a 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -29,6 +29,7 @@
* <jkenisto@us.ibm.com> and Prasanna S Panchamukhi
* <prasanna@in.ibm.com> added function-return probes.
*/
+#include <linux/compiler.h> /* for __kprobes */
#include <linux/linkage.h>
#include <linux/list.h>
#include <linux/notifier.h>
@@ -49,16 +50,11 @@
#define KPROBE_REENTER 0x00000004
#define KPROBE_HIT_SSDONE 0x00000008
-/* Attach to insert probes on any functions which should be ignored*/
-#define __kprobes __attribute__((__section__(".kprobes.text")))
-
#else /* CONFIG_KPROBES */
typedef int kprobe_opcode_t;
struct arch_specific_insn {
int dummy;
};
-#define __kprobes
-
#endif /* CONFIG_KPROBES */
struct kprobe;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -tip ] kprobes: Move __kprobes definition into compiler.h
2013-04-04 10:40 [PATCH -tip ] kprobes: Move __kprobes definition into compiler.h Masami Hiramatsu
@ 2013-04-04 11:18 ` Masami Hiramatsu
2013-04-10 9:21 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2013-04-04 11:18 UTC (permalink / raw)
To: Ingo Molnar, linux-kernel
Cc: Timo Juhani Lindfors, Ananth N Mavinakayanahalli, Pavel Emelyanov,
Jiri Kosina, Ingo Molnar, Nadia Yvette Chambers,
yrl.pp-manager.tt, David S. Miller
Hi Ingo,
(2013/04/04 19:40), Masami Hiramatsu wrote:
> Currently, __kprobes is defined in linux/kprobes.h which
> is too big to be included in small or basic headers
> only for using this attribute.
>
> This moves __kprobes definition into linux/compiler.h
> in which other compiler attributes are defined.
This is only moving __kprobes definition into compiler.h.
I think it will be needed for replacing __kprobes with noprobe.
And until now, I still could not reproduce the Timo's reported
issues. It seems those were happened on probing inline functions.
Thus, I think we'd better use __always_inline instead of
adding __kprobes (because those are not related to kprobes).
If those issues still be reproduced, we'd better put noprobe
on those functions.
By the way, those issues happened on native_* static inline functions
which are also pointed by pv_*_ops as function pointer. For example,
native_safe_halt is defined as an inline function in asm/irqflags.h,
however it is directly pointed by pv_irq_ops in arch/x86/kernel/paravirt.c.
In this case __always_inline may cause a problem.
For these cases, I'd like to suggest to define those functions
which requires actual instance (because its address is used)
in paravirt.c and rename original one to __native_*. And rename
direct call of such native_* to __native_*.
Thank you,
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] kprobes: Move __kprobes definition into compiler.h
2013-04-04 10:40 [PATCH -tip ] kprobes: Move __kprobes definition into compiler.h Masami Hiramatsu
2013-04-04 11:18 ` Masami Hiramatsu
@ 2013-04-10 9:21 ` tip-bot for Masami Hiramatsu
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2013-04-10 9:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, torvalds, xemul, jkosina, davem, nyc,
ananth, masami.hiramatsu.pt, tglx, timo.lindfors
Commit-ID: 324670b620ab1ed00ba160e435686bd2ae4a59ce
Gitweb: http://git.kernel.org/tip/324670b620ab1ed00ba160e435686bd2ae4a59ce
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 4 Apr 2013 19:40:50 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 8 Apr 2013 17:28:34 +0200
kprobes: Move __kprobes definition into compiler.h
Currently, __kprobes is defined in linux/kprobes.h which
is too big to be included in small or basic headers
that want to make use of this simple attribute.
So move __kprobes definition into linux/compiler.h
in which other compiler attributes are defined.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Nadia Yvette Chambers <nyc@holomorphy.com>
Cc: yrl.pp-manager.tt@hitachi.com
Cc: David S. Miller <davem@davemloft.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20130404104049.21071.20908.stgit@mhiramat-M0-7522
[ Improved the attribute explanation a bit. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/compiler.h | 6 ++++++
include/linux/kprobes.h | 6 +-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 10b8f23..92669cd 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
*/
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
+#ifdef CONFIG_KPROBES
+# define __kprobes __attribute__((__section__(".kprobes.text")))
+#else
+# define __kprobes
+#endif
#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 4b6ef4d..ca1d27a 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -29,6 +29,7 @@
* <jkenisto@us.ibm.com> and Prasanna S Panchamukhi
* <prasanna@in.ibm.com> added function-return probes.
*/
+#include <linux/compiler.h> /* for __kprobes */
#include <linux/linkage.h>
#include <linux/list.h>
#include <linux/notifier.h>
@@ -49,16 +50,11 @@
#define KPROBE_REENTER 0x00000004
#define KPROBE_HIT_SSDONE 0x00000008
-/* Attach to insert probes on any functions which should be ignored*/
-#define __kprobes __attribute__((__section__(".kprobes.text")))
-
#else /* CONFIG_KPROBES */
typedef int kprobe_opcode_t;
struct arch_specific_insn {
int dummy;
};
-#define __kprobes
-
#endif /* CONFIG_KPROBES */
struct kprobe;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-10 9:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 10:40 [PATCH -tip ] kprobes: Move __kprobes definition into compiler.h Masami Hiramatsu
2013-04-04 11:18 ` Masami Hiramatsu
2013-04-10 9:21 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
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).