|
From: <sv...@va...> - 2011-06-08 09:15:35
|
Author: tom
Date: 2011-06-08 10:10:40 +0100 (Wed, 08 Jun 2011)
New Revision: 11804
Log:
It seems that the perf_counter_open system call was renamed to
perf_event_open some time after we added it, so correct the name
wherever it appears to match the current kernel source.
Also fixup the PRE handler to do the check correctly, using the
size field of the structure to work out how much data there is.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-linux.h
trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/include/vki/vki-linux.h
trunk/include/vki/vki-scnums-amd64-linux.h
trunk/include/vki/vki-scnums-ppc32-linux.h
trunk/include/vki/vki-scnums-ppc64-linux.h
trunk/include/vki/vki-scnums-x86-linux.h
Modified: trunk/coregrind/m_syswrap/priv_syswrap-linux.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/priv_syswrap-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -47,7 +47,7 @@
DECL_TEMPLATE(linux, sys_mount);
DECL_TEMPLATE(linux, sys_oldumount);
DECL_TEMPLATE(linux, sys_umount);
-DECL_TEMPLATE(linux, sys_perf_counter_open);
+DECL_TEMPLATE(linux, sys_perf_event_open);
DECL_TEMPLATE(linux, sys_preadv);
DECL_TEMPLATE(linux, sys_pwritev);
DECL_TEMPLATE(linux, sys_dup3);
Modified: trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-amd64-linux.c 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/syswrap-amd64-linux.c 2011-06-08 09:10:40 UTC (rev 11804)
@@ -1410,7 +1410,7 @@
LINXY(__NR_preadv, sys_preadv), // 295
LINX_(__NR_pwritev, sys_pwritev), // 296
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 297
- LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 298
+ LINXY(__NR_perf_event_open, sys_perf_event_open) // 298
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2011-06-08 09:10:40 UTC (rev 11804)
@@ -2583,22 +2583,26 @@
PRE_MEM_READ( "stime(t)", ARG1, sizeof(vki_time_t) );
}
-PRE(sys_perf_counter_open)
+PRE(sys_perf_event_open)
{
- PRINT("sys_perf_counter_open ( %#lx, %ld, %ld, %ld, %ld )",
+ struct vki_perf_event_attr *attr;
+ PRINT("sys_perf_event_open ( %#lx, %ld, %ld, %ld, %ld )",
ARG1,ARG2,ARG3,ARG4,ARG5);
- PRE_REG_READ5(long, "perf_counter_open",
- struct vki_perf_counter_attr *, attr,
+ PRE_REG_READ5(long, "perf_event_open",
+ struct vki_perf_event_attr *, attr,
vki_pid_t, pid, int, cpu, int, group_fd,
unsigned long, flags);
- PRE_MEM_READ( "perf_counter_open(attr)",
- ARG1, sizeof(struct vki_perf_counter_attr) );
+ attr = (struct vki_perf_event_attr *)ARG1;
+ PRE_MEM_READ( "perf_event_open(attr->size)",
+ &attr->size, sizeof(attr->size) );
+ PRE_MEM_READ( "perf_event_open(attr)",
+ attr, attr->size );
}
-POST(sys_perf_counter_open)
+POST(sys_perf_event_open)
{
vg_assert(SUCCESS);
- if (!ML_(fd_allowed)(RES, "perf_counter_open", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "perf_event_open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
Modified: trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2011-06-08 09:10:40 UTC (rev 11804)
@@ -1890,7 +1890,7 @@
LINXY(__NR_dup3, sys_dup3), // 316
LINXY(__NR_pipe2, sys_pipe2), // 317
LINXY(__NR_inotify_init1, sys_inotify_init1), // 318
- LINXY(__NR_perf_counter_open, sys_perf_counter_open),// 319
+ LINXY(__NR_perf_event_open, sys_perf_event_open), // 319
LINXY(__NR_preadv, sys_preadv), // 320
LINX_(__NR_pwritev, sys_pwritev), // 321
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) // 322
Modified: trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c 2011-06-08 09:10:40 UTC (rev 11804)
@@ -1531,7 +1531,7 @@
LINXY(__NR_dup3, sys_dup3), // 316
LINXY(__NR_pipe2, sys_pipe2), // 317
LINXY(__NR_inotify_init1, sys_inotify_init1), // 318
- LINXY(__NR_perf_counter_open, sys_perf_counter_open),// 319
+ LINXY(__NR_perf_event_open, sys_perf_event_open), // 319
LINXY(__NR_preadv, sys_preadv), // 320
LINX_(__NR_pwritev, sys_pwritev), // 321
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) // 322
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2011-06-08 09:10:40 UTC (rev 11804)
@@ -2280,7 +2280,7 @@
LINX_(__NR_pwritev, sys_pwritev), // 334
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 335
- LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 336
+ LINXY(__NR_perf_event_open, sys_perf_event_open) // 336
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
Modified: trunk/include/vki/vki-linux.h
===================================================================
--- trunk/include/vki/vki-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/include/vki/vki-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -2625,10 +2625,10 @@
};
/*--------------------------------------------------------------------*/
-// From linux-2.6.31.5/include/linux/perf_counter.h
+// From linux-2.6.31.5/include/linux/perf_event.h
/*--------------------------------------------------------------------*/
-struct vki_perf_counter_attr {
+struct vki_perf_event_attr {
/*
* Major type: hardware/software/tracepoint/etc.
@@ -2667,13 +2667,37 @@
inherit_stat : 1, /* per task counts */
enable_on_exec : 1, /* next exec enables */
task : 1, /* trace fork/exit */
+ watermark : 1, /* wakeup_watermark */
+ /*
+ * precise_ip:
+ *
+ * 0 - SAMPLE_IP can have arbitrary skid
+ * 1 - SAMPLE_IP must have constant skid
+ * 2 - SAMPLE_IP requested to have 0 skid
+ * 3 - SAMPLE_IP must have 0 skid
+ *
+ * See also PERF_RECORD_MISC_EXACT_IP
+ */
+ precise_ip : 2, /* skid constraint */
+ mmap_data : 1, /* non-exec mmap data */
+ sample_id_all : 1, /* sample_type all events */
- __reserved_1 : 50;
+ __reserved_1 : 45;
- __vki_u32 wakeup_events; /* wakeup every n events */
- __vki_u32 __reserved_2;
+ union {
+ __vki_u32 wakeup_events; /* wakeup every n events */
+ __vki_u32 wakeup_watermark; /* bytes before wakeup */
+ };
- __vki_u64 __reserved_3;
+ __vki_u32 bp_type;
+ union {
+ __vki_u64 bp_addr;
+ __vki_u64 config1; /* extension of config */
+ };
+ union {
+ __vki_u64 bp_len;
+ __vki_u64 config2; /* extension of config1 */
+ };
};
/*--------------------------------------------------------------------*/
Modified: trunk/include/vki/vki-scnums-amd64-linux.h
===================================================================
--- trunk/include/vki/vki-scnums-amd64-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/include/vki/vki-scnums-amd64-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -379,7 +379,7 @@
#define __NR_preadv 295
#define __NR_pwritev 296
#define __NR_rt_tgsigqueueinfo 297
-#define __NR_perf_counter_open 298
+#define __NR_perf_event_open 298
#endif /* __VKI_SCNUMS_AMD64_LINUX_H */
Modified: trunk/include/vki/vki-scnums-ppc32-linux.h
===================================================================
--- trunk/include/vki/vki-scnums-ppc32-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/include/vki/vki-scnums-ppc32-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -361,7 +361,7 @@
#define __NR_dup3 316
#define __NR_pipe2 317
#define __NR_inotify_init1 318
-#define __NR_perf_counter_open 319
+#define __NR_perf_event_open 319
#define __NR_preadv 320
#define __NR_pwritev 321
#define __NR_rt_tgsigqueueinfo 322
Modified: trunk/include/vki/vki-scnums-ppc64-linux.h
===================================================================
--- trunk/include/vki/vki-scnums-ppc64-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/include/vki/vki-scnums-ppc64-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -353,7 +353,7 @@
#define __NR_dup3 316
#define __NR_pipe2 317
#define __NR_inotify_init1 318
-#define __NR_perf_counter_open 319
+#define __NR_perf_event_open 319
#define __NR_preadv 320
#define __NR_pwritev 321
#define __NR_rt_tgsigqueueinfo 322
Modified: trunk/include/vki/vki-scnums-x86-linux.h
===================================================================
--- trunk/include/vki/vki-scnums-x86-linux.h 2011-06-07 22:54:32 UTC (rev 11803)
+++ trunk/include/vki/vki-scnums-x86-linux.h 2011-06-08 09:10:40 UTC (rev 11804)
@@ -370,7 +370,7 @@
#define __NR_preadv 333
#define __NR_pwritev 334
#define __NR_rt_tgsigqueueinfo 335
-#define __NR_perf_counter_open 336
+#define __NR_perf_event_open 336
#endif /* __VKI_SCNUMS_X86_LINUX_H */
|
|
From: Christian B. <bor...@de...> - 2011-06-08 20:29:25
|
On 08/06/11 11:10, sv...@va... wrote: > Author: tom > Date: 2011-06-08 10:10:40 +0100 (Wed, 08 Jun 2011) > New Revision: 11804 > > Log: > It seems that the perf_counter_open system call was renamed to > perf_event_open some time after we added it, so correct the name > wherever it appears to match the current kernel source. > > Also fixup the PRE handler to do the check correctly, using the > size field of the structure to work out how much data there is. Tom, can you also do that for s390? The build currently fails due to that change. Thanks Christian |