2.6.19-rc6-git10 new perfmon code base + libpfm + pfmon
Hello,
I have released another version of the perfmon new code base package. This version of the kernel patch is relative to 2.6.19-rc6-git10.
This is a major update because it completes the changes requested during the code review on LKML. As a consequence, the kernel interface is NOT backward compatible with previous v2.2 versions. This release has the v2.3 version number. Backward compatibility with v2.0 is maintained on Itanium processors.
The kernel patch is split between infrastructure work and perfmon2 proper. The infrastructure contains the following changes which will be integrated into mainline before perfmon2 is. Those changes should appear in 2.6.20. They are provided in the base.diff file.
The infrastructure changes include:
- x86_64: fix idle_notifier to cover all interrupts entry/exit for idle thread
- i386 : add idle notifier (copy of x86_64 notifier)
- ia64 : idle notifier (copy of x86_64 notifier)
- i386 : add X86_FEATURE_ceforge.net, [email protected],X86_FEATURE_PEBS to cpufeature.h
- x86_64: add X86_FEATURE_BTS,X86_FEATURE_PEBS to cpufeature.h
- i386 : add PMU related MSR definitions to msr.h
- x86_64: NMI watchdog uses PERFCTR1 to allow PEBS on Intel Core (requires PERFCTR0)
- all : remove unused carta_random32.h
The perfmon2 kernel changes the release to v2.3 and includes the following changes:
- updated to 2.6.19-rc6-git10
- sampling format identified with clear text string, not UUID anymore
- pfm_create_context() returns file descriptor
- sampling format name passed as argument
- struct pfarg_ctx_t simplified
- using random32() instead of carta_random32() (now obsolete)
- in struct pfarg_pmd, reg_random_seed is obsolete
- added support for Intel Core processors (Core 2 Duo)
- unified PEBS support between P4 and Intel Core
- fix bugs with munmap() of sampling buffer
- changed sysfs to handle new naming for sampling formats
- change rsvd_mask logic in PMU description modules
- make idle notifier registration lazy (only when needed)
- rewritten NMI integration using die_notifier()
- NMI watchdog support and auto-detection for AMD K8, Intel Core
- fix potential issues with locking/irq masking using LockDep checker
- cleaned MIPS PMU description table setup
- various MIPS bugs fixes (Phil Mucci, Manoj Ekbote)
- various PowerPC updates include PPC32 description table (Phil Mucci)
Due to problems with the git10 tree, the MIPS kernel does not compile regardless of perfmon2. A new patch will be generated once this problem is removed.
I have also released a new libpfm, libpfm-3.2-061127, with lots of changes. Here are some of the most important ones:
- added support for Intel Core (Core 2 Duo)
- updated all example, header files to perfmon v2.3
- updated man pages
- Intel Core PEBS example
- fixed rtop on 32-bit platforms
- various MIPS updates (Phil Mucci)
- big-endian support for MIPS
- various Makefile improvements
Also a new version of pfmon, pfmon-3.2-061127, with a lot
of changes as well:
- updated to perfmon v2.3 interface
- support for Intel Core processors (Core 2 Duo)
- support for Intel Core PEBS as a sampling format
- complete rewrite of system-wide core loops to avoid race conditions with signals
- added --print-interval to print intermediate deltas in system-wide mode
- better handling of perfmon errors
- corrected Montecito checks for L2D_CANCEL events
- factorized 'detailed' sampling format for all arch
- inst-hist default formats for all arch
- corrected sampling buffer auto-sizing based on resource limit constraints
- updated online documentation
This version of pfmon requires libpfm-3.2-061127.
You can get a more detailed log of changes the the CVS tree.
You can grab the new packages at our web site:
http://perfmon2.sf.net
Enjoy,
PS: I will post a kernel patch to LKML and a diffstat on the perfmon mailing list.
Signature · 1 line
-Stephane
Quoted 9 lines · Stephane Eranian
Hello,
I have released another version of the perfmon new code base package. This version of the kernel patch is relative to 2.6.19-rc6-git10.
This is a major update because it completes the changes requested during the code review on LKML. As a consequence, the kernel interface is NOT backward compatible with previous v2.2 versions. This release has
the v2.3 version number. Backward compatibility with v2.0 is maintained
on Itanium processors.
Hi Stephane,
I have built the kernel with the new patches and tried things out on x86_64 an x88_64 machine with Fedora Core 4. I attempted use the new libpfm and pfmon to update the source RPMs and I noticed that there were some return values from read() and write() being ignored. When pfmon is being built as an RPM ignoring the read and write return values cause the rpmbuild to fail. Attached is a simple patch that stuffs the return values into dummy variable to avoid the warnings. This patch allows libpfm and pfmon the source RPMs to compile on FC4 and Fedora Core rawhide.
-Will
pfmon/pfmon_util.c renamed from pfmon/pfmon_util.c.fortify +3 -2
@@ -1031,6 +1031,7 @@int fd;size_t max, used;char number[32 ]; +ssize_t dummy;if (options.opt_is22 ==0 )return (size_t )-1 ;
@@ -1042,7 +1043,7 @@if (fd ==-1 )return (size_t )-1 ;memset (number,0 ,sizeof (number)); -read (fd, number,sizeof (number)); + dummy =read (fd, number,sizeof (number));close (fd);
@@ -1055,7 +1056,7 @@if (fd ==-1 )return (size_t )-1 ;memset (number,0 ,sizeof (number)); -read (fd, number,sizeof (number)); + dummy =read (fd, number,sizeof (number));close (fd); max =strtoul (number,NULL ,0 );
pfmon/pfmon_task.c renamed from pfmon/pfmon_task.c.fortify +2 -1
@@ -1675,6 +1675,7 @@int ctrl_fd;int max_fd;int ndesc, msg_type; +ssize_t dummy;/* * POSIX threads:
@@ -1811,7 +1812,7 @@/* * ack the removal */ -write (workers[mycpu].from_worker[1 ], &msg,sizeof (msg)); + dummy =write (workers[mycpu].from_worker[1 ], &msg,sizeof (msg));break ;case PFMON_TASK_MSG_QUIT :
Hi folks,
Linux-MIPS users will need the following patch to add the 'cpu' directories to sysfs.
Phil
Quoted 81 lines · Stephane Eranian
Hello,
I have released another version of the perfmon new code base package. This version of the kernel patch is relative to 2.6.19-rc6-git10.
This is a major update because it completes the changes requested during the code review on LKML. As a consequence, the kernel interface is NOT backward compatible with previous v2.2 versions. This release has the v2.3 version number. Backward compatibility with v2.0 is maintained on Itanium processors.
The kernel patch is split between infrastructure work and perfmon2 proper. The infrastructure contains the following changes which will be integrated into mainline before perfmon2 is. Those changes should appear in 2.6.20. They are provided in the base.diff file.
The infrastructure changes include:
-x86_64: fixidle_notifierto cover all interrupts entry/exit for idle thread
- i386 : add idle notifier (copy ofx86_64notifier)
- ia64 : idle notifier (copy ofx86_64notifier)
- i386 : add X86_FEATURE_ceforge.net, [email protected],X86_FEATURE_PEBS tocpufeature.h
-x86_64: add X86_FEATURE_BTS,X86_FEATURE_PEBS tocpufeature.h
- i386 : add PMU related MSR definitions tomsr.h
-x86_64: NMI watchdog uses PERFCTR1 to allow PEBS on Intel Core (requires PERFCTR0)
- all : remove unusedcarta_random32.hThe perfmon2 kernel changes the release to v2.3 and includes the following changes:
- updated to 2.6.19-rc6-git10
- sampling format identified with clear text string, not UUID anymore
-pfm_create_context()returns file descriptor
- sampling format name passed as argument
- structpfarg_ctx_tsimplified
- usingrandom32()instead ofcarta_random32()(now obsolete)
- in structpfarg_pmd,reg_random_seedis obsolete
- added support for Intel Core processors (Core 2 Duo)
- unified PEBS support between P4 and Intel Core
- fix bugs withmunmap()of sampling buffer
- changed sysfs to handle new naming for sampling formats
- changersvd_masklogic in PMU description modules
- make idle notifier registration lazy (only when needed)
- rewritten NMI integration usingdie_notifier()
- NMI watchdog support and auto-detection for AMD K8, Intel Core
- fix potential issues with locking/irq masking using LockDep checker
- cleaned MIPS PMU description table setup
- various MIPS bugs fixes (Phil Mucci, Manoj Ekbote)
- various PowerPC updates include PPC32 description table (Phil Mucci)Due to problems with the git10 tree, the MIPS kernel does not compile regardless of perfmon2. A new patch will be generated once this problem is removed.
I have also released a new libpfm, libpfm-3.2-061127, with lots of changes. Here are some of the most important ones:
- added support for Intel Core (Core 2 Duo)
- updated all example, header files to perfmon v2.3
- updated man pages
- Intel Core PEBS example
- fixed rtop on 32-bit platforms
- various MIPS updates (Phil Mucci)
- big-endian support for MIPS
- variousMakefileimprovementsAlso a new version of pfmon, pfmon-3.2-061127, with a lot
of changes as well:
- updated to perfmon v2.3 interface
- support for Intel Core processors (Core 2 Duo)
- support for Intel Core PEBS as a sampling format
- complete rewrite of system-wide core loops to avoid race conditions with signals
- added --print-interval to print intermediate deltas in system-wide mode
- better handling of perfmon errors
- corrected Montecito checks forL2D_CANCELevents
- factorized 'detailed' sampling format for all arch
- inst-hist default formats for all arch
- corrected sampling buffer auto-sizing based on resource limit constraints
- updated online documentationThis version of pfmon requires libpfm-3.2-061127.
You can get a more detailed log of changes the the CVS tree.
Quoted 20 lines
You can grab the new packages at our web site:
http://perfmon2.sf.netEnjoy,
PS: I will post a kernel patch to LKML and a diffstat on the perfmon mailing list.
Signature · 11 lines
-Stephane ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Perfctr-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/perfctr-devel
perfmon_sysfs.c +17 -0
@@ -79,6 +79,10 @@static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj; +/* Remove this after mips get topology.c files */ + +struct cpu sysfs_cpus[NR_CPUS ]; +static void pfm_reset_stats (int cpu) {struct pfm_stats *st;
@@ -400,6 +404,19 @@int done_kobj_fmt =0 , done_kobj_kernel =0 ;int i, cpu =-1 ; +/* This is a hack to be removed */ + +for_each_present_cpu (i) { + ret =register_cpu (&sysfs_cpus[i],i,NULL ); +if (ret) + { +PFM_INFO ("cannot register cpu %d: %d\n" ,i,ret); + goto error; + } + } + +/* End hack */ + ret =subsystem_register (&pfm_fmt_subsys);if (ret) {PFM_INFO ("cannot register pfm_fmt_subsys: %d" , ret);
Quoted 2 lines · Philip J. Mucci
Linux-MIPS users will need the following patch to add the 'cpu' directories to sysfs.
This patch is to some file which doesn't even exist in standard kernels. Nor should it be done in the perfmon code if it did exist in the stock kernel.
perfmon_sysfs.c line 82
Quoted 9 lines
Index:
perfmon/perfmon_sysfs.c
===================================================================perfmon_sysfs.c +1
-0@@ -79,6 +79,10 @@static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj; +/* Remove this after mips get topology.c files */
Why should there be one? I guess you were looking for topology_init which exists since Febuary 20 / linux-2.6.16-rc5 and does register all CPUs.
Quoted 11 lines
perfmon_sysfs.c +4
-0+struct cpu sysfs_cpus[NR_CPUS ]; +static void pfm_reset_stats (int cpu) {struct pfm_stats *st;@@ -400,6 +404,19 @@int done_kobj_fmt =0 , done_kobj_kernel =0 ;int i, cpu =-1 ; +/* This is a hack to be removed */ +
perfmon_sysfs.c line 418
Quoted 10 lines
perfmon_sysfs.c +10
-0+for_each_present_cpu (i) { + ret =register_cpu (&sysfs_cpus[i],i,NULL ); +if (ret) + { +PFM_INFO ("cannot register cpu %d: %d\n" ,i,ret); + goto error; + } + } + +/* End hack */
Formatting style, see Documentation/CodingStyle.
Ralf
Hi Ralf,
Forgive me, I thought Stefane had posted the announcement of the new perfmon kernel substrate on Linux/MIPS list. I see now that he did not, so it's likely that the below patch has little meaning to you folks. I do know however, that there are some broadcom folks tracking this work.
This is not meant to be a patch for the Linux/MIPS tree, but rather the perfmon2 patch when applied to Linus' latest GIT tree. This hack (marked as such) gets around a NULL pointer dereference upon boot. I make no claims other than that it lets the MIPS folks play with the perfmon2 implementation.
Phil
Quoted 48 lines · Ralf Baechle
Quoted 2 lines · Philip J. Mucci
Linux-MIPS users will need the following patch to add the 'cpu' directories to sysfs.
This patch is to some file which doesn't even exist in standard kernels. Nor should it be done in the perfmon code if it did exist in the stock kernel.
perfmon_sysfs.c line 82
Quoted 9 lines
Index:
perfmon/perfmon_sysfs.c
===================================================================perfmon_sysfs.c +1
-0@@ -79,6 +79,10 @@static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj; +/* Remove this after mips get topology.c files */ Why should there be one? I guess you were looking for
topology_initwhich exists since Febuary 20 / linux-2.6.16-rc5 and does register all CPUs.Quoted 11 lines
perfmon_sysfs.c +4
-0+struct cpu sysfs_cpus[NR_CPUS ]; +static void pfm_reset_stats (int cpu) {struct pfm_stats *st;@@ -400,6 +404,19 @@int done_kobj_fmt =0 , done_kobj_kernel =0 ;int i, cpu =-1 ; +/* This is a hack to be removed */ +perfmon_sysfs.c line 418
Quoted 10 lines
perfmon_sysfs.c +10
-0+for_each_present_cpu (i) { + ret =register_cpu (&sysfs_cpus[i],i,NULL ); +if (ret) + { +PFM_INFO ("cannot register cpu %d: %d\n" ,i,ret); + goto error; + } + } + +/* End hack */ Formatting style, see
Documentation/CodingStyle.Ralf
Quoted 10 lines · Philip J. Mucci
Forgive me, I thought Stefane had posted the announcement of the new perfmon kernel substrate on Linux/MIPS list. I see now that he did not, so it's likely that the below patch has little meaning to you folks. I do know however, that there are some broadcom folks tracking this work.
This is not meant to be a patch for the Linux/MIPS tree, but rather the perfmon2 patch when applied to Linus' latest GIT tree. This hack (marked as such) gets around a NULL pointer dereference upon boot. I make no claims other than that it lets the MIPS folks play with the perfmon2 implementation.
So following our private mail exchange I've checked in below fix.
Ralf
commit 83eee867cf914c968933e8bc3acf7a3fe58ceaed
Author: Ralf Baechle <[email protected]> Date: Wed Nov 29 15:04:08 2006 +0000
[MIPS] Do topology_init even on uniprocessor kernels.
Otherwise CPU 0 doesn't show up in sysfs which breaks some software.
arch/mips/kernel/Makefile +1 -1
@@ -6,7 +6,7 @@ extra-y := head.o init_task.o vmlinux.l obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \ - time.o traps.o unaligned.o + time.o topology.o traps.o unaligned.o binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ irix5sys.o sysirix.o
arch/mips/kernel/smp.c +0 -23
@@ -463,28 +463,5 @@ void flush_tlb_one(unsigned long vaddr)smp_on_each_tlb (flush_tlb_one_ipi, (void *) vaddr); } -static DEFINE_PER_CPU(struct cpu, cpu_devices); - -static int __init topology_init (void ) -{ -int i, ret; - -#ifdef CONFIG_NUMA -for_each_online_node (i) -register_one_node (i); -#endif /* CONFIG_NUMA */ - -for_each_present_cpu (i) { - ret =register_cpu (&per_cpu (cpu_devices, i), i); -if (ret) -printk (KERN_WARNING "topology_init: register_cpu %d " -"failed (%d)\n" , i, ret); - } - -return 0 ; -} - -subsys_initcall (topology_init); -EXPORT_SYMBOL (flush_tlb_page);EXPORT_SYMBOL (flush_tlb_one);
arch/mips/kernel/topology.c new file +29 -0
@@ -0,0 +1,29 @@ +#include <linux/cpu.h> +#include <linux/cpumask.h> +#include <linux/init.h> +#include <linux/node.h> +#include <linux/nodemask.h> +#include <linux/percpu.h> + +static DEFINE_PER_CPU(struct cpu, cpu_devices); + +static int __init topology_init (void ) +{ +int i, ret; + +#ifdef CONFIG_NUMA +for_each_online_node (i) +register_one_node (i); +#endif /* CONFIG_NUMA */ + +for_each_present_cpu (i) { + ret =register_cpu (&per_cpu (cpu_devices, i), i); +if (ret) +printk (KERN_WARNING "topology_init: register_cpu %d " +"failed (%d)\n" , i, ret); + } + +return 0 ; +} + +subsys_initcall (topology_init);