2007-05-29 13:59:57

by Stephane Eranian

[permalink] [raw]
Subject: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

This patch contains all the modified generic files:

linux/include/linux/sched.h:
- add pfm_context pointer to struct task_struct. This is used
to connect a perfmon2 context to a task when doing per-thread
monitoring.

linux/include/linux/syscalls.h:
- declare prototypes of our new system calls

linux/kernel/sched.c:
- add include perfmon.h to ensure pfm_ctxsw() has a defined prototype

linux/kernel/sys_ni.c:
- add perfmon2 cond_syscall() definitions (when CONFIG_PERFMON is off)

drivers/oprofile/oprofile_files.c:
linux-2.6.22.base/drivers/oprofile/timer_int.c:
include/linux/oprofile.h:
- add new implementation entry for oprofilefs. used to check if oprofile is
using perfmon vs. runs natively



Only in linux-2.6.22/Documentation: perfmon2.txt
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/Makefile linux-2.6.22/Makefile
--- linux-2.6.22.base/Makefile 2007-05-29 03:17:15.000000000 -0700
+++ linux-2.6.22/Makefile 2007-05-29 03:24:14.000000000 -0700
@@ -553,7 +553,7 @@ export mod_strip_cmd


ifeq ($(KBUILD_EXTMOD),)
-core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
+core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ perfmon/

vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/drivers/oprofile/oprofile_files.c linux-2.6.22/drivers/oprofile/oprofile_files.c
--- linux-2.6.22.base/drivers/oprofile/oprofile_files.c 2007-05-29 03:17:41.000000000 -0700
+++ linux-2.6.22/drivers/oprofile/oprofile_files.c 2007-05-29 03:24:14.000000000 -0700
@@ -117,7 +117,17 @@ static ssize_t dump_write(struct file *
static const struct file_operations dump_fops = {
.write = dump_write,
};
-
+
+static ssize_t implementation(struct file * file, char __user * buf, size_t count, loff_t * offset)
+{
+ return oprofilefs_str_to_user(oprofile_ops.implementation, buf, count, offset);
+}
+
+
+static struct file_operations implementation_fops = {
+ .read = implementation,
+};
+
void oprofile_create_files(struct super_block * sb, struct dentry * root)
{
oprofilefs_create_file(sb, root, "enable", &enable_fops);
@@ -127,6 +137,7 @@ void oprofile_create_files(struct super_
oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &fs_cpu_buffer_size);
oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
+ oprofilefs_create_file(sb, root, "implementation", &implementation_fops);
oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
oprofile_create_stats_files(sb, root);
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/drivers/oprofile/timer_int.c linux-2.6.22/drivers/oprofile/timer_int.c
--- linux-2.6.22.base/drivers/oprofile/timer_int.c 2007-05-29 03:17:41.000000000 -0700
+++ linux-2.6.22/drivers/oprofile/timer_int.c 2007-05-29 03:24:14.000000000 -0700
@@ -43,4 +43,5 @@ void __init oprofile_timer_init(struct o
ops->start = timer_start;
ops->stop = timer_stop;
ops->cpu_type = "timer";
+ ops->implementation = "timer";
}
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/oprofile.h linux-2.6.22/include/linux/oprofile.h
--- linux-2.6.22.base/include/linux/oprofile.h 2007-05-29 03:17:57.000000000 -0700
+++ linux-2.6.22/include/linux/oprofile.h 2007-05-29 03:24:14.000000000 -0700
@@ -39,6 +39,8 @@ struct oprofile_operations {
void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
/* CPU identification string. */
char * cpu_type;
+ /* Identify method of string. */
+ char * implementation;
};

/**
Only in linux-2.6.22/include/linux: perfmon.h
Only in linux-2.6.22/include/linux: perfmon_dfl_smpl.h
Only in linux-2.6.22/include/linux: perfmon_fmt.h
Only in linux-2.6.22/include/linux: perfmon_pmu.h
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/sched.h linux-2.6.22/include/linux/sched.h
--- linux-2.6.22.base/include/linux/sched.h 2007-05-29 03:17:57.000000000 -0700
+++ linux-2.6.22/include/linux/sched.h 2007-05-29 03:24:14.000000000 -0700
@@ -89,6 +89,7 @@ struct sched_param {
struct exec_domain;
struct futex_pi_state;
struct bio;
+struct pfm_context;

/*
* List of flags we want to share for kernel threads,
@@ -1076,6 +1077,9 @@ struct task_struct {
#ifdef CONFIG_FAULT_INJECTION
int make_it_fail;
#endif
+#ifdef CONFIG_PERFMON
+ struct pfm_context *pfm_context;
+#endif
};

static inline pid_t process_group(struct task_struct *tsk)
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/syscalls.h linux-2.6.22/include/linux/syscalls.h
--- linux-2.6.22.base/include/linux/syscalls.h 2007-05-29 03:17:57.000000000 -0700
+++ linux-2.6.22/include/linux/syscalls.h 2007-05-29 03:24:14.000000000 -0700
@@ -29,6 +29,13 @@ struct msqid_ds;
struct new_utsname;
struct nfsctl_arg;
struct __old_kernel_stat;
+struct pfarg_ctx;
+struct pfarg_pmc;
+struct pfarg_pmd;
+struct pfarg_start;
+struct pfarg_load;
+struct pfarg_setinfo;
+struct pfarg_setdesc;
struct pollfd;
struct rlimit;
struct rusage;
@@ -611,4 +618,27 @@ asmlinkage long sys_eventfd(unsigned int

int kernel_execve(const char *filename, char *const argv[], char *const envp[]);

+asmlinkage long sys_pfm_create_context(struct pfarg_ctx __user *ureq,
+ void __user *uarg, size_t smpl_size);
+asmlinkage long sys_pfm_write_pmcs(int fd, struct pfarg_pmc __user *ureq,
+ int count);
+asmlinkage long sys_pfm_write_pmds(int fd, struct pfarg_pmd __user *ureq,
+ int count);
+asmlinkage long sys_pfm_read_pmds(int fd, struct pfarg_pmd __user *ureq,
+ int count);
+asmlinkage long sys_pfm_restart(int fd);
+asmlinkage long sys_pfm_stop(int fd);
+asmlinkage long sys_pfm_start(int fd, struct pfarg_start __user *ureq);
+asmlinkage long sys_pfm_load_context(int fd, struct pfarg_load __user *ureq);
+asmlinkage long sys_pfm_unload_context(int fd);
+asmlinkage long sys_pfm_delete_evtsets(int fd,
+ struct pfarg_setinfo __user *ureq,
+ int count);
+asmlinkage long sys_pfm_create_evtsets(int fd,
+ struct pfarg_setdesc __user *ureq,
+ int count);
+asmlinkage long sys_pfm_getinfo_evtsets(int fd,
+ struct pfarg_setinfo __user *ureq,
+ int count);
+
#endif
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/kernel/sched.c linux-2.6.22/kernel/sched.c
--- linux-2.6.22.base/kernel/sched.c 2007-05-29 03:17:57.000000000 -0700
+++ linux-2.6.22/kernel/sched.c 2007-05-29 03:24:14.000000000 -0700
@@ -53,6 +53,7 @@
#include <linux/kprobes.h>
#include <linux/delayacct.h>
#include <linux/reciprocal_div.h>
+#include <linux/perfmon.h>

#include <asm/tlb.h>
#include <asm/unistd.h>
diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/kernel/sys_ni.c linux-2.6.22/kernel/sys_ni.c
--- linux-2.6.22.base/kernel/sys_ni.c 2007-05-29 03:17:57.000000000 -0700
+++ linux-2.6.22/kernel/sys_ni.c 2007-05-29 03:24:14.000000000 -0700
@@ -113,6 +113,19 @@ cond_syscall(sys_vm86);
cond_syscall(compat_sys_ipc);
cond_syscall(compat_sys_sysctl);

+cond_syscall(sys_pfm_create_context);
+cond_syscall(sys_pfm_write_pmcs);
+cond_syscall(sys_pfm_write_pmds);
+cond_syscall(sys_pfm_read_pmds);
+cond_syscall(sys_pfm_restart);
+cond_syscall(sys_pfm_start);
+cond_syscall(sys_pfm_stop);
+cond_syscall(sys_pfm_load_context);
+cond_syscall(sys_pfm_unload_context);
+cond_syscall(sys_pfm_create_evtsets);
+cond_syscall(sys_pfm_delete_evtsets);
+cond_syscall(sys_pfm_getinfo_evtsets);
+
/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
cond_syscall(sys_pciconfig_write);
Only in linux-2.6.22: perfmon


2007-05-29 14:47:17

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

On Tue, 29 May 2007 06:48:16 -0700 Stephane Eranian <[email protected]> wrote:
>
> Only in linux-2.6.22/Documentation: perfmon2.txt

Did part of the patch go missing?

> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/Makefile linux-2.6.22/Makefile
> --- linux-2.6.22.base/Makefile 2007-05-29 03:17:15.000000000 -0700
> +++ linux-2.6.22/Makefile 2007-05-29 03:24:14.000000000 -0700
> @@ -553,7 +553,7 @@ export mod_strip_cmd
>
>
> ifeq ($(KBUILD_EXTMOD),)
> -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ perfmon/

This should go near the end of the patch set so that the kernel will
build at each step (if at all possible).

Seeing as what is missing below, naybe you should reorder the patch set
so that the generic changes are at the end i.e. introduce all the new
files and then wire them into the current ifrastructure.

> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/drivers/oprofile/oprofile_files.c linux-2.6.22/drivers/oprofile/oprofile_files.c
> --- linux-2.6.22.base/drivers/oprofile/oprofile_files.c 2007-05-29 03:17:41.000000000 -0700
> +++ linux-2.6.22/drivers/oprofile/oprofile_files.c 2007-05-29 03:24:14.000000000 -0700
> @@ -117,7 +117,17 @@ static ssize_t dump_write(struct file *
> static const struct file_operations dump_fops = {
> .write = dump_write,
> };
> -
> +
> +static ssize_t implementation(struct file * file, char __user * buf, size_t count, loff_t * offset)

Break long lines at 80 characters.

> Only in linux-2.6.22/include/linux: perfmon.h
> Only in linux-2.6.22/include/linux: perfmon_dfl_smpl.h
> Only in linux-2.6.22/include/linux: perfmon_fmt.h
> Only in linux-2.6.22/include/linux: perfmon_pmu.h

Missing files?

> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/kernel/sched.c linux-2.6.22/kernel/sched.c
> --- linux-2.6.22.base/kernel/sched.c 2007-05-29 03:17:57.000000000 -0700
> +++ linux-2.6.22/kernel/sched.c 2007-05-29 03:24:14.000000000 -0700
> @@ -53,6 +53,7 @@
> #include <linux/kprobes.h>
> #include <linux/delayacct.h>
> #include <linux/reciprocal_div.h>
> +#include <linux/perfmon.h>

So I guess it is missing above.

> Only in linux-2.6.22: perfmon

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (2.32 kB)
(No filename) (189.00 B)
Download all attachments

2007-05-30 11:34:20

by Robin Holt

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

On Wed, May 30, 2007 at 12:46:58AM +1000, Stephen Rothwell wrote:
> On Tue, 29 May 2007 06:48:16 -0700 Stephane Eranian <[email protected]> wrote:
> >
> > Only in linux-2.6.22/Documentation: perfmon2.txt
>
> Did part of the patch go missing?
>
> > diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/Makefile linux-2.6.22/Makefile
> > --- linux-2.6.22.base/Makefile 2007-05-29 03:17:15.000000000 -0700
> > +++ linux-2.6.22/Makefile 2007-05-29 03:24:14.000000000 -0700
> > @@ -553,7 +553,7 @@ export mod_strip_cmd
> >
> >
> > ifeq ($(KBUILD_EXTMOD),)
> > -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> > +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ perfmon/
>
> This should go near the end of the patch set so that the kernel will
> build at each step (if at all possible).
>
> Seeing as what is missing below, naybe you should reorder the patch set
> so that the generic changes are at the end i.e. introduce all the new
> files and then wire them into the current ifrastructure.

That breaks git-bisect. Just introducing new text, but not actually using
it makes it appear to somebody using git-bisect to identify the source of
a problem as though all the changes came in at the same time. Bad idea.

Thanks,
Robin

2007-05-30 13:42:23

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

On Wed, 30 May 2007 06:34:03 -0500 Robin Holt <[email protected]> wrote:
>
> That breaks git-bisect. Just introducing new text, but not actually using
> it makes it appear to somebody using git-bisect to identify the source of
> a problem as though all the changes came in at the same time. Bad idea.

But the patch set as it is includes references to files that do not exist
and so breaks the build.

Ideally, you would introduce references to files as the files are
introduced. I was suggesting a simpler reordering of the patches.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (635.00 B)
(No filename) (189.00 B)
Download all attachments

2007-05-30 13:57:24

by Stephane Eranian

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

Stephen,

On Wed, May 30, 2007 at 11:42:06PM +1000, Stephen Rothwell wrote:
> On Wed, 30 May 2007 06:34:03 -0500 Robin Holt <[email protected]> wrote:
> >
> > That breaks git-bisect. Just introducing new text, but not actually using
> > it makes it appear to somebody using git-bisect to identify the source of
> > a problem as though all the changes came in at the same time. Bad idea.
>
> But the patch set as it is includes references to files that do not exist
> and so breaks the build.
>

The patches are split artificially to make it easier to read on LKML.

There is no intention on my part to make them such that individually they
can build a kernel. You need at least the base+common+ your arch to
compile. The common code is divided by functionality. All functionalities
are required.

--
-Stephane

2007-06-04 15:18:54

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

On Tue, 29 May 2007, Stephane Eranian wrote:

> Only in linux-2.6.22/Documentation: perfmon2.txt

You need to send -N to diff(1) so this and perfmon.h, perfmon_dfl_smpl.h,
perfmon_fmt.h, and perfmon_pmu.h will be included in the patch. A
patchset should compile and work correctly at any time when each patch is
applied consecutively. Providing perfmon.h, for example, in patch 13
doesn't allow individual testing of all prior patches.

> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/Makefile linux-2.6.22/Makefile
> --- linux-2.6.22.base/Makefile 2007-05-29 03:17:15.000000000 -0700
> +++ linux-2.6.22/Makefile 2007-05-29 03:24:14.000000000 -0700
> @@ -553,7 +553,7 @@ export mod_strip_cmd
>
>
> ifeq ($(KBUILD_EXTMOD),)
> -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ perfmon/
>
> vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
> $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/drivers/oprofile/oprofile_files.c linux-2.6.22/drivers/oprofile/oprofile_files.c
> --- linux-2.6.22.base/drivers/oprofile/oprofile_files.c 2007-05-29 03:17:41.000000000 -0700
> +++ linux-2.6.22/drivers/oprofile/oprofile_files.c 2007-05-29 03:24:14.000000000 -0700
> @@ -117,7 +117,17 @@ static ssize_t dump_write(struct file *
> static const struct file_operations dump_fops = {
> .write = dump_write,
> };
> -
> +
> +static ssize_t implementation(struct file * file, char __user * buf, size_t count, loff_t * offset)
> +{
> + return oprofilefs_str_to_user(oprofile_ops.implementation, buf, count, offset);
> +}
> +
> +
> +static struct file_operations implementation_fops = {
> + .read = implementation,
> +};
> +
> void oprofile_create_files(struct super_block * sb, struct dentry * root)
> {
> oprofilefs_create_file(sb, root, "enable", &enable_fops);
> @@ -127,6 +137,7 @@ void oprofile_create_files(struct super_
> oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
> oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &fs_cpu_buffer_size);
> oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
> + oprofilefs_create_file(sb, root, "implementation", &implementation_fops);
> oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
> oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
> oprofile_create_stats_files(sb, root);

The commentary for how to interpret this new file is lacking; it appears
as though it will return "timer", "oprofile", or "nmi_timer" for existing
i386 subsystems and "perfmon2" with this addition. This should be
documented.

It isn't set generically in oprofile_arch_init() for other architectures.

> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/drivers/oprofile/timer_int.c linux-2.6.22/drivers/oprofile/timer_int.c
> --- linux-2.6.22.base/drivers/oprofile/timer_int.c 2007-05-29 03:17:41.000000000 -0700
> +++ linux-2.6.22/drivers/oprofile/timer_int.c 2007-05-29 03:24:14.000000000 -0700
> @@ -43,4 +43,5 @@ void __init oprofile_timer_init(struct o
> ops->start = timer_start;
> ops->stop = timer_stop;
> ops->cpu_type = "timer";
> + ops->implementation = "timer";
> }
> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/oprofile.h linux-2.6.22/include/linux/oprofile.h
> --- linux-2.6.22.base/include/linux/oprofile.h 2007-05-29 03:17:57.000000000 -0700
> +++ linux-2.6.22/include/linux/oprofile.h 2007-05-29 03:24:14.000000000 -0700
> @@ -39,6 +39,8 @@ struct oprofile_operations {
> void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
> /* CPU identification string. */
> char * cpu_type;
> + /* Identify method of string. */
> + char * implementation;
> };
>
> /**
> Only in linux-2.6.22/include/linux: perfmon.h
> Only in linux-2.6.22/include/linux: perfmon_dfl_smpl.h
> Only in linux-2.6.22/include/linux: perfmon_fmt.h
> Only in linux-2.6.22/include/linux: perfmon_pmu.h
> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/sched.h linux-2.6.22/include/linux/sched.h
> --- linux-2.6.22.base/include/linux/sched.h 2007-05-29 03:17:57.000000000 -0700
> +++ linux-2.6.22/include/linux/sched.h 2007-05-29 03:24:14.000000000 -0700
> @@ -89,6 +89,7 @@ struct sched_param {
> struct exec_domain;
> struct futex_pi_state;
> struct bio;
> +struct pfm_context;
>
> /*
> * List of flags we want to share for kernel threads,
> @@ -1076,6 +1077,9 @@ struct task_struct {
> #ifdef CONFIG_FAULT_INJECTION
> int make_it_fail;
> #endif
> +#ifdef CONFIG_PERFMON
> + struct pfm_context *pfm_context;
> +#endif
> };
>
> static inline pid_t process_group(struct task_struct *tsk)
> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/include/linux/syscalls.h linux-2.6.22/include/linux/syscalls.h
> --- linux-2.6.22.base/include/linux/syscalls.h 2007-05-29 03:17:57.000000000 -0700
> +++ linux-2.6.22/include/linux/syscalls.h 2007-05-29 03:24:14.000000000 -0700
> @@ -29,6 +29,13 @@ struct msqid_ds;
> struct new_utsname;
> struct nfsctl_arg;
> struct __old_kernel_stat;
> +struct pfarg_ctx;
> +struct pfarg_pmc;
> +struct pfarg_pmd;
> +struct pfarg_start;
> +struct pfarg_load;
> +struct pfarg_setinfo;
> +struct pfarg_setdesc;
> struct pollfd;
> struct rlimit;
> struct rusage;
> @@ -611,4 +618,27 @@ asmlinkage long sys_eventfd(unsigned int
>
> int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
>
> +asmlinkage long sys_pfm_create_context(struct pfarg_ctx __user *ureq,
> + void __user *uarg, size_t smpl_size);
> +asmlinkage long sys_pfm_write_pmcs(int fd, struct pfarg_pmc __user *ureq,
> + int count);
> +asmlinkage long sys_pfm_write_pmds(int fd, struct pfarg_pmd __user *ureq,
> + int count);
> +asmlinkage long sys_pfm_read_pmds(int fd, struct pfarg_pmd __user *ureq,
> + int count);
> +asmlinkage long sys_pfm_restart(int fd);
> +asmlinkage long sys_pfm_stop(int fd);
> +asmlinkage long sys_pfm_start(int fd, struct pfarg_start __user *ureq);
> +asmlinkage long sys_pfm_load_context(int fd, struct pfarg_load __user *ureq);
> +asmlinkage long sys_pfm_unload_context(int fd);
> +asmlinkage long sys_pfm_delete_evtsets(int fd,
> + struct pfarg_setinfo __user *ureq,
> + int count);
> +asmlinkage long sys_pfm_create_evtsets(int fd,
> + struct pfarg_setdesc __user *ureq,
> + int count);
> +asmlinkage long sys_pfm_getinfo_evtsets(int fd,
> + struct pfarg_setinfo __user *ureq,
> + int count);
> +
> #endif
> diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/kernel/sched.c linux-2.6.22/kernel/sched.c
> --- linux-2.6.22.base/kernel/sched.c 2007-05-29 03:17:57.000000000 -0700
> +++ linux-2.6.22/kernel/sched.c 2007-05-29 03:24:14.000000000 -0700
> @@ -53,6 +53,7 @@
> #include <linux/kprobes.h>
> #include <linux/delayacct.h>
> #include <linux/reciprocal_div.h>
> +#include <linux/perfmon.h>

perfmon.h isn't included in this patch so the inclusion of it here is a
mystery but I suspect it's for pfm_ctxsw() later.

David

2007-06-07 08:19:05

by Stephane Eranian

[permalink] [raw]
Subject: Re: [PATCH 02/22] 2.6.22-rc3 perfmon2 : generic kernel modifications

David,

On Mon, Jun 04, 2007 at 08:13:41AM -0700, David Rientjes wrote:
> On Tue, 29 May 2007, Stephane Eranian wrote:
>
> > Only in linux-2.6.22/Documentation: perfmon2.txt
>
> You need to send -N to diff(1) so this and perfmon.h, perfmon_dfl_smpl.h,
> perfmon_fmt.h, and perfmon_pmu.h will be included in the patch. A
> patchset should compile and work correctly at any time when each patch is
> applied consecutively. Providing perfmon.h, for example, in patch 13
> doesn't allow individual testing of all prior patches.
>
The 'patch set' I publish on LKML is artificially created from the perfmon
patch tarball. As such, it does not have the property yuo are talking about here.
There is no independence of each patch. They are all more or less nedeed to get
the kernel to compile.

> > +++ linux-2.6.22/drivers/oprofile/oprofile_files.c 2007-05-29 03:24:14.000000000 -0700
> > +
> > +static ssize_t implementation(struct file * file, char __user * buf, size_t count, loff_t * offset)
> > +{
> > + return oprofilefs_str_to_user(oprofile_ops.implementation, buf, count, offset);
> > +}
> > +
> > +
> > +static struct file_operations implementation_fops = {
> > + .read = implementation,
> > +};
> > +
> > void oprofile_create_files(struct super_block * sb, struct dentry * root)
> > {
> > oprofilefs_create_file(sb, root, "enable", &enable_fops);
> > @@ -127,6 +137,7 @@ void oprofile_create_files(struct super_
> > oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
> > oprofilefs_create_ulong(sb, root, "cpu_buffer_size", &fs_cpu_buffer_size);
> > oprofilefs_create_file(sb, root, "cpu_type", &cpu_type_fops);
> > + oprofilefs_create_file(sb, root, "implementation", &implementation_fops);
> > oprofilefs_create_file(sb, root, "backtrace_depth", &depth_fops);
> > oprofilefs_create_file(sb, root, "pointer_size", &pointer_size_fops);
> > oprofile_create_stats_files(sb, root);
>
> The commentary for how to interpret this new file is lacking; it appears
> as though it will return "timer", "oprofile", or "nmi_timer" for existing
> i386 subsystems and "perfmon2" with this addition. This should be
> documented.
>
> It isn't set generically in oprofile_arch_init() for other architectures.

This modification of oprofile was one to allow the user level oprofile daemon
to determine which kernel "implementation" of oprofile it is running on. This
way tool could transparently run on existing Oprofile and also on systems
with both perfmon and Oprofile.

Andi suggested that during a transition period, we let Oprofile and perfmon
co-exist as opposed to moving Oprofile on top of perfmon right away. I think this
is a good suggestion. As a consequence, I will remove this Oprofile extension.

> > diff --exclude=.git -urp --exclude-from=/tmp/excl315935 linux-2.6.22.base/kernel/sched.c linux-2.6.22/kernel/sched.c
> > --- linux-2.6.22.base/kernel/sched.c 2007-05-29 03:17:57.000000000 -0700
> > +++ linux-2.6.22/kernel/sched.c 2007-05-29 03:24:14.000000000 -0700
> > @@ -53,6 +53,7 @@
> > #include <linux/kprobes.h>
> > #include <linux/delayacct.h>
> > #include <linux/reciprocal_div.h>
> > +#include <linux/perfmon.h>
>
> perfmon.h isn't included in this patch so the inclusion of it here is a
> mystery but I suspect it's for pfm_ctxsw() later.
>
Yes most likely.

thanks for your feedback.

--

-Stephane