rpms/stapitrace/devel stapitrace-utrace2.patch,1.1,1.2

Maynard Johnson maynardj at fedoraproject.org
Mon Dec 15 23:39:47 UTC 2008


Author: maynardj

Update of /cvs/pkgs/rpms/stapitrace/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19127

Modified Files:
	stapitrace-utrace2.patch 
Log Message:
Another update needed for SystemTap 0.8 update

stapitrace-utrace2.patch:

Index: stapitrace-utrace2.patch
===================================================================
RCS file: /cvs/pkgs/rpms/stapitrace/devel/stapitrace-utrace2.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- stapitrace-utrace2.patch	23 Oct 2008 17:43:42 -0000	1.1
+++ stapitrace-utrace2.patch	15 Dec 2008 23:39:17 -0000	1.2
@@ -1,6 +1,172 @@
+diff -paurN old/src/driver/pi_btrace.c new/src/driver/pi_btrace.c
+--- old/src/driver/pi_btrace.c	2008-10-23 19:22:04.000000000 -0700
++++ new/src/driver/pi_btrace.c	2008-10-24 08:14:15.000000000 -0700
+@@ -271,7 +271,12 @@ int SoftTraceOff(void)
+ 
+ 	unload_MTE_handler(NULL);
+ 
+-	on_each_cpu(btrace_get_end_time, 0, 1, 1);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
++	on_each_cpu(btrace_get_end_time, NULL, 1, 1);
++#else
++	on_each_cpu(btrace_get_end_time, NULL, 1);
++#endif
++
+ 	
+ #ifdef PI_DEBUG
+ 	for (i = 0; i < driver_info.num_cpus; ++i)
+@@ -306,7 +311,11 @@ int SoftTraceOn(void)
+ 		return(PU_FAILURE);
+ #ifndef STAP_ITRACE
+ 
+-	on_each_cpu(btrace_get_start_time, 0, 1, 1);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
++	on_each_cpu(btrace_get_start_time, NULL, 1, 1);
++#else
++	on_each_cpu(btrace_get_start_time, NULL, 1);
++#endif
+ 		
+ 	preempt_disable();
+ 
+@@ -791,7 +800,12 @@ char * set_segment_name(MTE_HOOK * hook,
+ 	char * seg_name;
+ 
+ 	if (vma->vm_file != NULL) {
+-		seg_name = d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, name_buffer, 256);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
++ 		seg_name = d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, name_buffer, 256);
++#else
++		seg_name = d_path(&(vma->vm_file->f_path), name_buffer, 256);
++#endif  
++
+ 		if (strstr(seg_name, "(deleted)") != NULL)
+ 			seg_name = NULL;
+ 		else
+diff -paurN old/src/driver/ppc64/pi_cpuinit.c new/src/driver/ppc64/pi_cpuinit.c
+--- old/src/driver/ppc64/pi_cpuinit.c	2008-10-23 19:02:19.000000000 -0700
++++ new/src/driver/ppc64/pi_cpuinit.c	2008-10-23 19:02:19.000000000 -0700
+@@ -58,9 +58,9 @@ int pitrace_cpu_init(void)
+ 	unsigned long        pvr;
+ 	struct device_node * cpu_node;
+ 	unsigned int       * fp;
++#ifndef STAP_ITRACE // CPU_INIT
+         unsigned long        cpu_freq = 0; 
+ 
+-#ifndef STAP_ITRACE // CPU_INIT
+ 	cpu_node = of_find_node_by_type(NULL, "cpu");
+ 	if ( cpu_node ) {
+ 		fp = (unsigned int *)of_get_property(cpu_node, "ibm,extended-clock-frequency", NULL);
+diff -paurN old/src/stap/pi_itrace.template new/src/stap/pi_itrace.template
+--- old/src/stap/pi_itrace.template	2008-10-24 06:52:56.000000000 -0700
++++ new/src/stap/pi_itrace.template	2008-10-24 08:24:43.000000000 -0700
+@@ -194,7 +194,12 @@ void pi_itrace_cleanup(void)
+ 	int i;
+ 	unsigned char tempBuf[BUFFER_WRITE_CHUNK_SIZE];
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+ 	on_each_cpu(btrace_get_end_time, 0, 1, 1);
++#else
++	on_each_cpu(btrace_get_end_time, 0, 1);
++#endif
++
+ 
+ 	for (i = 0; i < driver_info.num_cpus; i++) {
+ 		unsigned char tempBuf[BUFFER_WRITE_CHUNK_SIZE];
+diff -paurN old/src/stap/ppc_pi_itrace.template new/src/stap/ppc_pi_itrace.template
+--- old/src/stap/ppc_pi_itrace.template	2008-10-23 19:02:19.000000000 -0700
++++ new/src/stap/ppc_pi_itrace.template	2008-10-23 19:02:19.000000000 -0700
+@@ -26,6 +26,8 @@
+ 
+ [DEFS]
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
++#undef PDEBUG
++#define PDEBUG(fmt, args...) do {} while (0)
+ #define GET_VSID(addr) (REGION_ID(addr) >= KERNEL_REGION_ID) ? \
+    get_kernel_vsid(addr, MMU_SEGSIZE_256M) : \
+ 	get_vsid(current->mm->context.id, addr, MMU_SEGSIZE_256M)
+diff -paurN old/src/stap/ppc_usr_itrace.stp new/src/stap/ppc_usr_itrace.stp
+--- old/src/stap/ppc_usr_itrace.stp	2008-10-24 11:30:54.000000000 -0700
++++ new/src/stap/ppc_usr_itrace.stp	2008-10-24 11:40:55.000000000 -0700
+@@ -31,20 +31,74 @@ static int get_instr(unsigned long addr,
+ 
+ }
+ 
++/*
++ * Some kernel versions don't export access_process_vm, so we copied and pasted
++ * it here.  Fortunately, everything it calls is exported.
++ */
++#include <linux/pagemap.h>
++#include <asm/cacheflush.h>
++static int __access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
++{
++	struct mm_struct *mm;
++	struct vm_area_struct *vma;
++	struct page *page;
++	void *old_buf = buf;
++
++	mm = get_task_mm(tsk);
++	if (!mm)
++		return 0;
++
++	down_read(&mm->mmap_sem);
++	/* ignore errors, just check how much was sucessfully transfered */
++	while (len) {
++		int bytes, ret, offset;
++		void *maddr;
++
++		ret = get_user_pages(tsk, mm, addr, 1,
++				write, 1, &page, &vma);
++		if (ret <= 0)
++			break;
++
++		bytes = len;
++		offset = addr & (PAGE_SIZE-1);
++		if (bytes > PAGE_SIZE-offset)
++			bytes = PAGE_SIZE-offset;
++
++		maddr = kmap(page);
++		if (write) {
++			copy_to_user_page(vma, page, addr,
++					  maddr + offset, buf, bytes);
++			set_page_dirty_lock(page);
++		} else {
++			copy_from_user_page(vma, page, addr,
++					    buf, maddr + offset, bytes);
++		}
++		kunmap(page);
++		page_cache_release(page);
++		len -= bytes;
++		buf += bytes;
++		addr += bytes;
++	}
++	up_read(&mm->mmap_sem);
++	mmput(mm);
++
++	return buf - old_buf;
++}
++
+ static void insert_atomic_ss_breakpoint (struct task_struct *tsk,
+ 	struct bpt_info *bpt)
+ {
+ 	unsigned int bp_instr = BPT_TRAP;
+ 
+ 	bpt->instr = get_instr(bpt->addr, "insert_atomic_ss_breakpoint");
+-	WARN_ON(access_process_vm(tsk, bpt->addr, &bp_instr, INSTR_SZ, 1) !=
++	WARN_ON(__access_process_vm(tsk, bpt->addr, &bp_instr, INSTR_SZ, 1) !=
+ 		INSTR_SZ);
+ }
+ 
+ static void remove_atomic_ss_breakpoint (struct task_struct *tsk,
+ 	struct bpt_info *bpt)
+ {
+-	WARN_ON(access_process_vm(tsk, bpt->addr, &bpt->instr, INSTR_SZ, 1) !=
++	WARN_ON(__access_process_vm(tsk, bpt->addr, &bpt->instr, INSTR_SZ, 1) !=
+ 		INSTR_SZ);
+ }
+ 
 diff -paurN old/src/stap/usr_itrace.stp new/src/stap/usr_itrace.stp
---- old/src/stap/usr_itrace.stp	2008-08-03 05:36:42.000000000 -0500
-+++ new/src/stap/usr_itrace.stp	2008-08-03 05:37:58.000000000 -0500
+--- old/src/stap/usr_itrace.stp	2008-10-23 19:54:53.000000000 -0700
++++ new/src/stap/usr_itrace.stp	2008-10-24 08:34:09.000000000 -0700
 @@ -19,7 +19,6 @@
  #include <linux/rcupdate.h>
  #include <linux/utrace.h>
@@ -103,7 +269,33 @@
  	.report_signal = usr_itrace_report_signal,
  	.report_clone = usr_itrace_report_clone,
  	.report_death = usr_itrace_report_death
-@@ -191,13 +204,17 @@ static struct itrace_info *create_itrace
+@@ -152,7 +165,11 @@ static struct task_struct *get_task_by_p
+ 	struct task_struct *tsk;
+ 
+ 	rcu_read_lock();
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+ 	tsk = find_task_by_pid(pid);
++#else
++	tsk = find_task_by_vpid(pid);
++#endif
+ 	if (tsk)
+ 		get_task_struct(tsk);
+ 	rcu_read_unlock();
+@@ -165,6 +182,7 @@ static struct task_struct *get_task_by_p
+ static struct itrace_info *create_itrace_info(struct task_struct *tsk)
+ {
+ 	struct itrace_info *ui;
++	int status;
+ 
+ 	if (debug)
+ 		printk(KERN_INFO "create_itrace_info: tid=%d\n", tsk->pid);
+@@ -186,16 +204,31 @@ static struct itrace_info *create_itrace
+ 		create_task_hook(tsk);
+ 
+ 	/* attach a single stepping engine */
+-	ui->engine = utrace_attach(ui->tsk, UTRACE_ATTACH_CREATE, &utrace_ops, ui);
++	ui->engine = utrace_attach_task(ui->tsk, UTRACE_ATTACH_CREATE, &utrace_ops, ui);
+ 
  	if (IS_ERR(ui->engine)) {
  		printk(KERN_ERR "utrace_attach returns %ld\n",
  			PTR_ERR(ui->engine));
@@ -113,29 +305,50 @@
 -			UTRACE_EVENT(CLONE) | UTRACE_EVENT_SIGNAL_ALL |
 -			UTRACE_EVENT(DEATH));
 +		return NULL;
- 	}
- 
-+	utrace_set_events(tsk, ui->engine, ui->engine->flags | 
++	}
++
++	status = utrace_set_events(tsk, ui->engine, ui->engine->flags | 
 +		UTRACE_EVENT(QUIESCE) |
 +		UTRACE_EVENT(CLONE) | UTRACE_EVENT_SIGNAL_ALL |
 +		UTRACE_EVENT(DEATH));
++	if (status < 0) {
++		printk(KERN_ERR "utrace_attach returns %d\n", status);
++		return NULL;
++	}
 +
-+	if (utrace_control(tsk, ui->engine, UTRACE_STOP)) 
-+		utrace_control(tsk, ui->engine, step_flag); 
-+
++	status = utrace_control(tsk, ui->engine, UTRACE_STOP);
++	if (status == 0) {
++		status = utrace_control(tsk, ui->engine, step_flag); 
++		if (status < 0) {
++			printk(KERN_ERR "utrace_control(%d) returns %d\n",
++				step_flag, status);
++			return NULL;
++		}
+ 	}
+ 
  	return ui;
- }
+@@ -219,6 +252,7 @@ done:
+ void static remove_usr_itrace_info(struct itrace_info *ui)
+ {
+ 	struct itrace_info *tmp;
++	int status;
  
-@@ -227,7 +244,7 @@ void static remove_usr_itrace_info(struc
+ 	if (debug)
+ 		printk(KERN_INFO "remove_usr_itrace_info called\n");
+@@ -227,7 +261,11 @@ void static remove_usr_itrace_info(struc
  
  	spin_lock(&itrace_lock);
  	if (ui->tsk && ui->engine) {
 -		(void) utrace_detach(ui->tsk, ui->engine);
-+		(void) utrace_control(ui->tsk, ui->engine, UTRACE_DETACH);
++		status = utrace_control(ui->tsk, ui->engine, UTRACE_DETACH);
++		if (status < 0)
++			printk(KERN_ERR
++				 "utrace_control(UTRACE_DETACH) returns %d\n",
++				status);
  	}
  	list_del(&ui->link);
  	spin_unlock(&itrace_lock);
-@@ -269,14 +286,10 @@ function usr_itrace_on:long (tid:long)
+@@ -269,14 +307,10 @@ function usr_itrace_on:long (tid:long)
  		ui = create_itrace_info(tsk);
  		WARN_ON(!ui);
  		put_task_struct(tsk);
@@ -154,7 +367,7 @@
  
  
  	/* start single-stepping engine */
-@@ -311,23 +324,21 @@ function usr_itrace_init:long (step_mode
+@@ -311,23 +345,21 @@ function usr_itrace_init:long (step_mode
  %{
  	step_flag = 0;
  	if (strncmp(THIS->step_mode, "single_step", 11) == 0) {




More information about the fedora-extras-commits mailing list