lkml.org 
[lkml]   [2013]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC PATCH 1/2] tracing: Don't update sc->addr in update_symbol_cache()
Preparation for the next changes. Shift "+= offset" from
update_symbol_cache() to ->fetch[FETCH_MTD_symbol], this
allows to detect the per-cpu symbols.

Also remove the !offset check in traceprobe_split_symbol_offset(),
it is never called with offset == NULL.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/trace/trace_probe.c | 13 +++----------
1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index fce222f..097cc80 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -219,14 +219,9 @@ struct symbol_cache {
unsigned long addr;
};

-static unsigned long update_symbol_cache(struct symbol_cache *sc)
+static void update_symbol_cache(struct symbol_cache *sc)
{
sc->addr = (unsigned long)kallsyms_lookup_name(sc->symbol);
-
- if (sc->addr)
- sc->addr += sc->offset;
-
- return sc->addr;
}

static void free_symbol_cache(struct symbol_cache *sc)
@@ -262,8 +257,9 @@ static __kprobes void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs,\
void *data, void *dest) \
{ \
struct symbol_cache *sc = data; \
+ long off = sc->offset; \
if (sc->addr) \
- fetch_memory_##type(regs, (void *)sc->addr, dest); \
+ fetch_memory_##type(regs, (void *)sc->addr + off, dest);\
else \
*(type *)dest = 0; \
}
@@ -485,9 +481,6 @@ int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset)
char *tmp;
int ret;

- if (!offset)
- return -EINVAL;
-
tmp = strchr(symbol, '+');
if (tmp) {
/* skip sign because kstrtoul doesn't accept '+' */
--
1.5.5.1



\
 
 \ /
  Last update: 2013-11-26 19:01    [W:0.058 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site