Skip to contentSkip to conversation

tracing: minor bugs

PATCH In review [email protected] 2 participants 8 messages Jul 16, 2009 – Jul 19, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover tracing: minor bugs

Hi,

1/3 - removing not used variables
2/3 - removing struct module* parameter from ftrace_init_module code path 3/3 - removing .globl in the scripts/recordmcount.pl doc

based on Linus tree commit 35b5c55fee08e6e4001ba98060a2d0b82f70b5f4

wbr,
jirka

#1 lore raw

PATCH 1/3 tracing: removing not used variables

Removing not used variables.

wbr,
jirka

---
 kernel/trace/ftrace.c |    3 ---
 kernel/trace/trace.c  |    3 +--
 2 files changed, 1 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +0 -3
index 4521c77..1dc08ab 100644
@@ -1375,7 +1375,6 @@ struct ftrace_iterator {
 	unsigned		flags;
 	unsigned char		buffer[FTRACE_BUFF_MAX+1];
 	unsigned		buffer_idx;
-	unsigned		filtered;
 };
 
 static void *
@@ -2312,7 +2311,6 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
 	}
 
 	if (isspace(ch)) {
-		iter->filtered++;
 		iter->buffer[iter->buffer_idx] = 0;
 		ret = ftrace_process_regex(iter->buffer,
 					   iter->buffer_idx, enable);
@@ -2443,7 +2441,6 @@ ftrace_regex_release(struct inode *inode, struct file *file, int enable)
 		iter = file->private_data;
 
 	if (iter->buffer_idx) {
-		iter->filtered++;
 		iter->buffer[iter->buffer_idx] = 0;
 		ftrace_match_records(iter->buffer, iter->buffer_idx, enable);
 	}
kernel/trace/trace.c +1 -2
index 8bc8d8a..d8bb7fd 100644
@@ -4268,7 +4268,6 @@ void ftrace_dump(void)
 
 __init static int tracer_alloc_buffers(void)
 {
-	struct trace_array_cpu *data;
 	int ring_buf_size;
 	int i;
 	int ret = -ENOMEM;
@@ -4318,7 +4317,7 @@ __init static int tracer_alloc_buffers(void)
 
 	/* Allocate the first page for all buffers */
 	for_each_tracing_cpu(i) {
-		data = global_trace.data[i] = &per_cpu(global_trace_cpu, i);
+		global_trace.data[i] = &per_cpu(global_trace_cpu, i);
 		max_tr.data[i] = &per_cpu(max_data, i);
 	}
 
Signature · 1 line
1.6.2.5
#2 lore raw

[tip:tracing/core] tracing: Remove unused fields/variables

Commit-ID:  566b0aaf798a0dddfc455d1a5b05c424c6686c65
Gitweb:     http://git.kernel.org/tip/566b0aaf798a0dddfc455d1a5b05c424c6686c65
Author:     [email protected] <[email protected]>
AuthorDate: Thu, 16 Jul 2009 21:44:26 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 18 Jul 2009 12:21:16 +0200

tracing: Remove unused fields/variables

LKML-Reference: <[email protected]>

---
 kernel/trace/ftrace.c |    3 ---
 kernel/trace/trace.c  |    3 +--
 2 files changed, 1 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +0 -3
index 6227dc8..24e3ff5 100644
@@ -1339,7 +1339,6 @@ struct ftrace_iterator {
 	unsigned		flags;
 	unsigned char		buffer[FTRACE_BUFF_MAX+1];
 	unsigned		buffer_idx;
-	unsigned		filtered;
 };
 
 static void *
@@ -2268,7 +2267,6 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
 	}
 
 	if (isspace(ch)) {
-		iter->filtered++;
 		iter->buffer[iter->buffer_idx] = 0;
 		ret = ftrace_process_regex(iter->buffer,
 					   iter->buffer_idx, enable);
@@ -2399,7 +2397,6 @@ ftrace_regex_release(struct inode *inode, struct file *file, int enable)
 		iter = file->private_data;
 
 	if (iter->buffer_idx) {
-		iter->filtered++;
 		iter->buffer[iter->buffer_idx] = 0;
 		ftrace_match_records(iter->buffer, iter->buffer_idx, enable);
 	}
kernel/trace/trace.c +1 -2
index 60a4948..e30e6b1 100644
@@ -4265,7 +4265,6 @@ void ftrace_dump(void)
 
 __init static int tracer_alloc_buffers(void)
 {
-	struct trace_array_cpu *data;
 	int ring_buf_size;
 	int i;
 	int ret = -ENOMEM;
@@ -4315,7 +4314,7 @@ __init static int tracer_alloc_buffers(void)
 
 	/* Allocate the first page for all buffers */
 	for_each_tracing_cpu(i) {
-		data = global_trace.data[i] = &per_cpu(global_trace_cpu, i);
+		global_trace.data[i] = &per_cpu(global_trace_cpu, i);
 		max_tr.data[i] = &per_cpu(max_data, i);
 	}
 
#3 lore raw

PATCH 2/3 tracing: removing struct module* parameter from ftrace_init_module code path

In reply to [email protected]

The "struct module*" is not being used in the ftrace_init_module code path, removing it.

wbr,
jirka

---
 arch/x86/kernel/ftrace.c |    3 +--
 include/linux/ftrace.h   |    4 +---
 kernel/trace/ftrace.c    |   25 +++++++++++--------------
 3 files changed, 13 insertions(+), 19 deletions(-)
arch/x86/kernel/ftrace.c +1 -2
index d94e1ea..b5c22fb 100644
@@ -255,8 +255,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
 	return 0;
 }
 
-int ftrace_make_nop(struct module *mod,
-		    struct dyn_ftrace *rec, unsigned long addr)
+int ftrace_make_nop(struct dyn_ftrace *rec, unsigned long addr)
 {
 	unsigned char *new, *old;
 	unsigned long ip = rec->ip;
include/linux/ftrace.h +1 -3
index dc3b132..efe0fb3 100644
@@ -184,7 +184,6 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
 
 /**
  * ftrace_make_nop - convert code into nop
- * @mod: module structure if called by module load initialization
  * @rec: the mcount call site record
  * @addr: the address that the call site should be calling
  *
@@ -203,8 +202,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
  *  -EPERM  on error writing to the location
  * Any other value will be considered a failure.
  */
-extern int ftrace_make_nop(struct module *mod,
-			   struct dyn_ftrace *rec, unsigned long addr);
+extern int ftrace_make_nop(struct dyn_ftrace *rec, unsigned long addr);
 
 /**
  * ftrace_make_call - convert a nop call site into a call to addr
kernel/trace/ftrace.c +11 -14
index 1dc08ab..c4dfcff 100644
@@ -1080,7 +1080,7 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
 	if (rec->flags & FTRACE_FL_ENABLED)
 		return ftrace_make_call(rec, ftrace_addr);
 	else
-		return ftrace_make_nop(NULL, rec, ftrace_addr);
+		return ftrace_make_nop(rec, ftrace_addr);
 }
 
 static void ftrace_replace_code(int enable)
@@ -1123,14 +1123,14 @@ static void ftrace_replace_code(int enable)
 }
 
 static int
-ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
+ftrace_code_disable(struct dyn_ftrace *rec)
 {
 	unsigned long ip;
 	int ret;
 
 	ip = rec->ip;
 
-	ret = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
+	ret = ftrace_make_nop(rec, MCOUNT_ADDR);
 	if (ret) {
 		ftrace_bug(ret, ip);
 		rec->flags |= FTRACE_FL_FAILED;
@@ -1280,7 +1280,7 @@ static cycle_t		ftrace_update_time;
 static unsigned long	ftrace_update_cnt;
 unsigned long		ftrace_update_tot_cnt;
 
-static int ftrace_update_code(struct module *mod)
+static int ftrace_update_code(void)
 {
 	struct dyn_ftrace *p;
 	cycle_t start, stop;
@@ -1299,7 +1299,7 @@ static int ftrace_update_code(struct module *mod)
 		p->flags = 0L;
 
 		/* convert record (i.e, patch mcount-call with NOP) */
-		if (ftrace_code_disable(mod, p)) {
+		if (ftrace_code_disable(p)) {
 			p->flags |= FTRACE_FL_CONVERTED;
 			ftrace_update_cnt++;
 		} else
@@ -2751,8 +2751,7 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
 	return 0;
 }
 
-static int ftrace_convert_nops(struct module *mod,
-			       unsigned long *start,
+static int ftrace_convert_nops(unsigned long *start,
 			       unsigned long *end)
 {
 	unsigned long *p;
@@ -2776,7 +2775,7 @@ static int ftrace_convert_nops(struct module *mod,
 
 	/* disable interrupts to prevent kstop machine */
 	local_irq_save(flags);
-	ftrace_update_code(mod);
+	ftrace_update_code();
 	local_irq_restore(flags);
 	mutex_unlock(&ftrace_lock);
 
@@ -2808,12 +2807,11 @@ void ftrace_release(void *start, void *end)
 	mutex_unlock(&ftrace_lock);
 }
 
-static void ftrace_init_module(struct module *mod,
-			       unsigned long *start, unsigned long *end)
+static void ftrace_init_module(unsigned long *start, unsigned long *end)
 {
 	if (ftrace_disabled || start = end)
 		return;
-	ftrace_convert_nops(mod, start, end);
+	ftrace_convert_nops(start, end);
 }
 
 static int ftrace_module_notify(struct notifier_block *self,
@@ -2823,7 +2821,7 @@ static int ftrace_module_notify(struct notifier_block *self,
 
 	switch (val) {
 	case MODULE_STATE_COMING:
-		ftrace_init_module(mod, mod->ftrace_callsites,
+		ftrace_init_module(mod->ftrace_callsites,
 				   mod->ftrace_callsites +
 				   mod->num_ftrace_callsites);
 		break;
@@ -2876,8 +2874,7 @@ void __init ftrace_init(void)
 
 	last_ftrace_enabled = ftrace_enabled = 1;
 
-	ret = ftrace_convert_nops(NULL,
-				  __start_mcount_loc,
+	ret = ftrace_convert_nops(__start_mcount_loc,
 				  __stop_mcount_loc);
 
 	ret = register_module_notifier(&ftrace_module_nb);
Signature · 1 line
1.6.2.5
#4 lore raw

Re: [PATCH 2/3] tracing: removing struct module* parameter from ftrace_init_module code path

Quoted 6 lines · * [email protected] <[email protected]> wrote:

The "struct module*" is not being used in the ftrace_init_module code path, removing it.

wbr,
jirka

Quoted 7 lines
---
 arch/x86/kernel/ftrace.c |    3 +--
 include/linux/ftrace.h   |    4 +---
 kernel/trace/ftrace.c    |   25 +++++++++++--------------
 3 files changed, 13 insertions(+), 19 deletions(-)

patch didnt apply cleanly to the latest tracing tree:

http://people.redhat.com/mingo/tip.git/README

and the other bits had some fuzz as well. Mind merging + resending this?

Ingo

author
#5 lore raw

Re: [PATCH 2/3] tracing: removing struct module* parameter from ftrace_init_module code path

Quoted 17 lines · Ingo Molnar
Quoted 6 lines · * [email protected] <[email protected]> wrote:

The "struct module*" is not being used in the ftrace_init_module code path, removing it.

wbr,
jirka

Quoted 7 lines
---
 arch/x86/kernel/ftrace.c |    3 +--
 include/linux/ftrace.h   |    4 +---
 kernel/trace/ftrace.c    |   25 +++++++++++--------------
 3 files changed, 13 insertions(+), 19 deletions(-)
Quoted 8 lines

patch didnt apply cleanly to the latest tracing tree:

http://people.redhat.com/mingo/tip.git/README

and the other bits had some fuzz as well. Mind merging + resending this?

Ingo

sure, np.. I made it against the linus' tree, I'll use the tip tree next time

jira

#6 lore raw

PATCH 3/3 tracing: removing .globl in the scripts/recordmcount.pl doc

In reply to [email protected]

I was reading throught the recordmcount.pl starting comment, and spot a tiny discrepancy.

The second example is about my_func not being global, but the example code has the ".globl my_func" statement just moved. IMO it should be erased, if not I'm curious what I'm missing.. :)

wbr,
jirka

---
 scripts/recordmcount.pl |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
scripts/recordmcount.pl +0 -1
index 7109e2b..db4ebe1 100755
@@ -57,7 +57,6 @@
 #        call mcount  (offset: 0x5)
 #        [...]
 #        ret
-#  .globl my_func
 #  other_func:
 #        [...]
 #        call mcount (offset: 0x1b)
Signature · 1 line
1.6.2.5
#7 lore raw

[tip:tracing/core] tracing: Remove .globl in the scripts/recordmcount.pl doc

Commit-ID:  d34a4debef933061924ee17c2ede33f5c44925fb
Gitweb:     http://git.kernel.org/tip/d34a4debef933061924ee17c2ede33f5c44925fb
Author:     [email protected] <[email protected]>
AuthorDate: Thu, 16 Jul 2009 21:44:28 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 18 Jul 2009 12:21:17 +0200

tracing: Remove .globl in the scripts/recordmcount.pl doc

I was reading throught the recordmcount.pl starting comment, and spotted a tiny discrepancy.

The second example is about my_func not being global, but the example code has the ".globl my_func" statement just moved.

LKML-Reference: <[email protected]>

---
 scripts/recordmcount.pl |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
scripts/recordmcount.pl +0 -1
index 7109e2b..db4ebe1 100755
@@ -57,7 +57,6 @@
 #        call mcount  (offset: 0x5)
 #        [...]
 #        ret
-#  .globl my_func
 #  other_func:
 #        [...]
 #        call mcount (offset: 0x1b)