From 46746514a6943520ff73b6f77d35477e2abb30ba Mon Sep 17 00:00:00 2001 From: hunt Date: Thu, 19 Jan 2006 19:26:32 +0000 Subject: [PATCH] 2006-01-19 Martin Hunt * pmap-gen.c (_stp_pmap_get): Fix bug where old data from agg map could be returned after element was deleted. --- runtime/ChangeLog | 5 +++++ runtime/pmap-gen.c | 13 +++++++++---- runtime/probes/bench/run_bench | 8 +------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 099949bfd..bb04363cd 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2006-01-19 Martin Hunt + + * pmap-gen.c (_stp_pmap_get): Fix bug where old data + from agg map could be returned after element was deleted. + 2006-01-16 Josh Stone * stat.c (_stp_stat_clear): add a function that just diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c index 035fccbff..21a0aef49 100644 --- a/runtime/pmap-gen.c +++ b/runtime/pmap-gen.c @@ -617,7 +617,7 @@ VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key)) VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) { unsigned int hv; - int cpu; + int cpu, clear_agg = 0; struct hlist_head *head, *ahead; struct hlist_node *e; struct KEYSYM(pmap_node) *n; @@ -649,7 +649,7 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) #endif ) { anode = (struct map_node *)n; - _new_map_clear_node (anode); + clear_agg = 1; break; } } @@ -681,13 +681,18 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) if (anode == NULL) { dbug("agg=%lx ahead=%lx\n", (long)agg, (long)ahead); anode = _stp_new_agg(agg, ahead, (struct map_node *)n); - } else + } else { + if (clear_agg) { + _new_map_clear_node (anode); + clear_agg = 0; + } _stp_add_agg(anode, (struct map_node *)n); + } } } spin_unlock(&map->lock); } - if (anode) + if (anode && !clear_agg) return MAP_GET_VAL(anode); /* key not found */ diff --git a/runtime/probes/bench/run_bench b/runtime/probes/bench/run_bench index 8bbc2dd46..183190131 100755 --- a/runtime/probes/bench/run_bench +++ b/runtime/probes/bench/run_bench @@ -5,7 +5,7 @@ proc do_time {module n} { global Failures # start kprobes - if {[catch {exec ../../stpd/stpd -mq $module.ko > xxx &} pid]} { + if {[catch {exec ../../stpd/stpd -rmq $module.ko > xxx &} pid]} { puts $pid exit -1 } @@ -72,12 +72,6 @@ set mem [split [exec cat /proc/meminfo] \n] puts "[lindex $mem 0] [lindex $mem 1]" puts "--------------------------------------" -# load the modules -if {[catch {exec stp_check} res]} { - puts $res - exit -1 -} - # get the timings without kprobes if {[catch {exec ./ttest 4} res1]} { puts $res1 -- 2.43.5