diff options
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_rapl.c | 1 | ||||
-rw-r--r-- | kernel/events/core.c | 41 | ||||
-rw-r--r-- | tools/lib/lockdep/Makefile | 3 | ||||
-rw-r--r-- | tools/lib/lockdep/uinclude/linux/kernel.h | 3 | ||||
-rw-r--r-- | tools/perf/Makefile | 2 |
6 files changed, 43 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 960e85de13fb..3998131d1a68 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1134,7 +1134,7 @@ static __initconst const u64 slm_hw_cache_extra_regs | |||
1134 | [ C(LL ) ] = { | 1134 | [ C(LL ) ] = { |
1135 | [ C(OP_READ) ] = { | 1135 | [ C(OP_READ) ] = { |
1136 | [ C(RESULT_ACCESS) ] = SLM_DMND_READ|SLM_LLC_ACCESS, | 1136 | [ C(RESULT_ACCESS) ] = SLM_DMND_READ|SLM_LLC_ACCESS, |
1137 | [ C(RESULT_MISS) ] = SLM_DMND_READ|SLM_LLC_MISS, | 1137 | [ C(RESULT_MISS) ] = 0, |
1138 | }, | 1138 | }, |
1139 | [ C(OP_WRITE) ] = { | 1139 | [ C(OP_WRITE) ] = { |
1140 | [ C(RESULT_ACCESS) ] = SLM_DMND_WRITE|SLM_LLC_ACCESS, | 1140 | [ C(RESULT_ACCESS) ] = SLM_DMND_WRITE|SLM_LLC_ACCESS, |
@@ -1184,8 +1184,7 @@ static __initconst const u64 slm_hw_cache_event_ids | |||
1184 | [ C(OP_READ) ] = { | 1184 | [ C(OP_READ) ] = { |
1185 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ | 1185 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ |
1186 | [ C(RESULT_ACCESS) ] = 0x01b7, | 1186 | [ C(RESULT_ACCESS) ] = 0x01b7, |
1187 | /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ | 1187 | [ C(RESULT_MISS) ] = 0, |
1188 | [ C(RESULT_MISS) ] = 0x01b7, | ||
1189 | }, | 1188 | }, |
1190 | [ C(OP_WRITE) ] = { | 1189 | [ C(OP_WRITE) ] = { |
1191 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ | 1190 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ |
@@ -1217,7 +1216,7 @@ static __initconst const u64 slm_hw_cache_event_ids | |||
1217 | [ C(ITLB) ] = { | 1216 | [ C(ITLB) ] = { |
1218 | [ C(OP_READ) ] = { | 1217 | [ C(OP_READ) ] = { |
1219 | [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P */ | 1218 | [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P */ |
1220 | [ C(RESULT_MISS) ] = 0x0282, /* ITLB.MISSES */ | 1219 | [ C(RESULT_MISS) ] = 0x40205, /* PAGE_WALKS.I_SIDE_WALKS */ |
1221 | }, | 1220 | }, |
1222 | [ C(OP_WRITE) ] = { | 1221 | [ C(OP_WRITE) ] = { |
1223 | [ C(RESULT_ACCESS) ] = -1, | 1222 | [ C(RESULT_ACCESS) ] = -1, |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index 999289b94025..358c54ad20d4 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | |||
@@ -722,6 +722,7 @@ static int __init rapl_pmu_init(void) | |||
722 | break; | 722 | break; |
723 | case 60: /* Haswell */ | 723 | case 60: /* Haswell */ |
724 | case 69: /* Haswell-Celeron */ | 724 | case 69: /* Haswell-Celeron */ |
725 | case 61: /* Broadwell */ | ||
725 | rapl_cntr_mask = RAPL_IDX_HSW; | 726 | rapl_cntr_mask = RAPL_IDX_HSW; |
726 | rapl_pmu_events_group.attrs = rapl_events_hsw_attr; | 727 | rapl_pmu_events_group.attrs = rapl_events_hsw_attr; |
727 | break; | 728 | break; |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 81aa3a4ece9f..1a3bf48743ce 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -913,10 +913,30 @@ static void put_ctx(struct perf_event_context *ctx) | |||
913 | * Those places that change perf_event::ctx will hold both | 913 | * Those places that change perf_event::ctx will hold both |
914 | * perf_event_ctx::mutex of the 'old' and 'new' ctx value. | 914 | * perf_event_ctx::mutex of the 'old' and 'new' ctx value. |
915 | * | 915 | * |
916 | * Lock ordering is by mutex address. There is one other site where | 916 | * Lock ordering is by mutex address. There are two other sites where |
917 | * perf_event_context::mutex nests and that is put_event(). But remember that | 917 | * perf_event_context::mutex nests and those are: |
918 | * that is a parent<->child context relation, and migration does not affect | 918 | * |
919 | * children, therefore these two orderings should not interact. | 919 | * - perf_event_exit_task_context() [ child , 0 ] |
920 | * __perf_event_exit_task() | ||
921 | * sync_child_event() | ||
922 | * put_event() [ parent, 1 ] | ||
923 | * | ||
924 | * - perf_event_init_context() [ parent, 0 ] | ||
925 | * inherit_task_group() | ||
926 | * inherit_group() | ||
927 | * inherit_event() | ||
928 | * perf_event_alloc() | ||
929 | * perf_init_event() | ||
930 | * perf_try_init_event() [ child , 1 ] | ||
931 | * | ||
932 | * While it appears there is an obvious deadlock here -- the parent and child | ||
933 | * nesting levels are inverted between the two. This is in fact safe because | ||
934 | * life-time rules separate them. That is an exiting task cannot fork, and a | ||
935 | * spawning task cannot (yet) exit. | ||
936 | * | ||
937 | * But remember that that these are parent<->child context relations, and | ||
938 | * migration does not affect children, therefore these two orderings should not | ||
939 | * interact. | ||
920 | * | 940 | * |
921 | * The change in perf_event::ctx does not affect children (as claimed above) | 941 | * The change in perf_event::ctx does not affect children (as claimed above) |
922 | * because the sys_perf_event_open() case will install a new event and break | 942 | * because the sys_perf_event_open() case will install a new event and break |
@@ -3657,9 +3677,6 @@ static void perf_remove_from_owner(struct perf_event *event) | |||
3657 | } | 3677 | } |
3658 | } | 3678 | } |
3659 | 3679 | ||
3660 | /* | ||
3661 | * Called when the last reference to the file is gone. | ||
3662 | */ | ||
3663 | static void put_event(struct perf_event *event) | 3680 | static void put_event(struct perf_event *event) |
3664 | { | 3681 | { |
3665 | struct perf_event_context *ctx; | 3682 | struct perf_event_context *ctx; |
@@ -3697,6 +3714,9 @@ int perf_event_release_kernel(struct perf_event *event) | |||
3697 | } | 3714 | } |
3698 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); | 3715 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); |
3699 | 3716 | ||
3717 | /* | ||
3718 | * Called when the last reference to the file is gone. | ||
3719 | */ | ||
3700 | static int perf_release(struct inode *inode, struct file *file) | 3720 | static int perf_release(struct inode *inode, struct file *file) |
3701 | { | 3721 | { |
3702 | put_event(file->private_data); | 3722 | put_event(file->private_data); |
@@ -7364,7 +7384,12 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event) | |||
7364 | return -ENODEV; | 7384 | return -ENODEV; |
7365 | 7385 | ||
7366 | if (event->group_leader != event) { | 7386 | if (event->group_leader != event) { |
7367 | ctx = perf_event_ctx_lock(event->group_leader); | 7387 | /* |
7388 | * This ctx->mutex can nest when we're called through | ||
7389 | * inheritance. See the perf_event_ctx_lock_nested() comment. | ||
7390 | */ | ||
7391 | ctx = perf_event_ctx_lock_nested(event->group_leader, | ||
7392 | SINGLE_DEPTH_NESTING); | ||
7368 | BUG_ON(!ctx); | 7393 | BUG_ON(!ctx); |
7369 | } | 7394 | } |
7370 | 7395 | ||
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index 0c356fb65022..18ffccf00426 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile | |||
@@ -14,9 +14,10 @@ define allow-override | |||
14 | $(eval $(1) = $(2))) | 14 | $(eval $(1) = $(2))) |
15 | endef | 15 | endef |
16 | 16 | ||
17 | # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. | 17 | # Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix. |
18 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) | 18 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) |
19 | $(call allow-override,AR,$(CROSS_COMPILE)ar) | 19 | $(call allow-override,AR,$(CROSS_COMPILE)ar) |
20 | $(call allow-override,LD,$(CROSS_COMPILE)ld) | ||
20 | 21 | ||
21 | INSTALL = install | 22 | INSTALL = install |
22 | 23 | ||
diff --git a/tools/lib/lockdep/uinclude/linux/kernel.h b/tools/lib/lockdep/uinclude/linux/kernel.h index a11e3c357be7..cd2cc59a5da7 100644 --- a/tools/lib/lockdep/uinclude/linux/kernel.h +++ b/tools/lib/lockdep/uinclude/linux/kernel.h | |||
@@ -28,6 +28,9 @@ | |||
28 | #define __init | 28 | #define __init |
29 | #define noinline | 29 | #define noinline |
30 | #define list_add_tail_rcu list_add_tail | 30 | #define list_add_tail_rcu list_add_tail |
31 | #define list_for_each_entry_rcu list_for_each_entry | ||
32 | #define barrier() | ||
33 | #define synchronize_sched() | ||
31 | 34 | ||
32 | #ifndef CALLER_ADDR0 | 35 | #ifndef CALLER_ADDR0 |
33 | #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 36 | #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index c699dc35eef9..d31a7bbd7cee 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -24,7 +24,7 @@ unexport MAKEFLAGS | |||
24 | # (To override it, run 'make JOBS=1' and similar.) | 24 | # (To override it, run 'make JOBS=1' and similar.) |
25 | # | 25 | # |
26 | ifeq ($(JOBS),) | 26 | ifeq ($(JOBS),) |
27 | JOBS := $(shell egrep -c '^processor|^CPU' /proc/cpuinfo 2>/dev/null) | 27 | JOBS := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) |
28 | ifeq ($(JOBS),0) | 28 | ifeq ($(JOBS),0) |
29 | JOBS := 1 | 29 | JOBS := 1 |
30 | endif | 30 | endif |