Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL New Jiri Olsa 2 participants 15 messages May 5, 2014

Subsystems (2)
lore
Share & tools
lore
author reviewer
#1 lore raw

PATCH 1/12 tools: Unify export.h

In reply to Jiri Olsa

From: Borislav Petkov <[email protected]>

So tools/ has been growing three, at a different stage of their development export.h headers and so we should unite into one. Add tools/include/ to the include path of virtio and liblockdep to pick the shared header now.

---
 tools/include/linux/export.h              | 10 ++++++++++
 tools/lib/lockdep/Makefile                |  2 +-
 tools/lib/lockdep/uinclude/linux/export.h |  7 -------
 tools/perf/MANIFEST                       |  1 +
 tools/perf/Makefile.perf                  |  2 +-
 tools/perf/util/include/linux/export.h    |  6 ------
 tools/virtio/Makefile                     |  2 +-
 tools/virtio/linux/export.h               |  5 -----
 8 files changed, 14 insertions(+), 21 deletions(-)
 create mode 100644 tools/include/linux/export.h
 delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
 delete mode 100644 tools/perf/util/include/linux/export.h
 delete mode 100644 tools/virtio/linux/export.h
tools/include/linux/export.h new file +10 -0
new file mode 100644
index 0000000..d07e586
@@ -0,0 +1,10 @@
+#ifndef _TOOLS_LINUX_EXPORT_H_
+#define _TOOLS_LINUX_EXPORT_H_
+
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+
+#endif
tools/lib/lockdep/Makefile +1 -1
index cb09d3f..85ef05d 100644
@@ -105,7 +105,7 @@ N		=
 
 export Q VERBOSE
 
-INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES)
+INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES)
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
tools/lib/lockdep/uinclude/linux/export.h deleted +0 -7
deleted file mode 100644
index 6bdf349..0000000
@@ -1,7 +0,0 @@
-#ifndef _LIBLOCKDEP_LINUX_EXPORT_H_
-#define _LIBLOCKDEP_LINUX_EXPORT_H_
-
-#define EXPORT_SYMBOL(sym)
-#define EXPORT_SYMBOL_GPL(sym)
-
-#endif
tools/perf/MANIFEST +1 -0
index c0c87c8..81783c2 100644
@@ -7,6 +7,7 @@ tools/lib/symbol/kallsyms.h
 tools/include/asm/bug.h
 tools/include/linux/compiler.h
 tools/include/linux/hash.h
+tools/include/linux/export.h
 include/linux/const.h
 include/linux/perf_event.h
 include/linux/rbtree.h
tools/perf/Makefile.perf +1 -1
index 5e21aad..bd11e8a 100644
@@ -222,7 +222,7 @@ LIB_H += util/include/linux/const.h
 LIB_H += util/include/linux/ctype.h
 LIB_H += util/include/linux/kernel.h
 LIB_H += util/include/linux/list.h
-LIB_H += util/include/linux/export.h
+LIB_H += ../include/linux/export.h
 LIB_H += util/include/linux/poison.h
 LIB_H += util/include/linux/rbtree.h
 LIB_H += util/include/linux/rbtree_augmented.h
tools/perf/util/include/linux/export.h deleted +0 -6
deleted file mode 100644
index b43e2dc..0000000
@@ -1,6 +0,0 @@
-#ifndef PERF_LINUX_MODULE_H
-#define PERF_LINUX_MODULE_H
-
-#define EXPORT_SYMBOL(name)
-
-#endif
tools/virtio/Makefile +1 -1
index 3187c62..9325f46 100644
@@ -3,7 +3,7 @@ test: virtio_test vringh_test
 virtio_test: virtio_ring.o virtio_test.o
 vringh_test: vringh_test.o vringh.o virtio_ring.o
 
-CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
+CFLAGS += -g -O2 -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
 vpath %.c ../../drivers/virtio ../../drivers/vhost
 mod:
 	${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test
tools/virtio/linux/export.h deleted +0 -5
deleted file mode 100644
index 7311d32..0000000
@@ -1,5 +0,0 @@
-#define EXPORT_SYMBOL(sym)
-#define EXPORT_SYMBOL_GPL(sym)
-#define EXPORT_SYMBOL_GPL_FUTURE(sym)
-#define EXPORT_UNUSED_SYMBOL(sym)
-#define EXPORT_UNUSED_SYMBOL_GPL(sym)
Signature · 1 line
1.8.3.1
author reviewer
#3 lore raw

PATCH 2/12 tools: Consolidate types.h

In reply to Jiri Olsa

From: Borislav Petkov <[email protected]>

Combine all definitions into a common tools/include/linux/types.h and kill the wild growth elsewhere. Move DECLARE_BITMAP to its proper bitmap.h header.

---
 tools/include/linux/types.h               | 75 +++++++++++++++++++++++++++++++
 tools/lib/lockdep/uinclude/linux/types.h  | 58 ------------------------
 tools/perf/MANIFEST                       |  1 +
 tools/perf/Makefile.perf                  |  3 +-
 tools/perf/arch/x86/include/perf_regs.h   |  2 +-
 tools/perf/arch/x86/util/tsc.c            |  2 +-
 tools/perf/arch/x86/util/tsc.h            |  2 +-
 tools/perf/perf.h                         |  4 +-
 tools/perf/tests/attr.c                   |  7 ---
 tools/perf/tests/code-reading.c           |  3 +-
 tools/perf/tests/dso-data.c               |  2 +-
 tools/perf/tests/dwarf-unwind.c           |  2 +-
 tools/perf/tests/keep-tracking.c          |  2 +-
 tools/perf/tests/parse-no-sample-id-all.c |  2 +-
 tools/perf/tests/perf-time-to-tsc.c       |  3 +-
 tools/perf/tests/rdpmc.c                  |  2 +-
 tools/perf/tests/sample-parsing.c         |  2 +-
 tools/perf/ui/browser.h                   |  4 +-
 tools/perf/ui/progress.h                  |  2 +-
 tools/perf/util/annotate.h                |  2 +-
 tools/perf/util/build-id.h                |  2 +-
 tools/perf/util/dso.h                     |  2 +-
 tools/perf/util/evsel.h                   |  4 +-
 tools/perf/util/header.h                  |  4 +-
 tools/perf/util/include/linux/bitmap.h    |  3 ++
 tools/perf/util/include/linux/list.h      |  1 +
 tools/perf/util/include/linux/types.h     | 29 ------------
 tools/perf/util/map.h                     |  2 +-
 tools/perf/util/parse-events.h            |  3 +-
 tools/perf/util/parse-events.y            |  2 +-
 tools/perf/util/perf_regs.h               |  2 +-
 tools/perf/util/pmu.h                     |  2 +-
 tools/perf/util/stat.h                    |  2 +-
 tools/perf/util/svghelper.c               |  2 +-
 tools/perf/util/svghelper.h               |  2 +-
 tools/perf/util/top.h                     |  2 +-
 tools/perf/util/types.h                   | 19 --------
 tools/perf/util/unwind-libdw.c            |  2 +-
 tools/perf/util/unwind.h                  |  2 +-
 tools/perf/util/util.h                    |  2 +-
 tools/perf/util/values.h                  |  2 +-
 tools/virtio/linux/kernel.h               |  7 ---
 tools/virtio/linux/types.h                | 28 ------------
 43 files changed, 115 insertions(+), 191 deletions(-)
 create mode 100644 tools/include/linux/types.h
 delete mode 100644 tools/lib/lockdep/uinclude/linux/types.h
 delete mode 100644 tools/perf/util/include/linux/types.h
 delete mode 100644 tools/perf/util/types.h
 delete mode 100644 tools/virtio/linux/types.h
tools/include/linux/types.h new file +75 -0
new file mode 100644
index 0000000..b5cf25e
@@ -0,0 +1,75 @@
+#ifndef _TOOLS_LINUX_TYPES_H_
+#define _TOOLS_LINUX_TYPES_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define __SANE_USERSPACE_TYPES__	/* For PPC64, to get LL64 types */
+#include <asm/types.h>
+
+struct page;
+struct kmem_cache;
+
+typedef enum {
+	GFP_KERNEL,
+	GFP_ATOMIC,
+	__GFP_HIGHMEM,
+	__GFP_HIGH
+} gfp_t;
+
+/*
+ * We define u64 as uint64_t for every architecture
+ * so that we can print it with "%"PRIx64 without getting warnings.
+ *
+ * typedef __u64 u64;
+ * typedef __s64 s64;
+ */
+typedef uint64_t u64;
+typedef int64_t s64;
+
+typedef __u32 u32;
+typedef __s32 s32;
+
+typedef __u16 u16;
+typedef __s16 s16;
+
+typedef __u8  u8;
+typedef __s8  s8;
+
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#ifdef __CHECK_ENDIAN__
+#define __bitwise __bitwise__
+#else
+#define __bitwise
+#endif
+
+#define __force
+#define __user
+#define __must_check
+#define __cold
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+
+struct list_head {
+	struct list_head *next, *prev;
+};
+
+struct hlist_head {
+	struct hlist_node *first;
+};
+
+struct hlist_node {
+	struct hlist_node *next, **pprev;
+};
+
+#endif /* _TOOLS_LINUX_TYPES_H_ */
tools/lib/lockdep/uinclude/linux/types.h deleted +0 -58

58 lines not on this page · raw message

tools/perf/MANIFEST +1 -0
index 81783c2..45da209 100644
@@ -8,6 +8,7 @@ tools/include/asm/bug.h
 tools/include/linux/compiler.h
 tools/include/linux/hash.h
 tools/include/linux/export.h
+tools/include/linux/types.h
 include/linux/const.h
 include/linux/perf_event.h
 include/linux/rbtree.h
tools/perf/Makefile.perf +1 -2
index bd11e8a..2baf61c 100644
@@ -227,7 +227,7 @@ LIB_H += util/include/linux/poison.h
 LIB_H += util/include/linux/rbtree.h
 LIB_H += util/include/linux/rbtree_augmented.h
 LIB_H += util/include/linux/string.h
-LIB_H += util/include/linux/types.h
+LIB_H += ../include/linux/types.h
 LIB_H += util/include/linux/linkage.h
 LIB_H += util/include/asm/asm-offsets.h
 LIB_H += ../include/asm/bug.h
@@ -252,7 +252,6 @@ LIB_H += util/event.h
 LIB_H += util/evsel.h
 LIB_H += util/evlist.h
 LIB_H += util/exec_cmd.h
-LIB_H += util/types.h
 LIB_H += util/levenshtein.h
 LIB_H += util/machine.h
 LIB_H += util/map.h
tools/perf/arch/x86/include/perf_regs.h +1 -1
index fc819ca..7df517a 100644
@@ -2,7 +2,7 @@
 #define ARCH_PERF_REGS_H
 
 #include <stdlib.h>
-#include "../../util/types.h"
+#include <linux/types.h>
 #include <asm/perf_regs.h>
 
 void perf_regs_load(u64 *regs);
tools/perf/arch/x86/util/tsc.c +1 -1
index b2519e4..40021fa 100644
@@ -4,7 +4,7 @@
 #include <linux/perf_event.h>
 
 #include "../../perf.h"
-#include "../../util/types.h"
+#include <linux/types.h>
 #include "../../util/debug.h"
 #include "tsc.h"
 
tools/perf/arch/x86/util/tsc.h +1 -1
index a24dec8..2affe03 100644
@@ -1,7 +1,7 @@
 #ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
 #define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
 
-#include "../../util/types.h"
+#include <linux/types.h>
 
 struct perf_tsc_conversion {
 	u16 time_shift;
tools/perf/perf.h +1 -3
index ebdad33..5aa8ac4 100644
@@ -173,9 +173,8 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 
+#include <linux/types.h>
 #include <linux/perf_event.h>
-#include "util/types.h"
-#include <stdbool.h>
 
 /*
  * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
@@ -202,7 +201,6 @@ static inline unsigned long long rdclock(void)
 /*
  * Pick up some kernel type conventions:
  */
-#define __user
 #define asmlinkage
 
 #define unlikely(x)	__builtin_expect(!!(x), 0)
tools/perf/tests/attr.c +0 -7
index 00218f5..2dfc9ad 100644
@@ -1,4 +1,3 @@
-
 /*
  * The struct perf_event_attr test support.
  *
@@ -19,14 +18,8 @@
  * permissions. All the event text files are stored there.
  */
 
-/*
- * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
- * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
- */
-#define __SANE_USERSPACE_TYPES__
 #include <stdlib.h>
 #include <stdio.h>
-#include <inttypes.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include "../perf.h"
tools/perf/tests/code-reading.c +1 -2
index bfb1869..adf3de3 100644
@@ -1,8 +1,7 @@
-#include <sys/types.h>
+#include <linux/types.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <inttypes.h>
 #include <ctype.h>
 #include <string.h>
 
tools/perf/tests/dso-data.c +1 -1
index 9cc81a3..3e6cb17 100644
@@ -1,7 +1,7 @@
 #include "util.h"
 
 #include <stdlib.h>
-#include <sys/types.h>
+#include <linux/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <string.h>
tools/perf/tests/dwarf-unwind.c +1 -1
index c059ee8..108f0cd 100644
@@ -1,5 +1,5 @@
 #include <linux/compiler.h>
-#include <sys/types.h>
+#include <linux/types.h>
 #include <unistd.h>
 #include "tests.h"
 #include "debug.h"
tools/perf/tests/keep-tracking.c +1 -1
index 497957f..7a5ab7b 100644
@@ -1,4 +1,4 @@
-#include <sys/types.h>
+#include <linux/types.h>
 #include <unistd.h>
 #include <sys/prctl.h>
 
tools/perf/tests/parse-no-sample-id-all.c +1 -1
index e117b6c..905019f 100644
@@ -1,4 +1,4 @@
-#include <sys/types.h>
+#include <linux/types.h>
 #include <stddef.h>
 
 #include "tests.h"
tools/perf/tests/perf-time-to-tsc.c +1 -2
index 47146d3..3b7cd4d 100644
@@ -1,7 +1,6 @@
 #include <stdio.h>
-#include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
+#include <linux/types.h>
 #include <sys/prctl.h>
 
 #include "parse-events.h"
tools/perf/tests/rdpmc.c +1 -1
index 46649c2..e59143f 100644
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <sys/mman.h>
-#include "types.h"
+#include <linux/types.h>
 #include "perf.h"
 #include "debug.h"
 #include "tests.h"
tools/perf/tests/sample-parsing.c +1 -1
index 0014d3c..7ae8d17 100644
@@ -1,5 +1,5 @@
 #include <stdbool.h>
-#include <inttypes.h>
+#include <linux/types.h>
 
 #include "util.h"
 #include "event.h"
tools/perf/ui/browser.h +1 -3
index 118cca2..03d4d62 100644
@@ -1,9 +1,7 @@
 #ifndef _PERF_UI_BROWSER_H_
 #define _PERF_UI_BROWSER_H_ 1
 
-#include <stdbool.h>
-#include <sys/types.h>
-#include "../types.h"
+#include <linux/types.h>
 
 #define HE_COLORSET_TOP		50
 #define HE_COLORSET_MEDIUM	51
tools/perf/ui/progress.h +1 -1
index 29ec8ef..f34f89e 100644
@@ -1,7 +1,7 @@
 #ifndef _PERF_UI_PROGRESS_H_
 #define _PERF_UI_PROGRESS_H_ 1
 
-#include <../types.h>
+#include <linux/types.h>
 
 void ui_progress__finish(void);
  
tools/perf/util/annotate.h +1 -1
index 56ad4f5..112d6e2 100644
@@ -3,7 +3,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
-#include "types.h"
+#include <linux/types.h>
 #include "symbol.h"
 #include "hist.h"
 #include "sort.h"
tools/perf/util/build-id.h +1 -1
index 845ef86..ae39256 100644
@@ -4,7 +4,7 @@
 #define BUILD_ID_SIZE 20
 
 #include "tool.h"
-#include "types.h"
+#include <linux/types.h>
 
 extern struct perf_tool build_id__mark_dso_hit_ops;
 struct dso;
tools/perf/util/dso.h +1 -1
index ab06f1c..38efe95 100644
@@ -4,7 +4,7 @@
 #include <linux/types.h>
 #include <linux/rbtree.h>
 #include <stdbool.h>
-#include "types.h"
+#include <linux/types.h>
 #include "map.h"
 #include "build-id.h"
 
tools/perf/util/evsel.h +2 -2
index 0c581d0..a52e9a5 100644
@@ -5,12 +5,12 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <linux/perf_event.h>
-#include "types.h"
+#include <linux/types.h>
 #include "xyarray.h"
 #include "cgroup.h"
 #include "hist.h"
 #include "symbol.h"
- 
+
 struct perf_counts_values {
 	union {
 		struct {
tools/perf/util/header.h +2 -2
index a2d047b..d08cfe4 100644
@@ -4,10 +4,10 @@
 #include <linux/perf_event.h>
 #include <sys/types.h>
 #include <stdbool.h>
-#include "types.h"
+#include <linux/bitmap.h>
+#include <linux/types.h>
 #include "event.h"
 
-#include <linux/bitmap.h>
 
 enum {
 	HEADER_RESERVED		= 0,	/* always cleared */
tools/perf/util/include/linux/bitmap.h +3 -0
index bb162e4..01ffd12 100644
@@ -4,6 +4,9 @@
 #include <string.h>
 #include <linux/bitops.h>
 
+#define DECLARE_BITMAP(name,bits) \
+	unsigned long name[BITS_TO_LONGS(bits)]
+
 int __bitmap_weight(const unsigned long *bitmap, int bits);
 void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
 		 const unsigned long *bitmap2, int bits);
tools/perf/util/include/linux/list.h +1 -0
index bfe0a2a..76ddbc7 100644
@@ -1,4 +1,5 @@
 #include <linux/kernel.h>
+#include <linux/types.h>
 
 #include "../../../../include/linux/list.h"
 
tools/perf/util/include/linux/types.h deleted +0 -29
deleted file mode 100644
index eb46478..0000000
@@ -1,29 +0,0 @@
-#ifndef _PERF_LINUX_TYPES_H_
-#define _PERF_LINUX_TYPES_H_
-
-#include <asm/types.h>
-
-#ifndef __bitwise
-#define __bitwise
-#endif
-
-#ifndef __le32
-typedef __u32 __bitwise __le32;
-#endif
-
-#define DECLARE_BITMAP(name,bits) \
-	unsigned long name[BITS_TO_LONGS(bits)]
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-struct hlist_head {
-	struct hlist_node *first;
-};
-
-struct hlist_node {
-	struct hlist_node *next, **pprev;
-};
-
-#endif
tools/perf/util/map.h +1 -1
index d6445b2..ae2d451 100644
@@ -6,7 +6,7 @@
 #include <linux/rbtree.h>
 #include <stdio.h>
 #include <stdbool.h>
-#include "types.h"
+#include <linux/types.h>
 
 enum map_type {
 	MAP__FUNCTION = 0,
tools/perf/util/parse-events.h +1 -2
index f1cb4c4..df094b4 100644
@@ -6,9 +6,8 @@
 
 #include <linux/list.h>
 #include <stdbool.h>
-#include "types.h"
+#include <linux/types.h>
 #include <linux/perf_event.h>
-#include "types.h"
 
 struct list_head;
 struct perf_evsel;
tools/perf/util/parse-events.y +1 -1
index ac9db9f..0bc87ba 100644
@@ -9,7 +9,7 @@
 
 #include <linux/compiler.h>
 #include <linux/list.h>
-#include "types.h"
+#include <linux/types.h>
 #include "util.h"
 #include "parse-events.h"
 #include "parse-events-bison.h"
tools/perf/util/perf_regs.h +1 -1
index d6e8b6a..79c78f7 100644
@@ -1,7 +1,7 @@
 #ifndef __PERF_REGS_H
 #define __PERF_REGS_H
 
-#include "types.h"
+#include <linux/types.h>
 #include "event.h"
 
 #ifdef HAVE_PERF_REGS_SUPPORT
tools/perf/util/pmu.h +1 -1
index 8b64125..c14a543 100644
@@ -1,7 +1,7 @@
 #ifndef __PMU_H
 #define __PMU_H
 
-#include <linux/bitops.h>
+#include <linux/bitmap.h>
 #include <linux/perf_event.h>
 #include <stdbool.h>
 
tools/perf/util/stat.h +1 -1
index ae8ccd7..5667fc3 100644
@@ -1,7 +1,7 @@
 #ifndef __PERF_STATS_H
 #define __PERF_STATS_H
 
-#include "types.h"
+#include <linux/types.h>
 
 struct stats
 {
tools/perf/util/svghelper.c +1 -1
index 43262b8..6a0a13d 100644
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <linux/bitops.h>
+#include <linux/bitmap.h>
 
 #include "perf.h"
 #include "svghelper.h"
tools/perf/util/svghelper.h +1 -1
index f7b4d6e..e3aff53 100644
@@ -1,7 +1,7 @@
 #ifndef __PERF_SVGHELPER_H
 #define __PERF_SVGHELPER_H
 
-#include "types.h"
+#include <linux/types.h>
 
 extern void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end);
 extern void svg_box(int Yslot, u64 start, u64 end, const char *type);
tools/perf/util/top.h +1 -1
index dab14d0..f92c37a 100644
@@ -2,7 +2,7 @@
 #define __PERF_TOP_H 1
 
 #include "tool.h"
-#include "types.h"
+#include <linux/types.h>
 #include <stddef.h>
 #include <stdbool.h>
 #include <termios.h>
tools/perf/util/types.h deleted +0 -19
deleted file mode 100644
index 5f3689a..0000000
@@ -1,19 +0,0 @@
-#ifndef __PERF_TYPES_H
-#define __PERF_TYPES_H
-
-#include <stdint.h>
-
-/*
- * We define u64 as uint64_t for every architecture
- * so that we can print it with "%"PRIx64 without getting warnings.
- */
-typedef uint64_t	   u64;
-typedef int64_t		   s64;
-typedef unsigned int	   u32;
-typedef signed int	   s32;
-typedef unsigned short	   u16;
-typedef signed short	   s16;
-typedef unsigned char	   u8;
-typedef signed char	   s8;
-
-#endif /* __PERF_TYPES_H */
tools/perf/util/unwind-libdw.c +1 -1
index 67db73e..5ec80a5 100644
@@ -7,7 +7,7 @@
 #include "unwind-libdw.h"
 #include "machine.h"
 #include "thread.h"
-#include "types.h"
+#include <linux/types.h>
 #include "event.h"
 #include "perf_regs.h"
 
tools/perf/util/unwind.h +1 -1
index b031316..f030612 100644
@@ -1,7 +1,7 @@
 #ifndef __UNWIND_H
 #define __UNWIND_H
 
-#include "types.h"
+#include <linux/types.h>
 #include "event.h"
 #include "symbol.h"
 
tools/perf/util/util.h +1 -1
index 6995d66..b03da44 100644
@@ -69,7 +69,7 @@
 #include <sys/ioctl.h>
 #include <inttypes.h>
 #include <linux/magic.h>
-#include "types.h"
+#include <linux/types.h>
 #include <sys/ttydefaults.h>
 #include <api/fs/debugfs.h>
 #include <termios.h>
tools/perf/util/values.h +1 -1
index 2fa967e..b21a80c 100644
@@ -1,7 +1,7 @@
 #ifndef __PERF_VALUES_H
 #define __PERF_VALUES_H
 
-#include "types.h"
+#include <linux/types.h>
 
 struct perf_read_values {
 	int threads;
tools/virtio/linux/kernel.h +0 -7
index fba7059..1e8ce69 100644
@@ -38,13 +38,6 @@ struct page {
 
 #define __printf(a,b) __attribute__((format(printf,a,b)))
 
-typedef enum {
-	GFP_KERNEL,
-	GFP_ATOMIC,
-	__GFP_HIGHMEM,
-	__GFP_HIGH
-} gfp_t;
-
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
 extern void *__kmalloc_fake, *__kfree_ignore_start, *__kfree_ignore_end;
tools/virtio/linux/types.h deleted +0 -28
deleted file mode 100644
index f8ebb9a..0000000
@@ -1,28 +0,0 @@
-#ifndef TYPES_H
-#define TYPES_H
-#include <stdint.h>
-
-#define __force
-#define __user
-#define __must_check
-#define __cold
-
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint8_t u8;
-typedef int8_t s8;
-
-typedef uint64_t __u64;
-typedef int64_t __s64;
-typedef uint32_t __u32;
-typedef int32_t __s32;
-typedef uint16_t __u16;
-typedef int16_t __s16;
-typedef uint8_t __u8;
-typedef int8_t __s8;
-
-#endif /* TYPES_H */
Signature · 1 line
1.8.3.1
author reviewer
#4 lore raw

PATCH 3/12 perf tools: Remove MAX_COUNTERS define from perf.h

In reply to Jiri Olsa

As it's no longer used.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h | 1 -
 1 file changed, 1 deletion(-)
tools/perf/perf.h +0 -1
index 5aa8ac4..3bea2e6 100644
@@ -231,7 +231,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
 	return fd;
 }
 
-#define MAX_COUNTERS			256
 #define MAX_NR_CPUS			256
 
 struct ip_callchain {
Signature · 1 line
1.8.3.1

Jiri Olsa

author reviewer
#0 lore raw

hi Ingo,
please consider pulling

thanks,
jirka

The following changes since commit 3617660e4e1618a888a2e3a4067224534302cb33:

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core (2014-05-01 08:24:59 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo

for you to fetch changes up to 73a31b7c6a85e2f033524058bad5bce900e4f2ed:

perf tools: Move ACCESS_ONCE from perf.h header (2014-05-05 17:49:07 +0200)

----------------------------------------------------------------
perf/core improvements and fixes:

. Cleanups for perf.h header (Jiri Olsa)

. Consolidate types.h and export.h within tools (Borislav Petkov)

----------------------------------------------------------------
Borislav Petkov (2):
tools: Unify export.h
tools: Consolidate types.h

Jiri Olsa (10):
perf tools: Remove MAX_COUNTERS define from perf.h perf tools: Remove unlikely define from perf.h
perf tools: Remove min define from perf.h
perf tools: Remove asmlinkage define from perf.h perf tools: Remove PR_TASK_PERF_EVENTS_* from perf.h perf tools: Move sample data structures from perf.h perf tools: Move perf_call_graph_mode enum from perf.h perf tools: Move syscall and arch specific defines from perf.h perf tools: Move sys_perf_event_open function from perf.h perf tools: Move ACCESS_ONCE from perf.h header

 tools/include/linux/compiler.h                     |   2 +
 tools/{virtio => include}/linux/export.h           |   5 +
 .../lockdep/uinclude => include}/linux/types.h     |  29 ++-
 tools/lib/lockdep/Makefile                         |   2 +-
 tools/lib/lockdep/uinclude/linux/export.h          |   7 -
 tools/perf/MANIFEST                                |   2 +
 tools/perf/Makefile.perf                           |   5 +-
 tools/perf/arch/x86/include/perf_regs.h            |   2 +-
 tools/perf/arch/x86/util/tsc.c                     |   2 +-
 tools/perf/arch/x86/util/tsc.h                     |   2 +-
 tools/perf/perf-sys.h                              | 190 +++++++++++++++
 tools/perf/perf.h                                  | 254 +--------------------
 tools/perf/tests/attr.c                            |   7 -
 tools/perf/tests/code-reading.c                    |   3 +-
 tools/perf/tests/dso-data.c                        |   2 +-
 tools/perf/tests/dwarf-unwind.c                    |   2 +-
 tools/perf/tests/keep-tracking.c                   |   2 +-
 tools/perf/tests/parse-no-sample-id-all.c          |   2 +-
 tools/perf/tests/perf-time-to-tsc.c                |   3 +-
 tools/perf/tests/rdpmc.c                           |   2 +-
 tools/perf/tests/sample-parsing.c                  |   2 +-
 tools/perf/ui/browser.h                            |   4 +-
 tools/perf/ui/progress.h                           |   2 +-
 tools/perf/util/annotate.h                         |   2 +-
 tools/perf/util/build-id.h                         |   2 +-
 tools/perf/util/callchain.h                        |   7 +
 tools/perf/util/dso.h                              |   2 +-
 tools/perf/util/event.h                            |  24 ++
 tools/perf/util/evsel.h                            |   4 +-
 tools/perf/util/header.h                           |   4 +-
 tools/perf/util/include/linux/bitmap.h             |   3 +
 tools/perf/util/include/linux/export.h             |   6 -
 tools/perf/util/include/linux/list.h               |   1 +
 tools/perf/util/include/linux/types.h              |  29 ---
 tools/perf/util/map.h                              |   2 +-
 tools/perf/util/parse-events.h                     |   3 +-
 tools/perf/util/parse-events.y                     |   2 +-
 tools/perf/util/perf_regs.h                        |   2 +-
 tools/perf/util/pmu.h                              |   2 +-
 tools/perf/util/stat.h                             |   2 +-
 tools/perf/util/svghelper.c                        |   2 +-
 tools/perf/util/svghelper.h                        |   2 +-
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/top.h                              |   2 +-
 tools/perf/util/types.h                            |  19 --
 tools/perf/util/unwind-libdw.c                     |   2 +-
 tools/perf/util/unwind.h                           |   2 +-
 tools/perf/util/util.h                             |   2 +-
 tools/perf/util/values.h                           |   2 +-
 tools/virtio/Makefile                              |   2 +-
 tools/virtio/linux/kernel.h                        |   7 -
 tools/virtio/linux/types.h                         |  28 ---
 52 files changed, 304 insertions(+), 397 deletions(-)
 rename tools/{virtio => include}/linux/export.h (70%)
 rename tools/{lib/lockdep/uinclude => include}/linux/types.h (63%)
 delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
 create mode 100644 tools/perf/perf-sys.h
 delete mode 100644 tools/perf/util/include/linux/export.h
 delete mode 100644 tools/perf/util/include/linux/types.h
 delete mode 100644 tools/perf/util/types.h
 delete mode 100644 tools/virtio/linux/types.h
author reviewer
#7 lore raw

PATCH 6/12 perf tools: Remove asmlinkage define from perf.h

As it's no longer used.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h | 5 -----
 1 file changed, 5 deletions(-)
tools/perf/perf.h +0 -5
index 50aa88d..622949d 100644
@@ -198,11 +198,6 @@ static inline unsigned long long rdclock(void)
 	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
 }
 
-/*
- * Pick up some kernel type conventions:
- */
-#define asmlinkage
-
 extern bool test_attr__enabled;
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
Signature · 1 line
1.8.3.1
author reviewer
#8 lore raw

PATCH 7/12 perf tools: Remove PR_TASK_PERF_EVENTS_* from perf.h

In reply to Jiri Olsa

It's defined in include/uapi/linux/prctl.h header. Also it was never used in perf tool.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h | 7 -------
 1 file changed, 7 deletions(-)
tools/perf/perf.h +0 -7
index 622949d..1bf9537 100644
@@ -176,13 +176,6 @@
 #include <linux/types.h>
 #include <linux/perf_event.h>
 
-/*
- * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
- * counters in the current task.
- */
-#define PR_TASK_PERF_EVENTS_DISABLE   31
-#define PR_TASK_PERF_EVENTS_ENABLE    32
-
 #ifndef NSEC_PER_SEC
 # define NSEC_PER_SEC			1000000000ULL
 #endif
Signature · 1 line
1.8.3.1
author reviewer
#10 lore raw

PATCH 9/12 perf tools: Move perf_call_graph_mode enum from perf.h

In reply to Jiri Olsa

Into util/callchain.h header where all callchain related structures should be.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h           | 7 -------
 tools/perf/util/callchain.h | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
tools/perf/perf.h +0 -7
index cf8f228..d51a994 100644
@@ -222,13 +222,6 @@ void pthread__unblock_sigwinch(void);
 
 #include "util/target.h"
 
-enum perf_call_graph_mode {
-	CALLCHAIN_NONE,
-	CALLCHAIN_FP,
-	CALLCHAIN_DWARF,
-	CALLCHAIN_MAX
-};
-
 struct record_opts {
 	struct target target;
 	int	     call_graph;
tools/perf/util/callchain.h +7 -0
index dda4cf8..bde2b0c 100644
@@ -7,6 +7,13 @@
 #include "event.h"
 #include "symbol.h"
 
+enum perf_call_graph_mode {
+	CALLCHAIN_NONE,
+	CALLCHAIN_FP,
+	CALLCHAIN_DWARF,
+	CALLCHAIN_MAX
+};
+
 enum chain_mode {
 	CHAIN_NONE,
 	CHAIN_FLAT,
Signature · 1 line
1.8.3.1
author reviewer
#9 lore raw

PATCH 8/12 perf tools: Move sample data structures from perf.h

In reply to Jiri Olsa

Into util/event.h header where all sample data structures are defined.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h        | 24 ------------------------
 tools/perf/util/event.h  | 24 ++++++++++++++++++++++++
 tools/perf/util/symbol.h |  1 +
 3 files changed, 25 insertions(+), 24 deletions(-)
tools/perf/perf.h +0 -24
index 1bf9537..cf8f228 100644
@@ -214,30 +214,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
 
 #define MAX_NR_CPUS			256
 
-struct ip_callchain {
-	u64 nr;
-	u64 ips[0];
-};
-
-struct branch_flags {
-	u64 mispred:1;
-	u64 predicted:1;
-	u64 in_tx:1;
-	u64 abort:1;
-	u64 reserved:60;
-};
-
-struct branch_entry {
-	u64				from;
-	u64				to;
-	struct branch_flags flags;
-};
-
-struct branch_stack {
-	u64				nr;
-	struct branch_entry	entries[0];
-};
-
 extern const char *input_name;
 extern bool perf_host, perf_guest;
 extern const char perf_version_string[];
tools/perf/util/event.h +24 -0
index 38457d4..d970232 100644
@@ -112,6 +112,30 @@ struct sample_read {
 	};
 };
 
+struct ip_callchain {
+	u64 nr;
+	u64 ips[0];
+};
+
+struct branch_flags {
+	u64 mispred:1;
+	u64 predicted:1;
+	u64 in_tx:1;
+	u64 abort:1;
+	u64 reserved:60;
+};
+
+struct branch_entry {
+	u64			from;
+	u64			to;
+	struct branch_flags	flags;
+};
+
+struct branch_stack {
+	u64			nr;
+	struct branch_entry	entries[0];
+};
+
 struct perf_sample {
 	u64 ip;
 	u32 pid, tid;
tools/perf/util/symbol.h +1 -0
index ae94e00..33ede53 100644
@@ -12,6 +12,7 @@
 #include <byteswap.h>
 #include <libgen.h>
 #include "build-id.h"
+#include "event.h"
 
 #ifdef HAVE_LIBELF_SUPPORT
 #include <libelf.h>
Signature · 1 line
1.8.3.1
author reviewer
#11 lore raw

PATCH 10/12 perf tools: Move syscall and arch specific defines from perf.h

In reply to Jiri Olsa

Into new perf-sys.h header.

The main reason is to separate system specific perf data from perf tool stuff, so it could be used in small test programs, as requested Peter:

http://lkml.kernel.org/r/[email protected]

This separation makes the perf.h header more clear.

---
 tools/perf/perf-sys.h | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/perf.h     | 165 +------------------------------------------------
 2 files changed, 169 insertions(+), 164 deletions(-)
 create mode 100644 tools/perf/perf-sys.h
tools/perf/perf-sys.h new file +168 -0
new file mode 100644
index 0000000..4c22c2a
@@ -0,0 +1,168 @@
+#ifndef _PERF_SYS_H
+#define _PERF_SYS_H
+
+#include <asm/unistd.h>
+
+#if defined(__i386__)
+#define mb()		asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
+#define wmb()		asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
+#define rmb()		asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
+#define cpu_relax()	asm volatile("rep; nop" ::: "memory");
+#define CPUINFO_PROC	"model name"
+#ifndef __NR_perf_event_open
+# define __NR_perf_event_open 336
+#endif
+#ifndef __NR_futex
+# define __NR_futex 240
+#endif
+#ifndef __NR_gettid
+# define __NR_gettid 224
+#endif
+#endif
+
+#if defined(__x86_64__)
+#define mb()		asm volatile("mfence" ::: "memory")
+#define wmb()		asm volatile("sfence" ::: "memory")
+#define rmb()		asm volatile("lfence" ::: "memory")
+#define cpu_relax()	asm volatile("rep; nop" ::: "memory");
+#define CPUINFO_PROC	"model name"
+#ifndef __NR_perf_event_open
+# define __NR_perf_event_open 298
+#endif
+#ifndef __NR_futex
+# define __NR_futex 202
+#endif
+#ifndef __NR_gettid
+# define __NR_gettid 186
+#endif
+#endif
+
+#ifdef __powerpc__
+#include "../../arch/powerpc/include/uapi/asm/unistd.h"
+#define mb()		asm volatile ("sync" ::: "memory")
+#define wmb()		asm volatile ("sync" ::: "memory")
+#define rmb()		asm volatile ("sync" ::: "memory")
+#define CPUINFO_PROC	"cpu"
+#endif
+
+#ifdef __s390__
+#define mb()		asm volatile("bcr 15,0" ::: "memory")
+#define wmb()		asm volatile("bcr 15,0" ::: "memory")
+#define rmb()		asm volatile("bcr 15,0" ::: "memory")
+#endif
+
+#ifdef __sh__
+#if defined(__SH4A__) || defined(__SH5__)
+# define mb()		asm volatile("synco" ::: "memory")
+# define wmb()		asm volatile("synco" ::: "memory")
+# define rmb()		asm volatile("synco" ::: "memory")
+#else
+# define mb()		asm volatile("" ::: "memory")
+# define wmb()		asm volatile("" ::: "memory")
+# define rmb()		asm volatile("" ::: "memory")
+#endif
+#define CPUINFO_PROC	"cpu type"
+#endif
+
+#ifdef __hppa__
+#define mb()		asm volatile("" ::: "memory")
+#define wmb()		asm volatile("" ::: "memory")
+#define rmb()		asm volatile("" ::: "memory")
+#define CPUINFO_PROC	"cpu"
+#endif
+
+#ifdef __sparc__
+#ifdef __LP64__
+#define mb()		asm volatile("ba,pt %%xcc, 1f\n"	\
+				     "membar #StoreLoad\n"	\
+				     "1:\n":::"memory")
+#else
+#define mb()		asm volatile("":::"memory")
+#endif
+#define wmb()		asm volatile("":::"memory")
+#define rmb()		asm volatile("":::"memory")
+#define CPUINFO_PROC	"cpu"
+#endif
+
+#ifdef __alpha__
+#define mb()		asm volatile("mb" ::: "memory")
+#define wmb()		asm volatile("wmb" ::: "memory")
+#define rmb()		asm volatile("mb" ::: "memory")
+#define CPUINFO_PROC	"cpu model"
+#endif
+
+#ifdef __ia64__
+#define mb()		asm volatile ("mf" ::: "memory")
+#define wmb()		asm volatile ("mf" ::: "memory")
+#define rmb()		asm volatile ("mf" ::: "memory")
+#define cpu_relax()	asm volatile ("hint @pause" ::: "memory")
+#define CPUINFO_PROC	"model name"
+#endif
+
+#ifdef __arm__
+/*
+ * Use the __kuser_memory_barrier helper in the CPU helper page. See
+ * arch/arm/kernel/entry-armv.S in the kernel source for details.
+ */
+#define mb()		((void(*)(void))0xffff0fa0)()
+#define wmb()		((void(*)(void))0xffff0fa0)()
+#define rmb()		((void(*)(void))0xffff0fa0)()
+#define CPUINFO_PROC	"Processor"
+#endif
+
+#ifdef __aarch64__
+#define mb()		asm volatile("dmb ish" ::: "memory")
+#define wmb()		asm volatile("dmb ishst" ::: "memory")
+#define rmb()		asm volatile("dmb ishld" ::: "memory")
+#define cpu_relax()	asm volatile("yield" ::: "memory")
+#endif
+
+#ifdef __mips__
+#define mb()		asm volatile(					\
+				".set	mips2\n\t"			\
+				"sync\n\t"				\
+				".set	mips0"				\
+				: /* no output */			\
+				: /* no input */			\
+				: "memory")
+#define wmb()	mb()
+#define rmb()	mb()
+#define CPUINFO_PROC	"cpu model"
+#endif
+
+#ifdef __arc__
+#define mb()		asm volatile("" ::: "memory")
+#define wmb()		asm volatile("" ::: "memory")
+#define rmb()		asm volatile("" ::: "memory")
+#define CPUINFO_PROC	"Processor"
+#endif
+
+#ifdef __metag__
+#define mb()		asm volatile("" ::: "memory")
+#define wmb()		asm volatile("" ::: "memory")
+#define rmb()		asm volatile("" ::: "memory")
+#define CPUINFO_PROC	"CPU"
+#endif
+
+#ifdef __xtensa__
+#define mb()		asm volatile("memw" ::: "memory")
+#define wmb()		asm volatile("memw" ::: "memory")
+#define rmb()		asm volatile("" ::: "memory")
+#define CPUINFO_PROC	"core ID"
+#endif
+
+#ifdef __tile__
+#define mb()		asm volatile ("mf" ::: "memory")
+#define wmb()		asm volatile ("mf" ::: "memory")
+#define rmb()		asm volatile ("mf" ::: "memory")
+#define cpu_relax()	asm volatile ("mfspr zero, PASS" ::: "memory")
+#define CPUINFO_PROC    "model name"
+#endif
+
+#define barrier() asm volatile ("" ::: "memory")
+
+#ifndef cpu_relax
+#define cpu_relax() barrier()
+#endif
+
+#endif /* _PERF_SYS_H */
tools/perf/perf.h +1 -164

174 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author reviewer
#13 lore raw

PATCH 12/12 perf tools: Move ACCESS_ONCE from perf.h header

In reply to Jiri Olsa

Into tools/include/linux/compiler.h header.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/include/linux/compiler.h | 2 ++
 tools/perf/perf.h              | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/include/linux/compiler.h +2 -0
index fbc6665..88461f0 100644
@@ -35,4 +35,6 @@
 # define unlikely(x)		__builtin_expect(!!(x), 0)
 #endif
 
+#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+
 #endif /* _TOOLS_LINUX_COMPILER_H */
tools/perf/perf.h +0 -2
index 813571b..510c65f 100644
@@ -14,8 +14,6 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 #define HAVE_ATTR_TEST
 #include "perf-sys.h"
 
-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
-
 #ifndef NSEC_PER_SEC
 # define NSEC_PER_SEC			1000000000ULL
 #endif
Signature · 1 line
1.8.3.1
author reviewer
#12 lore raw

PATCH 11/12 perf tools: Move sys_perf_event_open function from perf.h

In reply to Jiri Olsa

Into perf-sys.h header, as requested by Peter:
http://lkml.kernel.org/r/[email protected]

Adding HAVE_ATTR_TEST define to turn off/on the attribute test code in the sys_perf_event_open function.

---
 tools/perf/perf-sys.h | 22 ++++++++++++++++++++++
 tools/perf/perf.h     | 40 +++++++++++-----------------------------
 2 files changed, 33 insertions(+), 29 deletions(-)
tools/perf/perf-sys.h +22 -0
index 4c22c2a..5268a14 100644
@@ -1,6 +1,11 @@
 #ifndef _PERF_SYS_H
 #define _PERF_SYS_H
 
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <linux/types.h>
+#include <linux/perf_event.h>
 #include <asm/unistd.h>
 
 #if defined(__i386__)
@@ -165,4 +170,21 @@
 #define cpu_relax() barrier()
 #endif
 
+static inline int
+sys_perf_event_open(struct perf_event_attr *attr,
+		      pid_t pid, int cpu, int group_fd,
+		      unsigned long flags)
+{
+	int fd;
+
+	fd = syscall(__NR_perf_event_open, attr, pid, cpu,
+		     group_fd, flags);
+
+#ifdef HAVE_ATTR_TEST
+	if (unlikely(test_attr__enabled))
+		test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+#endif
+	return fd;
+}
+
 #endif /* _PERF_SYS_H */
tools/perf/perf.h +11 -29
index ee95965..813571b 100644
@@ -1,18 +1,21 @@
 #ifndef _PERF_PERF_H
 #define _PERF_PERF_H
 
-#include "perf-sys.h"
-
-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
-
 #include <time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-
+#include <stdbool.h>
 #include <linux/types.h>
 #include <linux/perf_event.h>
 
+extern bool test_attr__enabled;
+void test_attr__init(void);
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+		     int fd, int group_fd, unsigned long flags);
+
+#define HAVE_ATTR_TEST
+#include "perf-sys.h"
+
+#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+
 #ifndef NSEC_PER_SEC
 # define NSEC_PER_SEC			1000000000ULL
 #endif
@@ -28,27 +31,6 @@ static inline unsigned long long rdclock(void)
 	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
 }
 
-extern bool test_attr__enabled;
-void test_attr__init(void);
-void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
-		     int fd, int group_fd, unsigned long flags);
-
-static inline int
-sys_perf_event_open(struct perf_event_attr *attr,
-		      pid_t pid, int cpu, int group_fd,
-		      unsigned long flags)
-{
-	int fd;
-
-	fd = syscall(__NR_perf_event_open, attr, pid, cpu,
-		     group_fd, flags);
-
-	if (unlikely(test_attr__enabled))
-		test_attr__open(attr, pid, cpu, fd, group_fd, flags);
-
-	return fd;
-}
-
 #define MAX_NR_CPUS			256
 
 extern const char *input_name;
Signature · 1 line
1.8.3.1
author reviewer
#6 lore raw

PATCH 5/12 perf tools: Remove min define from perf.h

In reply to Jiri Olsa

It's defined in tools/perf/util/include/linux/kernel.h header.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h | 6 ------
 1 file changed, 6 deletions(-)
tools/perf/perf.h +0 -6
index a547f38..50aa88d 100644
@@ -203,12 +203,6 @@ static inline unsigned long long rdclock(void)
  */
 #define asmlinkage
 
-#define min(x, y) ({				\
-	typeof(x) _min1 = (x);			\
-	typeof(y) _min2 = (y);			\
-	(void) (&_min1 == &_min2);		\
-	_min1 < _min2 ? _min1 : _min2; })
-
 extern bool test_attr__enabled;
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
Signature · 1 line
1.8.3.1
author reviewer
#5 lore raw

PATCH 4/12 perf tools: Remove unlikely define from perf.h

In reply to Jiri Olsa

It's defined in tools/include/linux/compiler.h header.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/perf.h | 1 -
 1 file changed, 1 deletion(-)
tools/perf/perf.h +0 -1
index 3bea2e6..a547f38 100644
@@ -203,7 +203,6 @@ static inline unsigned long long rdclock(void)
  */
 #define asmlinkage
 
-#define unlikely(x)	__builtin_expect(!!(x), 0)
 #define min(x, y) ({				\
 	typeof(x) _min1 = (x);			\
 	typeof(y) _min2 = (y);			\
Signature · 1 line
1.8.3.1
author reviewer
#2 lore raw

PATCH 1/12 tools: Unify export.h

In reply to Jiri Olsa

From: Borislav Petkov <[email protected]>

So tools/ has been growing three, at a different stage of their development export.h headers and so we should unite into one. Add tools/include/ to the include path of virtio and liblockdep to pick the shared header now.

---
 tools/include/linux/export.h              | 10 ++++++++++
 tools/lib/lockdep/Makefile                |  2 +-
 tools/lib/lockdep/uinclude/linux/export.h |  7 -------
 tools/perf/MANIFEST                       |  1 +
 tools/perf/Makefile.perf                  |  2 +-
 tools/perf/util/include/linux/export.h    |  6 ------
 tools/virtio/Makefile                     |  2 +-
 tools/virtio/linux/export.h               |  5 -----
 8 files changed, 14 insertions(+), 21 deletions(-)
 create mode 100644 tools/include/linux/export.h
 delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
 delete mode 100644 tools/perf/util/include/linux/export.h
 delete mode 100644 tools/virtio/linux/export.h
tools/include/linux/export.h new file +10 -0
new file mode 100644
index 0000000..d07e586
@@ -0,0 +1,10 @@
+#ifndef _TOOLS_LINUX_EXPORT_H_
+#define _TOOLS_LINUX_EXPORT_H_
+
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+
+#endif
tools/lib/lockdep/Makefile +1 -1
index cb09d3f..85ef05d 100644
@@ -105,7 +105,7 @@ N		=
 
 export Q VERBOSE
 
-INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES)
+INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES)
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
tools/lib/lockdep/uinclude/linux/export.h deleted +0 -7
deleted file mode 100644
index 6bdf349..0000000
@@ -1,7 +0,0 @@
-#ifndef _LIBLOCKDEP_LINUX_EXPORT_H_
-#define _LIBLOCKDEP_LINUX_EXPORT_H_
-
-#define EXPORT_SYMBOL(sym)
-#define EXPORT_SYMBOL_GPL(sym)
-
-#endif
tools/perf/MANIFEST +1 -0
index c0c87c8..81783c2 100644
@@ -7,6 +7,7 @@ tools/lib/symbol/kallsyms.h
 tools/include/asm/bug.h
 tools/include/linux/compiler.h
 tools/include/linux/hash.h
+tools/include/linux/export.h
 include/linux/const.h
 include/linux/perf_event.h
 include/linux/rbtree.h
tools/perf/Makefile.perf +1 -1
index 5e21aad..bd11e8a 100644
@@ -222,7 +222,7 @@ LIB_H += util/include/linux/const.h
 LIB_H += util/include/linux/ctype.h
 LIB_H += util/include/linux/kernel.h
 LIB_H += util/include/linux/list.h
-LIB_H += util/include/linux/export.h
+LIB_H += ../include/linux/export.h
 LIB_H += util/include/linux/poison.h
 LIB_H += util/include/linux/rbtree.h
 LIB_H += util/include/linux/rbtree_augmented.h
tools/perf/util/include/linux/export.h deleted +0 -6
deleted file mode 100644
index b43e2dc..0000000
@@ -1,6 +0,0 @@
-#ifndef PERF_LINUX_MODULE_H
-#define PERF_LINUX_MODULE_H
-
-#define EXPORT_SYMBOL(name)
-
-#endif
tools/virtio/Makefile +1 -1
index 3187c62..9325f46 100644
@@ -3,7 +3,7 @@ test: virtio_test vringh_test
 virtio_test: virtio_ring.o virtio_test.o
 vringh_test: vringh_test.o vringh.o virtio_ring.o
 
-CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
+CFLAGS += -g -O2 -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
 vpath %.c ../../drivers/virtio ../../drivers/vhost
 mod:
 	${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test
tools/virtio/linux/export.h deleted +0 -5
deleted file mode 100644
index 7311d32..0000000
@@ -1,5 +0,0 @@
-#define EXPORT_SYMBOL(sym)
-#define EXPORT_SYMBOL_GPL(sym)
-#define EXPORT_SYMBOL_GPL_FUTURE(sym)
-#define EXPORT_UNUSED_SYMBOL(sym)
-#define EXPORT_UNUSED_SYMBOL_GPL(sym)
Signature · 1 line
1.8.3.1
#14 lore raw
In reply to Jiri Olsa
Quoted 98 lines · Jiri Olsa

hi Ingo,
please consider pulling

thanks,
jirka

The following changes since commit 3617660e4e1618a888a2e3a4067224534302cb33:

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core (2014-05-01 08:24:59 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo

for you to fetch changes up to 73a31b7c6a85e2f033524058bad5bce900e4f2ed:

perf tools: Move ACCESS_ONCE from perf.h header (2014-05-05 17:49:07 +0200)

----------------------------------------------------------------
perf/core improvements and fixes:

. Cleanups for perf.h header (Jiri Olsa)

. Consolidate types.h and export.h within tools (Borislav Petkov)

----------------------------------------------------------------
Borislav Petkov (2):
tools: Unify export.h
tools: Consolidate types.h

Jiri Olsa (10):
perf tools: Remove MAX_COUNTERS define from perf.h perf tools: Remove unlikely define from perf.h
perf tools: Remove min define from perf.h
perf tools: Remove asmlinkage define from perf.h perf tools: Remove PR_TASK_PERF_EVENTS_* from perf.h perf tools: Move sample data structures from perf.h perf tools: Move perf_call_graph_mode enum from perf.h perf tools: Move syscall and arch specific defines from perf.h perf tools: Move sys_perf_event_open function from perf.h perf tools: Move ACCESS_ONCE from perf.h header

 tools/include/linux/compiler.h                     |   2 +
 tools/{virtio => include}/linux/export.h           |   5 +
 .../lockdep/uinclude => include}/linux/types.h     |  29 ++-
 tools/lib/lockdep/Makefile                         |   2 +-
 tools/lib/lockdep/uinclude/linux/export.h          |   7 -
 tools/perf/MANIFEST                                |   2 +
 tools/perf/Makefile.perf                           |   5 +-
 tools/perf/arch/x86/include/perf_regs.h            |   2 +-
 tools/perf/arch/x86/util/tsc.c                     |   2 +-
 tools/perf/arch/x86/util/tsc.h                     |   2 +-
 tools/perf/perf-sys.h                              | 190 +++++++++++++++
 tools/perf/perf.h                                  | 254 +--------------------
 tools/perf/tests/attr.c                            |   7 -
 tools/perf/tests/code-reading.c                    |   3 +-
 tools/perf/tests/dso-data.c                        |   2 +-
 tools/perf/tests/dwarf-unwind.c                    |   2 +-
 tools/perf/tests/keep-tracking.c                   |   2 +-
 tools/perf/tests/parse-no-sample-id-all.c          |   2 +-
 tools/perf/tests/perf-time-to-tsc.c                |   3 +-
 tools/perf/tests/rdpmc.c                           |   2 +-
 tools/perf/tests/sample-parsing.c                  |   2 +-
 tools/perf/ui/browser.h                            |   4 +-
 tools/perf/ui/progress.h                           |   2 +-
 tools/perf/util/annotate.h                         |   2 +-
 tools/perf/util/build-id.h                         |   2 +-
 tools/perf/util/callchain.h                        |   7 +
 tools/perf/util/dso.h                              |   2 +-
 tools/perf/util/event.h                            |  24 ++
 tools/perf/util/evsel.h                            |   4 +-
 tools/perf/util/header.h                           |   4 +-
 tools/perf/util/include/linux/bitmap.h             |   3 +
 tools/perf/util/include/linux/export.h             |   6 -
 tools/perf/util/include/linux/list.h               |   1 +
 tools/perf/util/include/linux/types.h              |  29 ---
 tools/perf/util/map.h                              |   2 +-
 tools/perf/util/parse-events.h                     |   3 +-
 tools/perf/util/parse-events.y                     |   2 +-
 tools/perf/util/perf_regs.h                        |   2 +-
 tools/perf/util/pmu.h                              |   2 +-
 tools/perf/util/stat.h                             |   2 +-
 tools/perf/util/svghelper.c                        |   2 +-
 tools/perf/util/svghelper.h                        |   2 +-
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/top.h                              |   2 +-
 tools/perf/util/types.h                            |  19 --
 tools/perf/util/unwind-libdw.c                     |   2 +-
 tools/perf/util/unwind.h                           |   2 +-
 tools/perf/util/util.h                             |   2 +-
 tools/perf/util/values.h                           |   2 +-
 tools/virtio/Makefile                              |   2 +-
 tools/virtio/linux/kernel.h                        |   7 -
 tools/virtio/linux/types.h                         |  28 ---
 52 files changed, 304 insertions(+), 397 deletions(-)
Quoted 8 lines
 rename tools/{virtio => include}/linux/export.h (70%)
 rename tools/{lib/lockdep/uinclude => include}/linux/types.h (63%)
 delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
 create mode 100644 tools/perf/perf-sys.h
 delete mode 100644 tools/perf/util/include/linux/export.h
 delete mode 100644 tools/perf/util/include/linux/types.h
 delete mode 100644 tools/perf/util/types.h
 delete mode 100644 tools/virtio/linux/types.h

Pulled, thanks a lot Jiri!

Ingo