From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Subject: [PATCH] linux-kernel-markers-i386-optimization-flags
Date: Thu, 1 Mar 2007 02:13:58 -0500 [thread overview]
Message-ID: <20070301071358.GD19339@Krystal> (raw)
linux-kernel-markers-i386-optimization-flags
i386 marker optimization flags support.
Also fixes the @progbits assembly section declaration.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- a/arch/i386/kernel/marker.c
+++ b/arch/i386/kernel/marker.c
@@ -40,7 +40,7 @@ static int mark_notifier(struct notifier_block *nb,
{
enum die_val die_val = (enum die_val) val;
struct die_args *args = (struct die_args *)data;
-
+
if (!args->regs || user_mode_vm(args->regs))
return NOTIFY_DONE;
@@ -56,7 +56,7 @@ static struct notifier_block mark_notify = {
.priority = 0x7fffffff, /* we need to be notified first */
};
-int arch_marker_set_ins_enable(void *address, char enable)
+int marker_optimized_set_enable(void *address, char enable)
{
char saved_byte;
int ret;
@@ -91,4 +91,4 @@ int arch_marker_set_ins_enable(void *address, char enable)
flush_icache_range(address, size);
return 0;
}
-EXPORT_SYMBOL_GPL(arch_marker_set_ins_enable);
+EXPORT_SYMBOL_GPL(marker_optimized_set_enable);
--- a/include/asm-i386/marker.h
+++ b/include/asm-i386/marker.h
@@ -11,16 +11,19 @@
#ifdef CONFIG_MARKERS
-#define MARK(name, format, args...) \
+
+#define _MF_DEFAULT (_MF_OPTIMIZED | _MF_LOCKDEP | _MF_PRINTK)
+
+#define MARK_OPTIMIZED(flags, name, format, args...) \
do { \
static marker_probe_func *__mark_call_##name = \
__mark_empty_function; \
static const struct __mark_marker_c __mark_c_##name \
__attribute__((section(".markers.c"))) = \
{ #name, &__mark_call_##name, format, \
- MARKER_OPTIMIZED } ; \
+ (flags) | _MF_OPTIMIZED } ; \
char condition; \
- asm volatile( ".section .markers, \"a\";\n\t" \
+ asm volatile( ".section .markers, \"a\", @progbits;\n\t" \
".long %1, 0f;\n\t" \
".previous;\n\t" \
".align 2\n\t" \
@@ -36,12 +39,25 @@
} \
} while (0)
+#define _MARK(flags, format, args...) \
+do { \
+ if (((flags) & _MF_LOCKDEP) && ((flags) & _MF_OPTIMIZED)) \
+ MARK_OPTIMIZED(flags, format, ## args); \
+ else \
+ MARK_GENERIC(flags, format, ## args); \
+} while (0)
+
+#define MARK(format, args...) _MARK(_MF_DEFAULT, format, ## args)
+
/* Offset of the immediate value from the start of the movb instruction, in
* bytes. */
-#define MARK_ENABLE_IMMEDIATE_OFFSET 1
-#define MARK_ENABLE_TYPE char
-#define MARK_POLYMORPHIC
+#define MARK_OPTIMIZED_ENABLE_IMMEDIATE_OFFSET 1
+#define MARK_OPTIMIZED_ENABLE_TYPE char
+/* Dereference enable as lvalue from a pointer to its instruction */
+#define MARK_OPTIMIZED_ENABLE(a) \
+ *(MARK_OPTIMIZED_ENABLE_TYPE*) \
+ ((char*)a+MARK_OPTIMIZED_ENABLE_IMMEDIATE_OFFSET)
-extern int arch_marker_set_ins_enable(void *address, char enable);
+extern int marker_optimized_set_enable(void *address, char enable);
#endif
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
reply other threads:[~2007-03-01 7:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20070301071358.GD19339@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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.