* [PATCH 1/4] OProfile: Export task->tgid in the buffer
@ 2003-06-12 2:02 John Levon
2003-06-12 2:02 ` [PATCH 2/4] OProfile: update Changes John Levon
0 siblings, 1 reply; 4+ messages in thread
From: John Levon @ 2003-06-12 2:02 UTC (permalink / raw)
To: torvalds, linux-kernel
Export the task->tgid to userspace as well. This is needed
for forthcoming thread profiling stuff and should have been
done in the original patch ... oh well.
This requires an upgrade to oprofile 0.5.3. You can get it from
the website, or, for the impatient, here :
http://movementarian.org/oprofile-0.5.3.tar.gz
diff -Naur -X dontdiff linux-cvs/drivers/oprofile/buffer_sync.c linux-fixes/drivers/oprofile/buffer_sync.c
--- linux-cvs/drivers/oprofile/buffer_sync.c 2003-05-26 05:42:35.000000000 +0100
+++ linux-fixes/drivers/oprofile/buffer_sync.c 2003-06-12 02:05:19.000000000 +0100
@@ -274,12 +272,17 @@
add_event_entry(KERNEL_EXIT_SWITCH_CODE);
}
-static void add_user_ctx_switch(pid_t pid, unsigned long cookie)
+static void
+add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
{
add_event_entry(ESCAPE_CODE);
add_event_entry(CTX_SWITCH_CODE);
- add_event_entry(pid);
+ add_event_entry(task->pid);
add_event_entry(cookie);
+ /* Another code for daemon back-compat */
+ add_event_entry(ESCAPE_CODE);
+ add_event_entry(CTX_TGID_CODE);
+ add_event_entry(task->tgid);
}
@@ -446,7 +449,7 @@
mm = take_tasks_mm(new);
cookie = get_exec_dcookie(mm);
- add_user_ctx_switch(new->pid, cookie);
+ add_user_ctx_switch(new, cookie);
}
} else {
add_sample(mm, s, in_kernel);
diff -Naur -X dontdiff linux-cvs/drivers/oprofile/event_buffer.h linux-fixes/drivers/oprofile/event_buffer.h
--- linux-cvs/drivers/oprofile/event_buffer.h 2003-04-02 06:06:51.000000000 +0100
+++ linux-fixes/drivers/oprofile/event_buffer.h 2003-06-12 02:04:05.000000000 +0100
@@ -31,6 +31,7 @@
#define KERNEL_ENTER_SWITCH_CODE 4
#define KERNEL_EXIT_SWITCH_CODE 5
#define MODULE_LOADED_CODE 6
+#define CTX_TGID_CODE 7
/* add data to the event buffer */
void add_event_entry(unsigned long data);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/4] OProfile: update Changes
2003-06-12 2:02 [PATCH 1/4] OProfile: Export task->tgid in the buffer John Levon
@ 2003-06-12 2:02 ` John Levon
2003-06-12 2:02 ` [PATCH 3/4] OProfile: remove useless code John Levon
0 siblings, 1 reply; 4+ messages in thread
From: John Levon @ 2003-06-12 2:02 UTC (permalink / raw)
To: torvalds, linux-kernel
Update the version information.
diff -Naur -X dontdiff linux-cvs/Documentation/Changes linux-fixes/Documentation/Changes
--- linux-cvs/Documentation/Changes 2003-05-25 23:13:37.000000000 +0100
+++ linux-fixes/Documentation/Changes 2003-06-12 02:07:08.000000000 +0100
@@ -61,7 +61,7 @@
o PPP 2.4.0 # pppd --version
o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
o procps 2.0.9 # ps --version
-o oprofile 0.5 # oprofiled --version
+o oprofile 0.5.3 # oprofiled --version
o nfs-utils 1.0.3 # showmount --version
Kernel compilation
@@ -367,7 +367,7 @@
OProfile
--------
-o <http://oprofile.sf.net/download.php3>
+o <http://oprofile.sf.net/download/>
Suggestions and corrections
===========================
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] OProfile: remove useless code
2003-06-12 2:02 ` [PATCH 2/4] OProfile: update Changes John Levon
@ 2003-06-12 2:02 ` John Levon
2003-06-12 2:02 ` [PATCH 4/4] OProfile: fix init / exit routine John Levon
0 siblings, 1 reply; 4+ messages in thread
From: John Levon @ 2003-06-12 2:02 UTC (permalink / raw)
To: torvalds, linux-kernel
Remove some useless code, from Philippe Elie.
diff -Naur -X dontdiff linux-cvs/drivers/oprofile/buffer_sync.c linux-fixes/drivers/oprofile/buffer_sync.c
--- linux-cvs/drivers/oprofile/buffer_sync.c 2003-05-26 05:42:35.000000000 +0100
+++ linux-fixes/drivers/oprofile/buffer_sync.c 2003-06-12 02:05:19.000000000 +0100
@@ -236,8 +236,6 @@
struct vm_area_struct * vma;
for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) {
- if (!vma)
- goto out;
if (!vma->vm_file)
continue;
@@ -250,7 +248,7 @@
*offset = (vma->vm_pgoff << PAGE_SHIFT) + addr - vma->vm_start;
break;
}
-out:
+
return cookie;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] OProfile: fix init / exit routine
2003-06-12 2:02 ` [PATCH 3/4] OProfile: remove useless code John Levon
@ 2003-06-12 2:02 ` John Levon
0 siblings, 0 replies; 4+ messages in thread
From: John Levon @ 2003-06-12 2:02 UTC (permalink / raw)
To: torvalds, linux-kernel
Ensure that the arch exit routines are always called when needed,
previously we could end up with a nasty crash if using oprofile.timer=1,
or the FS register failed.
diff -Naur -X dontdiff linux-cvs/drivers/oprofile/oprof.c linux-fixes/drivers/oprofile/oprof.c
--- linux-cvs/drivers/oprofile/oprof.c 2003-05-26 05:42:45.000000000 +0100
+++ linux-fixes/drivers/oprofile/oprof.c 2003-06-12 03:07:14.000000000 +0100
@@ -131,36 +131,33 @@
static int __init oprofile_init(void)
{
- int err = -ENODEV;
+ /* Architecture must fill in the interrupt ops and the
+ * logical CPU type, or we can fall back to the timer
+ * interrupt profiler.
+ */
+ int err = oprofile_arch_init(&oprofile_ops);
- if (!timer) {
- /* Architecture must fill in the interrupt ops and the
- * logical CPU type, or we can fall back to the timer
- * interrupt profiler.
- */
- err = oprofile_arch_init(&oprofile_ops);
- }
-
- if (err == -ENODEV) {
+ if (err == -ENODEV || timer) {
timer_init(&oprofile_ops);
err = 0;
- }
-
- if (err)
+ } else if (err) {
goto out;
+ }
if (!oprofile_ops->cpu_type) {
printk(KERN_ERR "oprofile: cpu_type not set !\n");
err = -EFAULT;
- goto out;
+ } else {
+ err = oprofilefs_register();
}
-
- err = oprofilefs_register();
- if (err)
- goto out;
+ if (err)
+ goto out_exit;
out:
return err;
+out_exit:
+ oprofile_arch_exit();
+ goto out;
}
diff -Naur -X dontdiff linux-cvs/include/linux/oprofile.h linux-fixes/include/linux/oprofile.h
--- linux-cvs/include/linux/oprofile.h 2003-04-05 05:12:09.000000000 +0100
+++ linux-fixes/include/linux/oprofile.h 2003-06-12 02:03:47.000000000 +0100
@@ -40,7 +40,9 @@
/**
* One-time initialisation. *ops must be set to a filled-in
- * operations structure.
+ * operations structure. This is called even in timer interrupt
+ * mode.
+ *
* Return 0 on success.
*/
int oprofile_arch_init(struct oprofile_operations ** ops);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-06-12 1:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-12 2:02 [PATCH 1/4] OProfile: Export task->tgid in the buffer John Levon
2003-06-12 2:02 ` [PATCH 2/4] OProfile: update Changes John Levon
2003-06-12 2:02 ` [PATCH 3/4] OProfile: remove useless code John Levon
2003-06-12 2:02 ` [PATCH 4/4] OProfile: fix init / exit routine John Levon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox