* 2.6.15-rc5-git3 perfmon2 new code base + libpfm available @ 2005-12-15 10:46 Stephane Eranian 2005-12-15 21:22 ` [Perfctr-devel] " William Cohen 2005-12-20 18:07 ` 2.6.15-rc6 updated perfmon2 patch Stephane Eranian 0 siblings, 2 replies; 9+ messages in thread From: Stephane Eranian @ 2005-12-15 10:46 UTC (permalink / raw) To: perfctr-devel; +Cc: perfmon, linux-ia64, linux-kernel Hello, I have released a new version of the perfmon base package. This release is relative to 2.6.15-rc5-git3. I have also updated the library, libpfm-3.2, to match the kernel level changes. This new kernel patch includes several important changes: - pfm_create_context() interface has changed. The sampling buffer format argument is now passed explicitly instead of relying on it being contiguous to pfarg_ctx_t. - code in perfmon/perfmon.c has been split into 8 different files for improved maintainability. Each file implements one specific function. Perfmon.c remains the core. - fixed several important bugs for i386 and x86_64 for Intel P4/Xeon (simple counting was returning 0). - added support for virtual PMD (read/write) - added notion of read-only PMD - Split Pentium M/P 6 PMU description in preparation for Pentium M LBR support - Added support for reference counting on PMU description and Sampling buffer modules to avoid panic in case module is removed while being used. - On i386/X86_64, added code to handle the NMI watchdog when it is using the Local APIC. We now use reserve_lapic_nmi() and release_lapic_nmi(). - various other cleanups and bug fixes You MUST use libpfm-3.2-051215 with this kernel due to interface change for pfm_create_context(). As usual, you can download the latest packages from the SourceForge website at: http://www.sf.net/projects/perfmon2 I will be posting the patches directly to LKML for review very shortly. Enjoy, -- -Stephane ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-15 10:46 2.6.15-rc5-git3 perfmon2 new code base + libpfm available Stephane Eranian @ 2005-12-15 21:22 ` William Cohen 2005-12-15 21:59 ` Stephane Eranian 2005-12-20 18:07 ` 2.6.15-rc6 updated perfmon2 patch Stephane Eranian 1 sibling, 1 reply; 9+ messages in thread From: William Cohen @ 2005-12-15 21:22 UTC (permalink / raw) To: eranian; +Cc: perfctr-devel, perfmon, linux-ia64, linux-kernel Stephane Eranian wrote: > Hello, > > I have released a new version of the perfmon base package. > This release is relative to 2.6.15-rc5-git3. > > I have also updated the library, libpfm-3.2, to match the kernel > level changes. Hi Stephane, I downloaded the new version of perfmon and the matching libpfm. I built everything on a p6 based machine. The kernel booted fine. I tried the task_smpl_user in the libpfm examples. That crashed the kernel. What was on the xterm: $ ./task_smpl_user ls measuring at plm=0x8 programming 2 PMCS and 2 PMDS Segmentation fault The related oops /var/log/messages: Dec 15 15:54:40 trek kernel: Unable to handle kernel paging request at virtual address 6b6b6ba7 Dec 15 15:54:40 trek kernel: printing eip: Dec 15 15:54:40 trek kernel: c0202b51 Dec 15 15:54:40 trek kernel: *pde = 6b6b6b6b Dec 15 15:54:40 trek kernel: Oops: 0000 [#1] Dec 15 15:54:40 trek kernel: SMP Dec 15 15:54:40 trek kernel: Modules linked in: ipv6 lp autofs4 rfcomm l2cap bluetooth sunrpc ipt_REJECT ipt_state ip_conntrack nfnetlink iptable_filter ip_tables dm_mirror dm_mod video button battery ac parport_pc parport snd_emu10k1_synth snd_emux_synth snd_seq_virmidi snd_cs46xx snd_seq_midi_emul snd_seq_dummy snd_seq_oss snd_emu10k1 snd_seq_midi_event snd_seq snd_rawmidi snd_seq_device snd_pcm_oss snd_ac97_codec snd_mixer_oss snd_ac97_bus snd_pcm snd_util_mem floppy snd_hwdep snd_timer emu10k1_gp snd gameport soundcore snd_page_alloc 3c59x mii i2c_i801 hw_random uhci_hcd shpchp i2c_core ext3 jbd Dec 15 15:54:40 trek kernel: CPU: 0 Dec 15 15:54:40 trek kernel: EIP: 0060:[<c0202b51>] Not tainted VLI Dec 15 15:54:40 trek kernel: EFLAGS: 00010286 (2.6.15-rc5-git3-perfop) Dec 15 15:54:40 trek kernel: EIP is at pfm_smpl_fmt_put+0x11/0x60 Dec 15 15:54:40 trek kernel: eax: d6ee6ab0 ebx: 6b6b6b6b ecx: 00000000 edx: 00000cf4 Dec 15 15:54:40 trek kernel: esi: cf9f2000 edi: 00000000 ebp: 00000000 esp: cfc1ff00 Dec 15 15:54:40 trek kernel: ds: 007b es: 007b ss: 0068 Dec 15 15:54:40 trek kernel: Process task_smpl_user (pid: 2654, threadinfo=cfc1f000 task=d6ee6ab0) Dec 15 15:54:40 trek kernel: Stack: ffffffda c0201ee7 00000000 c010400c d6ee6ab0 d6dea570 d6dea740 00000000 Dec 15 15:54:40 trek kernel: d7010a34 00802140 00000000 00000000 00000000 cfc1ff68 d2d5b9a4 00000000 Dec 15 15:54:40 trek kernel: 0000003c 00000000 cfc1f000 00000000 cfc1ff68 00000000 cfc1f000 c0203f98 Dec 15 15:54:40 trek kernel: Call Trace: Dec 15 15:54:40 trek kernel: [<c0201ee7>] __pfm_create_context+0x167/0x440 Dec 15 15:54:40 trek kernel: [<c010400c>] __switch_to+0x15c/0x220 Dec 15 15:54:40 trek kernel: [<c0203f98>] sys_pfm_create_context+0x78/0xe0 Dec 15 15:54:40 trek kernel: [<c010569d>] syscall_call+0x7/0xb Dec 15 15:54:40 trek kernel: Code: 00 01 00 00 ff 00 b8 80 4c 44 c0 e8 9a d2 16 00 89 d8 5b c3 31 db eb ee 89 f6 85 c0 53 89 c3 74 39 b8 80 4c 44 c0 e8 5f d2 16 00 <8b> 53 3c 85 d2 74 1b b8 00 f0 ff ff 21 e0 8b 40 10 c1 e0 07 8d -Will ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-15 21:22 ` [Perfctr-devel] " William Cohen @ 2005-12-15 21:59 ` Stephane Eranian 2005-12-15 22:23 ` William Cohen 0 siblings, 1 reply; 9+ messages in thread From: Stephane Eranian @ 2005-12-15 21:59 UTC (permalink / raw) To: William Cohen; +Cc: perfctr-devel, perfmon, linux-ia64, linux-kernel Will, On Thu, Dec 15, 2005 at 04:22:28PM -0500, William Cohen wrote: > Stephane Eranian wrote: > >I have released a new version of the perfmon base package. > >This release is relative to 2.6.15-rc5-git3. > > > >I have also updated the library, libpfm-3.2, to match the kernel > >level changes. > > I downloaded the new version of perfmon and the matching libpfm. I built > everything on a p6 based machine. The kernel booted fine. I tried the > task_smpl_user in the libpfm examples. That crashed the kernel. What was > on the xterm: > > $ ./task_smpl_user ls > measuring at plm=0x8 > programming 2 PMCS and 2 PMDS > Segmentation fault > I have not tried this particular test program in a long time. I nfact, I would like to remove it from the suite because it does not make any real sense. In any case, it should not crash the kernel. I will investigate this. I don't think it it related to you using a P6. This is more the case of an error in the cleanup code in case the context cannot be created properly. Does task_smpl work properly? > snd_hwdep snd_timer emu10k1_gp snd gameport soundcore snd_page_alloc > Dec 15 15:54:40 trek kernel: EIP is at pfm_smpl_fmt_put+0x11/0x60 > Dec 15 15:54:40 trek kernel: Call Trace: > Dec 15 15:54:40 trek kernel: [<c0201ee7>] __pfm_create_context+0x167/0x440 > Dec 15 15:54:40 trek kernel: [<c010400c>] __switch_to+0x15c/0x220 > Dec 15 15:54:40 trek kernel: [<c0203f98>] sys_pfm_create_context+0x78/0xe0 > Dec 15 15:54:40 trek kernel: [<c010569d>] syscall_call+0x7/0xb Thanks. -- -Stephane ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-15 21:59 ` Stephane Eranian @ 2005-12-15 22:23 ` William Cohen 2005-12-15 23:15 ` Stephane Eranian 0 siblings, 1 reply; 9+ messages in thread From: William Cohen @ 2005-12-15 22:23 UTC (permalink / raw) To: eranian; +Cc: William Cohen, perfctr-devel, perfmon, linux-ia64, linux-kernel Stephane Eranian wrote: > Will, > > > On Thu, Dec 15, 2005 at 04:22:28PM -0500, William Cohen wrote: > >>Stephane Eranian wrote: > > >>>I have released a new version of the perfmon base package. >>>This release is relative to 2.6.15-rc5-git3. >>> >>>I have also updated the library, libpfm-3.2, to match the kernel >>>level changes. >> >>I downloaded the new version of perfmon and the matching libpfm. I built >>everything on a p6 based machine. The kernel booted fine. I tried the >>task_smpl_user in the libpfm examples. That crashed the kernel. What was >>on the xterm: >> >>$ ./task_smpl_user ls >>measuring at plm=0x8 >>programming 2 PMCS and 2 PMDS >>Segmentation fault >> > > I have not tried this particular test program in a long time. I nfact, I would > like to remove it from the suite because it does not make any real sense. > In any case, it should not crash the kernel. I will investigate this. > I don't think it it related to you using a P6. This is more the case of > an error in the cleanup code in case the context cannot be created properly. If it just seg faulted the user space program I wouldn't care either, but when it crashed the kernel I thought that you might like to know about that. > Does task_smpl work properly? task_smpl gave data, but appeared to get a kernel oops. Output from xterm: $ ./task_smpl ls smpl_pmd_mask=0x3 programming 2 PMCS and 2 PMDS context [3] buffer mapped @0xb7f8f000 hdr_cur_offs=112 version=1.0 ia32 self task ia64 self2 task_attach Makefile self2.c task_attach.c multiplex self2.o task_attach.o multiplex2 self.c task_attach_timeout multiplex2.c self.o task_attach_timeout.c multiplex2.o self_standalone task_attach_timeout.o multiplex.c self_standalone.c task.c multiplex.o self_standalone.o task.o notify_self self_view task_smpl notify_self2 self_view.c task_smpl.c notify_self2.c self_view.o task_smpl.o notify_self2.o set_notify task_smpl_user notify_self3 set_notify.c task_smpl_user.c notify_self3.c set_notify.o task_smpl_user.o notify_self3.o showreginfo task_view notify_self.c showreginfo.c task_view.c notify_self.o showreginfo.o task_view.o notify_standalone smpl_standalone whichpmu notify_standalone.c smpl_standalone.c whichpmu.c notify_standalone.o smpl_standalone.o whichpmu.o rtop syst x86_64 rtop.c syst.c rtop.o syst.o task terminated entry 0 PID:2800 TID:2800 CPU:0 LAST_VAL: 100000 IIP:0x00000000c0105678 PMD1 = 0x0000000000003caa entry 1 PID:2800 TID:2800 CPU:0 LAST_VAL: 100005 IIP:0x00000000003e94c2 PMD1 = 0x00000000000098a0 entry 2 PID:2800 TID:2800 CPU:0 LAST_VAL: 100067 IIP:0x000000000055093b PMD1 = 0x00000000000088dc entry 3 PID:2800 TID:2800 CPU:0 LAST_VAL: 100181 IIP:0x00000000004f7dd6 PMD1 = 0x0000000000006448 entry 4 PID:2800 TID:2800 CPU:0 LAST_VAL: 100020 IIP:0x000000000045ad51 PMD1 = 0x0000000000006281 entry 5 PID:2800 TID:2800 CPU:0 LAST_VAL: 100012 IIP:0x000000000040f490 PMD1 = 0x0000000000007e34 entry 6 PID:2800 TID:2800 CPU:0 LAST_VAL: 100212 IIP:0x00000000003e60d3 PMD1 = 0x0000000000005fd0 entry 7 PID:2800 TID:2800 CPU:0 LAST_VAL: 100076 IIP:0x00000000003ea871 PMD1 = 0x00000000000078c2 entry 8 PID:2800 TID:2800 CPU:0 LAST_VAL: 100149 IIP:0x0000000000424745 PMD1 = 0x00000000000064da entry 9 PID:2800 TID:2800 CPU:0 LAST_VAL: 100051 IIP:0x000000000045b465 PMD1 = 0x000000000000c0aa entry 10 PID:2800 TID:2800 CPU:0 LAST_VAL: 100070 IIP:0x000000000046677c PMD1 = 0x00000000000075ca entry 11 PID:2800 TID:2800 CPU:0 LAST_VAL: 100170 IIP:0x000000000046899e PMD1 = 0x0000000000014808 entry 12 PID:2800 TID:2800 CPU:0 LAST_VAL: 100230 IIP:0x000000000046637a PMD1 = 0x0000000000016b21 entry 13 PID:2800 TID:2800 CPU:0 LAST_VAL: 100011 IIP:0x00000000004682aa PMD1 = 0x00000000000185b6 entry 14 PID:2800 TID:2800 CPU:0 LAST_VAL: 100045 IIP:0x000000000804ddfb PMD1 = 0x0000000000016e3d entry 15 PID:2800 TID:2800 CPU:0 LAST_VAL: 100092 IIP:0x000000000804ddff PMD1 = 0x0000000000012b35 entry 16 PID:2800 TID:2800 CPU:0 LAST_VAL: 100005 IIP:0x000000000804d4cd PMD1 = 0x000000000001544f entry 17 PID:2800 TID:2800 CPU:0 LAST_VAL: 100067 IIP:0x000000000804c220 PMD1 = 0x000000000001761f 18 samples collected in 0 buffer overflows real 0h00m00.007s user 0h00m00.000s sys 1141h33m30.134513s Related information in /var/log/messages: Dec 15 17:13:00 trek kernel: perfmon_p6: family=6 x86_model=8 Dec 15 17:13:00 trek kernel: P6 core PMU detected Dec 15 17:13:00 trek kernel: perfmon: Intel P6 Family Processor PMU detected, 2 PMCs, 2 PMDs, 2 counters (31 bits) RW_max:2 Dec 15 17:13:00 trek kernel: Intel P6 Family Processor PMU installed Dec 15 17:13:22 trek kernel: Debug: sleeping function called from invalid context at arch/i386/lib/usercopy.c:607 Dec 15 17:13:22 trek kernel: in_atomic():0, irqs_disabled():1 Dec 15 17:13:22 trek kernel: [<c020e4e3>] copy_to_user+0x23/0x90 Dec 15 17:13:22 trek kernel: [<c0205129>] pfm_read+0xa9/0x320 Dec 15 17:13:22 trek kernel: [<c0121180>] default_wake_function+0x0/0x10 Dec 15 17:13:22 trek kernel: [<c0205080>] pfm_read+0x0/0x320 Dec 15 17:13:22 trek kernel: [<c01713e8>] vfs_read+0xb8/0x170 Dec 15 17:13:22 trek kernel: [<c0171771>] sys_read+0x41/0x70 Dec 15 17:13:22 trek kernel: [<c010569d>] syscall_call+0x7/0xb Dec 15 17:13:22 trek kernel: Unable to handle kernel paging request at virtual address 6b6b6ba7 Dec 15 17:13:22 trek kernel: printing eip: Dec 15 17:13:22 trek kernel: c0202b51 Dec 15 17:13:22 trek kernel: *pde = 00000000 Dec 15 17:13:22 trek kernel: Oops: 0000 [#1] Dec 15 17:13:22 trek kernel: SMP Dec 15 17:13:22 trek kernel: Modules linked in: perfmon_p6 ipv6 lp autofs4 rfcomm l2cap bluetooth sunrpc ipt_REJECT ipt_state ip_conntrack nfnetlink iptable_filter ip_tables dm_mirror dm_mod video button battery ac parport_pc parport snd_emu10k1_synth snd_emux_synth snd_seq_virmidi snd_seq_midi_emul snd_cs46xx snd_emu10k1 snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_rawmidi snd_seq_device snd_ac97_codec snd_pcm_oss snd_ac97_bus snd_mixer_oss snd_util_mem snd_pcm snd_hwdep snd_timer floppy emu10k1_gp snd snd_page_alloc soundcore gameport 3c59x mii i2c_i801 i2c_core hw_random uhci_hcd shpchp ext3 jbd Dec 15 17:13:22 trek kernel: CPU: 1 Dec 15 17:13:22 trek kernel: EIP: 0060:[<c0202b51>] Not tainted VLI Dec 15 17:13:22 trek kernel: EFLAGS: 00010282 (2.6.15-rc5-git3-perfop) Dec 15 17:13:22 trek kernel: EIP is at pfm_smpl_fmt_put+0x11/0x60 Dec 15 17:13:22 trek kernel: eax: d61afab0 ebx: 6b6b6b6b ecx: d8b3d7a0 edx: d8b3d900 Dec 15 17:13:22 trek kernel: esi: d1852000 edi: 00000001 ebp: 00000001 esp: d1f37ee0 Dec 15 17:13:22 trek kernel: ds: 007b es: 007b ss: 0068 Dec 15 17:13:22 trek kernel: Process task_smpl (pid: 2799, threadinfo=d1f37000 task=d61afab0) Dec 15 17:13:22 trek kernel: Stack: 00000001 c0205803 c0156569 6b000246 c13163a4 d1f935a0 d1f93614 d22ebb78 Dec 15 17:13:22 trek kernel: 00000286 00000000 00000010 00000010 d1f93614 d1f57d3c d22ebb78 c0172475 Dec 15 17:13:22 trek kernel: 00000000 d1f935a0 d7f8fb68 d1f57d3c d1e1011c d2789bcc d7e45dbc 00000001 Dec 15 17:13:22 trek kernel: Call Trace: Dec 15 17:13:22 trek kernel: [<c0205803>] pfm_close+0x113/0x3d0 Dec 15 17:13:22 trek kernel: [<c0156569>] poison_obj+0x29/0x60 Dec 15 17:13:22 trek kernel: [<c0172475>] __fput+0xb5/0x1a0 Dec 15 17:13:22 trek kernel: [<c01625e9>] remove_vma+0x39/0x50 Dec 15 17:13:22 trek kernel: [<c016477b>] exit_mmap+0xab/0x100 Dec 15 17:13:22 trek kernel: [<c0123423>] mmput+0x33/0xa0 Dec 15 17:13:22 trek kernel: [<c0128816>] do_exit+0xf6/0x3d0 Dec 15 17:13:22 trek kernel: [<c0109da8>] do_syscall_trace+0x218/0x22a Dec 15 17:13:22 trek kernel: [<c0128b67>] do_group_exit+0x37/0xa0 Dec 15 17:13:22 trek kernel: [<c010569d>] syscall_call+0x7/0xb Dec 15 17:13:22 trek kernel: Code: 00 01 00 00 ff 00 b8 80 4c 44 c0 e8 9a d2 16 00 89 d8 5b c3 31 db eb ee 89 f6 85 c0 53 89 c3 74 39 b8 80 4c 44 c0 e8 5f d2 16 00 <8b> 53 3c 85 d2 74 1b b8 00 f0 ff ff 21 e0 8b 40 10 c1 e0 07 8d -Will ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-15 22:23 ` William Cohen @ 2005-12-15 23:15 ` Stephane Eranian 2005-12-20 16:05 ` William Cohen 0 siblings, 1 reply; 9+ messages in thread From: Stephane Eranian @ 2005-12-15 23:15 UTC (permalink / raw) To: William Cohen Cc: William Cohen, perfctr-devel, perfmon, linux-ia64, linux-kernel [-- Attachment #1: Type: text/plain, Size: 4039 bytes --] Will, Ok, I found the two bugs you ran into. I also found a third one somewhat similar. Could you try the attached patch on top of what you have? I will check all the copy_from/to() tomorrow. Thanks. On Thu, Dec 15, 2005 at 05:23:27PM -0500, William Cohen wrote: > >>>I have released a new version of the perfmon base package. > >>>This release is relative to 2.6.15-rc5-git3. > >>> > >>>I have also updated the library, libpfm-3.2, to match the kernel > >>>level changes. > >> > >>I downloaded the new version of perfmon and the matching libpfm. I built > >>everything on a p6 based machine. The kernel booted fine. I tried the > >>task_smpl_user in the libpfm examples. That crashed the kernel. What was > >>on the xterm: > >> > >>$ ./task_smpl_user ls > >>measuring at plm=0x8 > >>programming 2 PMCS and 2 PMDS > >>Segmentation fault > >> > > > >I have not tried this particular test program in a long time. I nfact, I > >would > >like to remove it from the suite because it does not make any real sense. > >In any case, it should not crash the kernel. I will investigate this. > >I don't think it it related to you using a P6. This is more the case of > >an error in the cleanup code in case the context cannot be created > >properly. > > If it just seg faulted the user space program I wouldn't care either, > but when it crashed the kernel I thought that you might like to know > about that. > > >Does task_smpl work properly? > > task_smpl gave data, but appeared to get a kernel oops. Output from xterm: > > Dec 15 17:13:00 trek kernel: perfmon_p6: family=6 x86_model=8 > Dec 15 17:13:00 trek kernel: P6 core PMU detected > Dec 15 17:13:00 trek kernel: perfmon: Intel P6 Family Processor PMU > detected, 2 PMCs, 2 PMDs, 2 counters (31 bits) RW_max:2 > Dec 15 17:13:00 trek kernel: Intel P6 Family Processor PMU installed > Dec 15 17:13:22 trek kernel: Debug: sleeping function called from > invalid context at arch/i386/lib/usercopy.c:607 > Dec 15 17:13:22 trek kernel: in_atomic():0, irqs_disabled():1 > Dec 15 17:13:22 trek kernel: [<c020e4e3>] copy_to_user+0x23/0x90 > Dec 15 17:13:22 trek kernel: [<c0205129>] pfm_read+0xa9/0x320 > Dec 15 17:13:22 trek kernel: [<c0121180>] default_wake_function+0x0/0x10 > Dec 15 17:13:22 trek kernel: [<c0205080>] pfm_read+0x0/0x320 > Dec 15 17:13:22 trek kernel: [<c01713e8>] vfs_read+0xb8/0x170 > Dec 15 17:13:22 trek kernel: [<c0171771>] sys_read+0x41/0x70 > Dec 15 17:13:22 trek kernel: [<c010569d>] syscall_call+0x7/0xb > Dec 15 17:13:22 trek kernel: Unable to handle kernel paging request at > > Dec 15 17:13:22 trek kernel: EIP is at pfm_smpl_fmt_put+0x11/0x60 > Dec 15 17:13:22 trek kernel: eax: d61afab0 ebx: 6b6b6b6b ecx: > d8b3d7a0 edx: d8b3d900 > Dec 15 17:13:22 trek kernel: esi: d1852000 edi: 00000001 ebp: > 00000001 esp: d1f37ee0 > Dec 15 17:13:22 trek kernel: ds: 007b es: 007b ss: 0068 > Dec 15 17:13:22 trek kernel: Process task_smpl (pid: 2799, > threadinfo=d1f37000 task=d61afab0) > Dec 15 17:13:22 trek kernel: Stack: 00000001 c0205803 c0156569 6b000246 > c13163a4 d1f935a0 d1f93614 d22ebb78 > Dec 15 17:13:22 trek kernel: 00000286 00000000 00000010 00000010 > d1f93614 d1f57d3c d22ebb78 c0172475 > Dec 15 17:13:22 trek kernel: 00000000 d1f935a0 d7f8fb68 d1f57d3c > d1e1011c d2789bcc d7e45dbc 00000001 > Dec 15 17:13:22 trek kernel: Call Trace: > Dec 15 17:13:22 trek kernel: [<c0205803>] pfm_close+0x113/0x3d0 > Dec 15 17:13:22 trek kernel: [<c0156569>] poison_obj+0x29/0x60 > Dec 15 17:13:22 trek kernel: [<c0172475>] __fput+0xb5/0x1a0 > Dec 15 17:13:22 trek kernel: [<c01625e9>] remove_vma+0x39/0x50 > Dec 15 17:13:22 trek kernel: [<c016477b>] exit_mmap+0xab/0x100 > Dec 15 17:13:22 trek kernel: [<c0123423>] mmput+0x33/0xa0 > Dec 15 17:13:22 trek kernel: [<c0128816>] do_exit+0xf6/0x3d0 > Dec 15 17:13:22 trek kernel: [<c0109da8>] do_syscall_trace+0x218/0x22a > Dec 15 17:13:22 trek kernel: [<c0128b67>] do_group_exit+0x37/0xa0 > Dec 15 17:13:22 trek kernel: [<c010569d>] syscall_call+0x7/0xb [-- Attachment #2: perfmon-2.6.15-rc5-git3-will.diff --] [-- Type: text/plain, Size: 2500 bytes --] diff -ur /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_file.c linux-2.6.15-rc5-git3/perfmon/perfmon_file.c --- /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_file.c 2005-12-15 15:10:36.000000000 -0800 +++ linux-2.6.15-rc5-git3/perfmon/perfmon_file.c 2005-12-15 15:06:54.000000000 -0800 @@ -247,7 +247,7 @@ loff_t *ppos) { struct pfm_context *ctx; - pfm_msg_t *msg; + pfm_msg_t *msg, msg_buf; ssize_t ret; unsigned long flags; DECLARE_WAITQUEUE(wait, current); @@ -274,6 +274,10 @@ if (size > sizeof(pfm_msg_t)) size = sizeof(pfm_msg_t); + /* + * we must masks interrupts to avoid a race condition + * with the PMU interrupt handler. + */ spin_lock_irqsave(&ctx->ctx_lock, flags); if(PFM_CTXQ_EMPTY(ctx) == 0) @@ -348,17 +352,27 @@ if (unlikely(msg == NULL)) goto retry; - DPRINT(("type=%d size=%zu\n", msg->type, size)); + /* + * we must make a local copy before we unlock + * to ensure that the message queue cannot fill + * (overwriting our message) up before + * we do copy_to_user() which cannot be done + * with interrupts masked. + */ + msg_buf = *msg; + DPRINT(("type=%d size=%zu\n", msg->type, size)); /* * message can be truncated when size < sizeof(pfm_msg_t) * The leftover is systematically lost */ - ret = -EFAULT; - if(copy_to_user(buf, msg, size) == 0) ret = size; abort_locked: spin_unlock_irqrestore(&ctx->ctx_lock, flags); + + ret = -EFAULT; + if(copy_to_user(buf, &msg_buf, size) == 0) + ret = size; abort: return ret; } diff -ur /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_fmt.c linux-2.6.15-rc5-git3/perfmon/perfmon_fmt.c --- /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_fmt.c 2005-12-15 15:10:36.000000000 -0800 +++ linux-2.6.15-rc5-git3/perfmon/perfmon_fmt.c 2005-12-15 15:04:38.000000000 -0800 @@ -67,7 +67,7 @@ if (fmt == NULL) return; spin_lock(&pfm_smpl_fmt_lock); - module_put(fmt->owner); + if (fmt->owner) module_put(fmt->owner); spin_unlock(&pfm_smpl_fmt_lock); } diff -ur /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_pmu.c linux-2.6.15-rc5-git3/perfmon/perfmon_pmu.c --- /tmp/linux-2.6.15-rc5-git3.orig/perfmon/perfmon_pmu.c 2005-12-15 15:10:36.000000000 -0800 +++ linux-2.6.15-rc5-git3/perfmon/perfmon_pmu.c 2005-12-15 15:06:34.000000000 -0800 @@ -286,7 +286,7 @@ if (pfm_pmu_conf == NULL) return; spin_lock(&pfm_pmu_conf_lock); - module_put(pfm_pmu_conf->owner); + if (pfm_pmu_conf->owner) module_put(pfm_pmu_conf->owner); spin_unlock(&pfm_pmu_conf_lock); } ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-15 23:15 ` Stephane Eranian @ 2005-12-20 16:05 ` William Cohen 2005-12-20 16:54 ` Matthew Wilcox 0 siblings, 1 reply; 9+ messages in thread From: William Cohen @ 2005-12-20 16:05 UTC (permalink / raw) To: eranian; +Cc: William Cohen, perfctr-devel, perfmon, linux-ia64, linux-kernel Stephane Eranian wrote: > Will, > > Ok, I found the two bugs you ran into. I also found > a third one somewhat similar. > > Could you try the attached patch on top of what > you have? > > I will check all the copy_from/to() tomorrow. > > Thanks. Have you tried running the examples without the kernel module installed? I think that one of the tracebacks in the earlier email was due to that. Like the following: Dec 20 10:39:01 trek kernel: Call Trace: Dec 20 10:39:01 trek kernel: [<c0201ee7>] __pfm_create_context+0x167/0x440 Dec 20 10:39:01 trek kernel: [<c010400c>] __switch_to+0x15c/0x220 Dec 20 10:39:01 trek kernel: [<c0203f98>] sys_pfm_create_context+0x78/0xe0 Dec 20 10:39:01 trek kernel: [<c010569d>] syscall_call+0x7/0xb I tried the patch. Things are still not working on the p6 machine with the module installed. for "./task_smpl ls". The associated kernel backtrace: Dec 20 10:29:47 trek kernel: Unable to handle kernel paging request at virtual address 6b6b6ba7 Dec 20 10:29:47 trek kernel: printing eip: Dec 20 10:29:47 trek kernel: c0202b51 Dec 20 10:29:47 trek kernel: *pde = 00000000 Dec 20 10:29:47 trek kernel: Oops: 0000 [#1] Dec 20 10:29:47 trek kernel: SMP Dec 20 10:29:47 trek kernel: Modules linked in: perfmon_p6 ipv6 lp autofs4 rfcomm l2cap bluetooth sunrpc ipt_REJECT ipt_state ip_conntrack nfnetlink iptable_filter ip_tables dm_mirror dm_mod video button battery ac parport_pc parport snd_cs46xx snd_seq_dummy snd_emu10k1_synth snd_emux_synth snd_seq_virmidi snd_seq_midi_emul snd_seq_oss snd_seq_midi_event snd_emu10k1 snd_seq snd_rawmidi snd_pcm_oss snd_seq_device snd_mixer_oss snd_ac97_codec snd_ac97_bus snd_pcm snd_util_mem emu10k1_gp floppy gameport 3c59x snd_hwdep snd_timer snd snd_page_alloc soundcore mii uhci_hcd hw_random i2c_i801 shpchp i2c_core ext3 jbd Dec 20 10:29:47 trek kernel: CPU: 1 Dec 20 10:29:47 trek kernel: EIP: 0060:[<c0202b51>] Not tainted VLI Dec 20 10:29:47 trek kernel: EFLAGS: 00010282 (2.6.15-rc5-git3-perfop) Dec 20 10:29:47 trek kernel: EIP is at pfm_smpl_fmt_put+0x11/0x60 Dec 20 10:29:47 trek kernel: eax: d6cc3ab0 ebx: 6b6b6b6b ecx: d8be87a0 edx: d8be8900 Dec 20 10:29:47 trek kernel: esi: d2434000 edi: 00000001 ebp: 00000001 esp: d707cee0 Dec 20 10:29:47 trek kernel: ds: 007b es: 007b ss: 0068 Dec 20 10:29:47 trek kernel: Process task_smpl (pid: 2574, threadinfo=d707c000 task=d6cc3ab0) Dec 20 10:29:47 trek kernel: Stack: 00000001 c0205813 c0156569 6b000246 c1336ae0 d2ab36e8 d2ab375c d7203548 Dec 20 10:29:47 trek kernel: 00000286 00000000 00000010 00000010 d2ab375c d2b8ab58 d7203548 c0172475 Dec 20 10:29:47 trek kernel: 00000000 d2ab36e8 d7f8fb68 d2b8ab58 d245dc7c d2f18664 d7276d9c 00000001 Dec 20 10:29:47 trek kernel: Call Trace: Dec 20 10:29:47 trek kernel: [<c0205813>] pfm_close+0x113/0x3d0 Dec 20 10:29:47 trek kernel: [<c0156569>] poison_obj+0x29/0x60 Dec 20 10:29:47 trek kernel: [<c0172475>] __fput+0xb5/0x1a0 Dec 20 10:29:47 trek kernel: [<c01625e9>] remove_vma+0x39/0x50 Dec 20 10:29:47 trek kernel: [<c016477b>] exit_mmap+0xab/0x100 Dec 20 10:29:47 trek kernel: [<c0123423>] mmput+0x33/0xa0 Dec 20 10:29:47 trek kernel: [<c0128816>] do_exit+0xf6/0x3d0 Dec 20 10:29:47 trek kernel: [<c0109da8>] do_syscall_trace+0x218/0x22a Dec 20 10:29:47 trek kernel: [<c0128b67>] do_group_exit+0x37/0xa0 Dec 20 10:29:47 trek kernel: [<c010569d>] syscall_call+0x7/0xb Dec 20 10:29:47 trek kernel: Code: 00 01 00 00 ff 00 b8 80 4c 44 c0 e8 aa d2 16 00 89 d8 5b c3 31 db eb ee 89 f6 85 c0 53 89 c3 74 39 b8 80 4c 44 c0 e8 6f d2 16 00 <8b> 53 3c 85 d2 74 1b b8 00 f0 ff ff 21 e0 8b 40 10 c1 e0 07 8d Dec 20 10:29:47 trek kernel: <1>Fixing recursive fault but reboot is needed! -Will ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Perfctr-devel] 2.6.15-rc5-git3 perfmon2 new code base + libpfm available 2005-12-20 16:05 ` William Cohen @ 2005-12-20 16:54 ` Matthew Wilcox 0 siblings, 0 replies; 9+ messages in thread From: Matthew Wilcox @ 2005-12-20 16:54 UTC (permalink / raw) To: William Cohen Cc: eranian, William Cohen, perfctr-devel, perfmon, linux-ia64, linux-kernel On Tue, Dec 20, 2005 at 11:05:02AM -0500, William Cohen wrote: > Dec 20 10:29:47 trek kernel: Unable to handle kernel paging request at > virtual address 6b6b6ba7 mm/slab.c:#define POISON_FREE 0x6b /* for use-after-free poisoning */ ^ permalink raw reply [flat|nested] 9+ messages in thread
* 2.6.15-rc6 updated perfmon2 patch 2005-12-15 10:46 2.6.15-rc5-git3 perfmon2 new code base + libpfm available Stephane Eranian 2005-12-15 21:22 ` [Perfctr-devel] " William Cohen @ 2005-12-20 18:07 ` Stephane Eranian 2005-12-21 22:09 ` new 2.6.15-rc6 " Stephane Eranian 1 sibling, 1 reply; 9+ messages in thread From: Stephane Eranian @ 2005-12-20 18:07 UTC (permalink / raw) To: perfctr-devel; +Cc: perfmon, linux-ia64, linux-kernel Hi, I have released another verison of the perfmon2 new code base. This one is relative to 2.6.15-rc6 and hopefully should fix some of the problems people have reported. This new kernel patch fixes the following: - kernel panic in perfmon_pmu.c or perfmon_fmt.c if PMU description or buffer format is compiled in. - missing __user in perfmon_syscalls.c - better handling of NMI reservation for X86-64, EM64T and i386. You MUST use libpfm-3.2-051215 with this kernel due to interface change for pfm_create_context(). As usual, you can download the latest packages from the SourceForge website at: http://www.sf.net/projects/perfmon2 -- -Stephane ^ permalink raw reply [flat|nested] 9+ messages in thread
* new 2.6.15-rc6 perfmon2 patch 2005-12-20 18:07 ` 2.6.15-rc6 updated perfmon2 patch Stephane Eranian @ 2005-12-21 22:09 ` Stephane Eranian 0 siblings, 0 replies; 9+ messages in thread From: Stephane Eranian @ 2005-12-21 22:09 UTC (permalink / raw) To: perfctr-devel; +Cc: perfmon, linux-ia64, linux-kernel Hi, I have released YET another version of the perfmon2 new code base. This one is STILL relative to 2.6.15-rc6 and is called 2.6.15-rc6-v2. This one DOES fix the panic on pfm_fmt_put()! This patch includes compared to initial 2.6.15-rc6: - quick overview of perfmon2 README - fix the kernel panic on pfm_fmt_put() - save/restore of PMU state when NMI watchdog is enabled. - reinforced checks in register_smpl_fmt() - revised checks to detect if a format/PMU description is builtin or module - sampling formats can now export the notification message queue depth they require. - MIPS patch updated to latest fixes. You MUST use libpfm-3.2-051215 with this kernel due to interface change for pfm_create_context(). As usual, you can download the latest packages from the SourceForge website at: http://www.sf.net/projects/perfmon2 This will hopefully be the last release for this year. Happy Holidays. -- -Stephane ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-12-21 22:10 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-12-15 10:46 2.6.15-rc5-git3 perfmon2 new code base + libpfm available Stephane Eranian 2005-12-15 21:22 ` [Perfctr-devel] " William Cohen 2005-12-15 21:59 ` Stephane Eranian 2005-12-15 22:23 ` William Cohen 2005-12-15 23:15 ` Stephane Eranian 2005-12-20 16:05 ` William Cohen 2005-12-20 16:54 ` Matthew Wilcox 2005-12-20 18:07 ` 2.6.15-rc6 updated perfmon2 patch Stephane Eranian 2005-12-21 22:09 ` new 2.6.15-rc6 " Stephane Eranian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).