rpms/stapitrace/EL-6 itrace-rhel6.patch, NONE, 1.1 stapitrace.spec, 1.28, 1.29
Maynard Johnson
maynardj at fedoraproject.org
Fri Jun 11 18:47:26 UTC 2010
Author: maynardj
Update of /cvs/pkgs/rpms/stapitrace/EL-6
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv31560
Modified Files:
stapitrace.spec
Added Files:
itrace-rhel6.patch
Log Message:
Modified Files:
stapitrace.spec
Added Files:
itrace-rhel6.patch
Incorporated upstream fixes required for building and running on RHEL6.
itrace-rhel6.patch:
pi_btrace.c | 27 +++++++++++++++++++++++----
pi_scs.c | 18 ++++++++++++++++--
2 files changed, 39 insertions(+), 6 deletions(-)
--- NEW FILE itrace-rhel6.patch ---
diff -paur Dpiperf/src/driver/pi_btrace.c Dpiperf-updates/src/driver/pi_btrace.c
--- Dpiperf/src/driver/pi_btrace.c 2010-06-11 13:25:34.000000000 -0500
+++ Dpiperf-updates/src/driver/pi_btrace.c 2010-06-11 13:30:05.000000000 -0500
@@ -325,18 +325,32 @@ int SoftTraceOn(void)
union perf_addr addr;
#endif
+// At kernel version 2.6.26, the export for init_mm was removed. When ITrace is built
+// as a standalone driver, the Makefile invokes a script that looks for the address of
+// init_mm in /proc/kallsyms and stores the result in hooks.h. Unfortunately,
+// the stapitrace system-tap module does not use that Makefile, so it has no way to determine
+// the address of init_mm. Since there's no other means of retrieving the start_code and end_code
+// values contained by init_mm, the only alternative is to simply zero-out the related values
+// in mdata. We also to need to ensure we don't try to use the pi_init_mm_address macro
+// that would normally be defined in hooks.h. Rather than doing this only when kernel version
+// is > 2.6.25, we'll just do it all the time now.
+
+#endif // STAP_ITRACE
+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,99)
struct mm_struct * p_init_mm = (struct mm_struct *)pi_init_mm_address;
#else
struct mm_struct * p_init_mm = &init_mm;
#endif
-
-#endif // STAP_ITRACE
if (PU_FAILURE == is_perf_buf(0))
return(PU_FAILURE);
#ifndef STAP_ITRACE
+#if defined(CONFIG_64BIT)
+
+ addr.cval = 0ULL;
+#endif
PI_ON_EACH_CPU(btrace_get_start_time, 0, 1);
preempt_disable();
@@ -367,7 +381,6 @@ int SoftTraceOn(void)
// PPC64 info
addr.cval = *(unsigned long *)ppc_tb_freq_location;
#ifndef STAP_ITRACE
- addr.cval = 0ULL;
PerfTraceHookSimple2(driver_info.mte_type, SYS_INFO_MAJOR,
SFT_HOOK_SYSINFO_TIME_BASE_MINOR,
(uint32_t)addr.sval.low,
@@ -389,6 +402,7 @@ int SoftTraceOn(void)
mdata.minorCode = MTE_MINOR;
mdata.pid = 0;
+#endif // STAP_ITRACE
#if !defined(CONFIG_64BIT)
mdata.addrl = p_init_mm->start_code;
mdata.int_cnt = 5;
@@ -406,6 +420,9 @@ int SoftTraceOn(void)
mdata.addrh = addr.sval.high;
mdata.int_cnt = 6;
#endif
+
+#ifndef STAP_ITRACE
+
buffer = (char *)&mdata.str_val[0];
mdata.str_len = strlen(kname);
memcpy(buffer, kname, mdata.str_len);
@@ -929,7 +946,7 @@ void write_segment_hooks(struct task_str
struct mm_struct * mm;
char * seg_name;
- char name_buffer[300];
+ char * name_buffer;
uint32_t hook_size = 0;
MTE_HOOK hook;
@@ -942,6 +959,7 @@ void write_segment_hooks(struct task_str
hook.minorCode = MTE_MINOR;
hook.pid = tp->pid;
hook.NT_cs = 0;
+ name_buffer = (char *)vmalloc(300 * sizeof(char *));
for (vma = tp->mm->mmap; vma; vma = vma->vm_next) {
if (!(vma->vm_flags & VM_MAYEXEC))
@@ -962,6 +980,7 @@ void write_segment_hooks(struct task_str
hook.typeLength = PERF_MIXED_DATA | hook_size;
MTEWrite((uint8_t *)&hook, hook_size);
}
+ vfree(name_buffer);
return;
}
#endif // STAP_ITRACE BODY
diff -paur Dpiperf/src/driver/pi_scs.c Dpiperf-updates/src/driver/pi_scs.c
--- Dpiperf/src/driver/pi_scs.c 2008-11-04 19:19:37.000000000 -0600
+++ Dpiperf-updates/src/driver/pi_scs.c 2010-06-11 08:27:55.000000000 -0500
@@ -106,6 +106,10 @@ int PerfEnableSamplingNotifyMode(int ctr
pid_t pid;
NOTIFY_LIST_ENTRY * le;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ struct pid * _pid_st;
+#endif
+
PDEBUG("PerfEnableSamplingNotifyMode: start - event=%d, rate=%d, flags=0x%08X, active_jvms=%d\n",
ctr_event, rate, flags, active_jvms);
@@ -208,6 +212,9 @@ int PerfEnableSamplingNotifyMode(int ctr
// Get SAMPLER_INFO row for this JVM.
// All (or at least some) of the samplers should have registered by now.
le->sampler_info = NULL;
+
+ rcu_read_lock();
+
if (!SingleSampler) {
for (j = 0; j < MAX_JVMS; j++) {
for (c = 0; c < driver_info.num_cpus; c++) {
@@ -215,7 +222,10 @@ int PerfEnableSamplingNotifyMode(int ctr
le->sampler_info = &MappedData->sampler_info[j][0];
le->stats = &MappedData->scs_jvm_stats[j];
le->gc_active = &MappedData->ScsGcActive[j];
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ _pid_st = find_vpid(jvm->sampler_tid[c]);
+ le->sampler_task[c] = pid_task(_pid_st, PIDTYPE_PID);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
le->sampler_task[c] = find_task_by_vpid(le->sampler_info[c].self_tid);
#else
le->sampler_task[c] = find_task_by_pid(le->sampler_info[c].self_tid);
@@ -233,7 +243,10 @@ int PerfEnableSamplingNotifyMode(int ctr
le->sampler_info = &MappedData->sampler_info[0][0];
le->stats = &MappedData->scs_jvm_stats[0];
le->gc_active = &MappedData->ScsGcActive[0];
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ _pid_st = find_vpid(jvm->sampler_tid[c]);
+ le->sampler_task[c] = pid_task(_pid_st, PIDTYPE_PID);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
le->sampler_task[0] = find_task_by_vpid(le->sampler_info[0].self_tid);
#else
le->sampler_task[0] = find_task_by_pid(le->sampler_info[0].self_tid);
@@ -273,6 +286,7 @@ int PerfEnableSamplingNotifyMode(int ctr
wake_up_process(pi_prio_thread);
wait_for_completion(&prio_completed);
#endif
+ rcu_read_unlock();
// We need task exit hook to clean up when a process exits
Index: stapitrace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/stapitrace/EL-6/stapitrace.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- stapitrace.spec 17 May 2010 20:57:02 -0000 1.28
+++ stapitrace.spec 11 Jun 2010 18:47:25 -0000 1.29
@@ -6,7 +6,7 @@
Name: stapitrace
Summary: Instruction Tracing Tool
Version: 2.0.0
-Release: 0.%{alphatag}%{?dist}.3
+Release: 0.%{alphatag}%{?dist}.4
License: GPLv2+
Group: Development/Tools
URL: http://sourceforge.net/projects/perfinsp
@@ -16,6 +16,7 @@ Patch1: itrace-f11-fixes_for-ups
Patch2: stapitrace-insn-update.patch
Patch3: itrace-bfd-config.patch
Patch4: stapitrace-build-fixes.patch
+Patch5: itrace-rhel6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: systemtap > 1.0 systemtap-runtime, binutils, binutils-devel
BuildRequires: binutils binutils-devel autoconf automake zlib-devel
@@ -44,6 +45,7 @@ It is based on and shares code from Perf
%patch2 -p1
%patch3 -p1
%patch4 -p1
+%patch5 -p1
%build
autoreconf -i --force
@@ -89,6 +91,10 @@ cd src/stap
%{_bindir}/itrace
%changelog
+* Fri Jun 11 2010 Maynard Johnson <maynardj at us.ibm.com>
+- Incorporating upstream fixes required for building and
+ running on RHEL6.
+
* Mon May 17 2010 Maynard Johnson <maynardj at us.ibm.com>
- Added requirement for systemtap version 1 and changed tapset
subdir from 'ppc64' to 'powerpc' to match change in systemtap 1.0.
More information about the scm-commits
mailing list