This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Support for the old "pid" interface of perf.


Hi,

I'm still using a rather old Linux kernel version. The support for perf
in newer versions of SystemTap is broken for this kernel version. The
patch tries to bring the support for kernel versions prior to 2.6.37
back.

Kind Regards,
Torsten

>From bbad2967ff6376751533e6f7a6bfa610c720f2d4 Mon Sep 17 00:00:00 2001
Message-Id: <bbad2967ff6376751533e6f7a6bfa610c720f2d4.1365617305.git.Torsten.Polle@gmx.de>
From: Torsten Polle <Torsten.Polle@gmx.de>
Date: Wed, 10 Apr 2013 20:07:32 +0200
Subject: [PATCH] Support "pid" interface of perf.

The interface of perf_event_create_kernel_counter() in kernel versions prior
2.6.37 takes the process id instead of a pointer to the task struct.

Signed-off-by: Torsten Polle <Torsten.Polle@gmx.de>
---
 runtime/linux/perf.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/runtime/linux/perf.c b/runtime/linux/perf.c
index 4db0d61..33f40a3 100644
--- a/runtime/linux/perf.c
+++ b/runtime/linux/perf.c
@@ -36,7 +36,12 @@ static long _stp_perf_init (struct stap_perf_probe *stp, struct task_struct* tas
 	    if (stp->e.t.per_thread_event != 0) /* already setup */
 	      return 0;
 	    stp->e.t.per_thread_event = perf_event_create_kernel_counter(&stp->attr,
-								     -1, task,
+								     -1, 
+#if defined(STAPCONF_PERF_STRUCTPID)
+								     task,
+#else
+								     task->pid,
+#endif
 								     stp->callback
 #ifdef STAPCONF_PERF_COUNTER_CONTEXT
 								     , NULL
-- 
1.7.4.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]