Pull perf fixes from Ingo Molnar: "This tree includes four core perf fixes for misc bugs, three fixes to x86 PMU drivers, and two updates to old email addresses" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Do not send exit event twice perf/x86/intel: Fix INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA macro perf/x86/intel: Make L1D_PEND_MISS.FB_FULL not constrained on Haswell perf: Fix PERF_EVENT_IOC_PERIOD deadlock treewide: Remove old email address perf/x86: Fix LBR call stack save/restore perf: Update email address in MAINTAINERS perf/core: Robustify the perf_cgroup_from_task() RCU checks perf/core: Fix RCU problem with cgroup context switching code
Unified · Split
| @@ -8286,7 +8286,7 @@ F: include/linux/delayacct.h · 8285 unmodified lines | |||
| 8286 | F: kernel/delayacct.c | 8286 | F: kernel/delayacct.c |
| 8287 | 8287 | ||
| 8288 | PERFORMANCE EVENTS SUBSYSTEM | 8288 | PERFORMANCE EVENTS SUBSYSTEM |
| 8289 | M: Peter Zijlstra <a.p.zijlstra@chello.nl> | 8289 | M: Peter Zijlstra <peterz@infradead.org> |
| 8290 | M: Ingo Molnar <mingo@redhat.com> | 8290 | M: Ingo Molnar <mingo@redhat.com> |
| 8291 | M: Arnaldo Carvalho de Melo <acme@kernel.org> | 8291 | M: Arnaldo Carvalho de Melo <acme@kernel.org> |
| 8292 | L: linux-kernel@vger.kernel.org | 8292 | L: linux-kernel@vger.kernel.org |
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 14 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 15 | * Copyright (C) 2009 Jaswinder Singh Rajput | 15 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 16 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 16 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 17 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 17 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 18 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 18 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 19 | * | 19 | * |
| 20 | * ppc: | 20 | * ppc: |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 10 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 11 | * Copyright (C) 2009 Jaswinder Singh Rajput | 11 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 12 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 12 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 13 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 13 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 14 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 14 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 15 | * | 15 | * |
| 16 | * ppc: | 16 | * ppc: |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 9 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 10 | * Copyright (C) 2009 Jaswinder Singh Rajput | 10 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 11 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 11 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 12 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 12 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/perf_event.h> | 15 | #include <linux/perf_event.h> |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 21 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 22 | * Copyright (C) 2009 Jaswinder Singh Rajput | 22 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 23 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 23 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 24 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 24 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 25 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 25 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 26 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 26 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 27 | */ | 27 | */ |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2009 Jaswinder Singh Rajput | 6 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 11 | * | 11 | * |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2009 Jaswinder Singh Rajput | 6 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 11 | * | 11 | * |
| @@ -387,7 +387,7 @@ struct cpu_hw_events { · 375 unmodified lines | |||
| 387 | /* Check flags and event code/umask, and set the HSW N/A flag */ | 387 | /* Check flags and event code/umask, and set the HSW N/A flag */ |
| 388 | #define INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(code, n) \ | 388 | #define INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(code, n) \ |
| 389 | __EVENT_CONSTRAINT(code, n, \ | 389 | __EVENT_CONSTRAINT(code, n, \ |
| 390 | INTEL_ARCH_EVENT_MASK|INTEL_ARCH_EVENT_MASK, \ | 390 | INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ |
| 391 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_NA_HSW) | 391 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_NA_HSW) |
| 392 | 392 | ||
| 393 | 393 | ||
| @@ -627,6 +627,7 @@ struct x86_perf_task_context { · 233 unmodified lines | |||
| 627 | u64 lbr_from[MAX_LBR_ENTRIES]; | 627 | u64 lbr_from[MAX_LBR_ENTRIES]; |
| 628 | u64 lbr_to[MAX_LBR_ENTRIES]; | 628 | u64 lbr_to[MAX_LBR_ENTRIES]; |
| 629 | u64 lbr_info[MAX_LBR_ENTRIES]; | 629 | u64 lbr_info[MAX_LBR_ENTRIES]; |
| 630 | int tos; | ||
| 630 | int lbr_callstack_users; | 631 | int lbr_callstack_users; |
| 631 | int lbr_stack_state; | 632 | int lbr_stack_state; |
| 632 | }; | 633 | }; |
| @@ -232,7 +232,7 @@ static struct event_constraint intel_hsw_event_constraints[] = { · 231 unmodified lines | |||
| 232 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 232 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 233 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 233 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| 234 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | 234 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
| 235 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.* */ | 235 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ |
| 236 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 236 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
| 237 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 237 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
| 238 | /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | 238 | /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ |
| @@ -298,7 +298,7 @@ static bool __match_event(struct perf_event *a, struct perf_event *b) · 297 unmodified lines | |||
| 298 | static inline struct perf_cgroup *event_to_cgroup(struct perf_event *event) | 298 | static inline struct perf_cgroup *event_to_cgroup(struct perf_event *event) |
| 299 | { | 299 | { |
| 300 | if (event->attach_state & PERF_ATTACH_TASK) | 300 | if (event->attach_state & PERF_ATTACH_TASK) |
| 301 | return perf_cgroup_from_task(event->hw.target); | 301 | return perf_cgroup_from_task(event->hw.target, event->ctx); |
| 302 | 302 | ||
| 303 | return event->cgrp; | 303 | return event->cgrp; |
| 304 | } | 304 | } |
| @@ -239,7 +239,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) · 238 unmodified lines | |||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | mask = x86_pmu.lbr_nr - 1; | 241 | mask = x86_pmu.lbr_nr - 1; |
| 242 | tos = intel_pmu_lbr_tos(); | 242 | tos = task_ctx->tos; |
| 243 | for (i = 0; i < tos; i++) { | 243 | for (i = 0; i < tos; i++) { |
| 244 | lbr_idx = (tos - i) & mask; | 244 | lbr_idx = (tos - i) & mask; |
| 245 | wrmsrl(x86_pmu.lbr_from + lbr_idx, task_ctx->lbr_from[i]); | 245 | wrmsrl(x86_pmu.lbr_from + lbr_idx, task_ctx->lbr_from[i]); |
| @@ -247,6 +247,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) · 1 unmodified line | |||
| 247 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) | 247 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
| 248 | wrmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); | 248 | wrmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
| 249 | } | 249 | } |
| 250 | wrmsrl(x86_pmu.lbr_tos, tos); | ||
| 250 | task_ctx->lbr_stack_state = LBR_NONE; | 251 | task_ctx->lbr_stack_state = LBR_NONE; |
| 251 | } | 252 | } |
| 252 | 253 | ||
| @@ -270,6 +271,7 @@ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx) · 17 unmodified lines | |||
| 270 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) | 271 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
| 271 | rdmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); | 272 | rdmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
| 272 | } | 273 | } |
| 274 | task_ctx->tos = tos; | ||
| 273 | task_ctx->lbr_stack_state = LBR_VALID; | 275 | task_ctx->lbr_stack_state = LBR_VALID; |
| 274 | } | 276 | } |
| 275 | 277 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * x86 specific code for irq_work | 2 | * x86 specific code for irq_work |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright 2001 Red Hat, Inc. | 5 | * Copyright 2001 Red Hat, Inc. |
| 6 | * Based on code from mm/memory.c Copyright Linus Torvalds and others. | 6 | * Based on code from mm/memory.c Copyright Linus Torvalds and others. |
| 7 | * | 7 | * |
| 8 | * Copyright 2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright 2011 Red Hat, Inc., Peter Zijlstra |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Jump label support | 5 | * Jump label support |
| 6 | * | 6 | * |
| 7 | * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com> | 7 | * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com> |
| 8 | * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 9 | * | 9 | * |
| 10 | * DEPRECATED API: | 10 | * DEPRECATED API: |
| 11 | * | 11 | * |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * Runtime locking correctness validator | 2 | * Runtime locking correctness validator |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 4 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | * see Documentation/locking/lockdep-design.txt for more details. | 7 | * see Documentation/locking/lockdep-design.txt for more details. |
| 8 | */ | 8 | */ |
| @@ -697,9 +697,11 @@ struct perf_cgroup { · 696 unmodified lines | |||
| 697 | * if there is no cgroup event for the current CPU context. | 697 | * if there is no cgroup event for the current CPU context. |
| 698 | */ | 698 | */ |
| 699 | static inline struct perf_cgroup * | 699 | static inline struct perf_cgroup * |
| 700 | perf_cgroup_from_task(struct task_struct *task) | 700 | perf_cgroup_from_task(struct task_struct *task, struct perf_event_context *ctx) |
| 701 | { | 701 | { |
| 702 | return container_of(task_css(task, perf_event_cgrp_id), | 702 | return container_of(task_css_check(task, perf_event_cgrp_id, |
| 703 | ctx ? lockdep_is_held(&ctx->lock) | ||
| 704 | : true), | ||
| 703 | struct perf_cgroup, css); | 705 | struct perf_cgroup, css); |
| 704 | } | 706 | } |
| 705 | #endif /* CONFIG_CGROUP_PERF */ | 707 | #endif /* CONFIG_CGROUP_PERF */ |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * FLoating proportions | 2 | * FLoating proportions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * This file contains the public data structure and API definitions. | 6 | * This file contains the public data structure and API definitions. |
| 7 | */ | 7 | */ |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | * Authors: | 21 | * Authors: |
| 22 | * Srikar Dronamraju | 22 | * Srikar Dronamraju |
| 23 | * Jim Keniston | 23 | * Jim Keniston |
| 24 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 24 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright � 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright � 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -435,7 +435,7 @@ static inline void update_cgrp_time_from_event(struct perf_event *event) · 425 unmodified lines | |||
| 435 | if (!is_cgroup_event(event)) | 435 | if (!is_cgroup_event(event)) |
| 436 | return; | 436 | return; |
| 437 | 437 | ||
| 438 | cgrp = perf_cgroup_from_task(current); | 438 | cgrp = perf_cgroup_from_task(current, event->ctx); |
| 439 | /* | 439 | /* |
| 440 | * Do not update time when cgroup is not active | 440 | * Do not update time when cgroup is not active |
| 441 | */ | 441 | */ |
| @@ -458,7 +458,7 @@ perf_cgroup_set_timestamp(struct task_struct *task, · 16 unmodified lines | |||
| 458 | if (!task || !ctx->nr_cgroups) | 458 | if (!task || !ctx->nr_cgroups) |
| 459 | return; | 459 | return; |
| 460 | 460 | ||
| 461 | cgrp = perf_cgroup_from_task(task); | 461 | cgrp = perf_cgroup_from_task(task, ctx); |
| 462 | info = this_cpu_ptr(cgrp->info); | 462 | info = this_cpu_ptr(cgrp->info); |
| 463 | info->timestamp = ctx->timestamp; | 463 | info->timestamp = ctx->timestamp; |
| 464 | } | 464 | } |
| @@ -489,7 +489,6 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 24 unmodified lines | |||
| 489 | * we reschedule only in the presence of cgroup | 489 | * we reschedule only in the presence of cgroup |
| 490 | * constrained events. | 490 | * constrained events. |
| 491 | */ | 491 | */ |
| 492 | rcu_read_lock(); | ||
| 493 | 492 | ||
| 494 | list_for_each_entry_rcu(pmu, &pmus, entry) { | 493 | list_for_each_entry_rcu(pmu, &pmus, entry) { |
| 495 | cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); | 494 | cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); |
| @@ -522,8 +521,10 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 26 unmodified lines | |||
| 522 | * set cgrp before ctxsw in to allow | 521 | * set cgrp before ctxsw in to allow |
| 523 | * event_filter_match() to not have to pass | 522 | * event_filter_match() to not have to pass |
| 524 | * task around | 523 | * task around |
| 524 | * we pass the cpuctx->ctx to perf_cgroup_from_task() | ||
| 525 | * because cgorup events are only per-cpu | ||
| 525 | */ | 526 | */ |
| 526 | cpuctx->cgrp = perf_cgroup_from_task(task); | 527 | cpuctx->cgrp = perf_cgroup_from_task(task, &cpuctx->ctx); |
| 527 | cpu_ctx_sched_in(cpuctx, EVENT_ALL, task); | 528 | cpu_ctx_sched_in(cpuctx, EVENT_ALL, task); |
| 528 | } | 529 | } |
| 529 | perf_pmu_enable(cpuctx->ctx.pmu); | 530 | perf_pmu_enable(cpuctx->ctx.pmu); |
| @@ -531,8 +532,6 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 1 unmodified line | |||
| 531 | } | 532 | } |
| 532 | } | 533 | } |
| 533 | 534 | ||
| 534 | rcu_read_unlock(); | ||
| 535 | |||
| 536 | local_irq_restore(flags); | 535 | local_irq_restore(flags); |
| 537 | } | 536 | } |
| 538 | 537 | ||
| @@ -542,17 +541,20 @@ static inline void perf_cgroup_sched_out(struct task_struct *task, · 3 unmodified lines | |||
| 542 | struct perf_cgroup *cgrp1; | 541 | struct perf_cgroup *cgrp1; |
| 543 | struct perf_cgroup *cgrp2 = NULL; | 542 | struct perf_cgroup *cgrp2 = NULL; |
| 544 | 543 | ||
| 544 | rcu_read_lock(); | ||
| 545 | /* | 545 | /* |
| 546 | * we come here when we know perf_cgroup_events > 0 | 546 | * we come here when we know perf_cgroup_events > 0 |
| 547 | * we do not need to pass the ctx here because we know | ||
| 548 | * we are holding the rcu lock | ||
| 547 | */ | 549 | */ |
| 548 | cgrp1 = perf_cgroup_from_task(task); | 550 | cgrp1 = perf_cgroup_from_task(task, NULL); |
| 549 | 551 | ||
| 550 | /* | 552 | /* |
| 551 | * next is NULL when called from perf_event_enable_on_exec() | 553 | * next is NULL when called from perf_event_enable_on_exec() |
| 552 | * that will systematically cause a cgroup_switch() | 554 | * that will systematically cause a cgroup_switch() |
| 553 | */ | 555 | */ |
| 554 | if (next) | 556 | if (next) |
| 555 | cgrp2 = perf_cgroup_from_task(next); | 557 | cgrp2 = perf_cgroup_from_task(next, NULL); |
| 556 | 558 | ||
| 557 | /* | 559 | /* |
| 558 | * only schedule out current cgroup events if we know | 560 | * only schedule out current cgroup events if we know |
| @@ -561,6 +563,8 @@ static inline void perf_cgroup_sched_out(struct task_struct *task, · 2 unmodified lines | |||
| 561 | */ | 563 | */ |
| 562 | if (cgrp1 != cgrp2) | 564 | if (cgrp1 != cgrp2) |
| 563 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT); | 565 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT); |
| 566 | |||
| 567 | rcu_read_unlock(); | ||
| 564 | } | 568 | } |
| 565 | 569 | ||
| 566 | static inline void perf_cgroup_sched_in(struct task_struct *prev, | 570 | static inline void perf_cgroup_sched_in(struct task_struct *prev, |
| @@ -569,13 +573,16 @@ static inline void perf_cgroup_sched_in(struct task_struct *prev, · 2 unmodified lines | |||
| 569 | struct perf_cgroup *cgrp1; | 573 | struct perf_cgroup *cgrp1; |
| 570 | struct perf_cgroup *cgrp2 = NULL; | 574 | struct perf_cgroup *cgrp2 = NULL; |
| 571 | 575 | ||
| 576 | rcu_read_lock(); | ||
| 572 | /* | 577 | /* |
| 573 | * we come here when we know perf_cgroup_events > 0 | 578 | * we come here when we know perf_cgroup_events > 0 |
| 579 | * we do not need to pass the ctx here because we know | ||
| 580 | * we are holding the rcu lock | ||
| 574 | */ | 581 | */ |
| 575 | cgrp1 = perf_cgroup_from_task(task); | 582 | cgrp1 = perf_cgroup_from_task(task, NULL); |
| 576 | 583 | ||
| 577 | /* prev can never be NULL */ | 584 | /* prev can never be NULL */ |
| 578 | cgrp2 = perf_cgroup_from_task(prev); | 585 | cgrp2 = perf_cgroup_from_task(prev, NULL); |
| 579 | 586 | ||
| 580 | /* | 587 | /* |
| 581 | * only need to schedule in cgroup events if we are changing | 588 | * only need to schedule in cgroup events if we are changing |
| @@ -584,6 +591,8 @@ static inline void perf_cgroup_sched_in(struct task_struct *prev, · 2 unmodified lines | |||
| 584 | */ | 591 | */ |
| 585 | if (cgrp1 != cgrp2) | 592 | if (cgrp1 != cgrp2) |
| 586 | perf_cgroup_switch(task, PERF_CGROUP_SWIN); | 593 | perf_cgroup_switch(task, PERF_CGROUP_SWIN); |
| 594 | |||
| 595 | rcu_read_unlock(); | ||
| 587 | } | 596 | } |
| 588 | 597 | ||
| 589 | static inline int perf_cgroup_connect(int fd, struct perf_event *event, | 598 | static inline int perf_cgroup_connect(int fd, struct perf_event *event, |
| @@ -4216,7 +4225,14 @@ retry: · 3626 unmodified lines | |||
| 4216 | goto retry; | 4225 | goto retry; |
| 4217 | } | 4226 | } |
| 4218 | 4227 | ||
| 4219 | __perf_event_period(&pe); | 4228 | if (event->attr.freq) { |
| 4229 | event->attr.sample_freq = value; | ||
| 4230 | } else { | ||
| 4231 | event->attr.sample_period = value; | ||
| 4232 | event->hw.sample_period = value; | ||
| 4233 | } | ||
| 4234 | |||
| 4235 | local64_set(&event->hw.period_left, 0); | ||
| 4220 | raw_spin_unlock_irq(&ctx->lock); | 4236 | raw_spin_unlock_irq(&ctx->lock); |
| 4221 | 4237 | ||
| 4222 | return 0; | 4238 | return 0; |
| @@ -5666,6 +5682,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx, · 1443 unmodified lines | |||
| 5666 | } | 5682 | } |
| 5667 | } | 5683 | } |
| 5668 | 5684 | ||
| 5685 | static void | ||
| 5686 | perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data, | ||
| 5687 | struct perf_event_context *task_ctx) | ||
| 5688 | { | ||
| 5689 | rcu_read_lock(); | ||
| 5690 | preempt_disable(); | ||
| 5691 | perf_event_aux_ctx(task_ctx, output, data); | ||
| 5692 | preempt_enable(); | ||
| 5693 | rcu_read_unlock(); | ||
| 5694 | } | ||
| 5695 | |||
| 5669 | static void | 5696 | static void |
| 5670 | perf_event_aux(perf_event_aux_output_cb output, void *data, | 5697 | perf_event_aux(perf_event_aux_output_cb output, void *data, |
| 5671 | struct perf_event_context *task_ctx) | 5698 | struct perf_event_context *task_ctx) |
| @@ -5675,14 +5702,23 @@ perf_event_aux(perf_event_aux_output_cb output, void *data, · 3 unmodified lines | |||
| 5675 | struct pmu *pmu; | 5702 | struct pmu *pmu; |
| 5676 | int ctxn; | 5703 | int ctxn; |
| 5677 | 5704 | ||
| 5705 | /* | ||
| 5706 | * If we have task_ctx != NULL we only notify | ||
| 5707 | * the task context itself. The task_ctx is set | ||
| 5708 | * only for EXIT events before releasing task | ||
| 5709 | * context. | ||
| 5710 | */ | ||
| 5711 | if (task_ctx) { | ||
| 5712 | perf_event_aux_task_ctx(output, data, task_ctx); | ||
| 5713 | return; | ||
| 5714 | } | ||
| 5715 | |||
| 5678 | rcu_read_lock(); | 5716 | rcu_read_lock(); |
| 5679 | list_for_each_entry_rcu(pmu, &pmus, entry) { | 5717 | list_for_each_entry_rcu(pmu, &pmus, entry) { |
| 5680 | cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); | 5718 | cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); |
| 5681 | if (cpuctx->unique_pmu != pmu) | 5719 | if (cpuctx->unique_pmu != pmu) |
| 5682 | goto next; | 5720 | goto next; |
| 5683 | perf_event_aux_ctx(&cpuctx->ctx, output, data); | 5721 | perf_event_aux_ctx(&cpuctx->ctx, output, data); |
| 5684 | if (task_ctx) | ||
| 5685 | goto next; | ||
| 5686 | ctxn = pmu->task_ctx_nr; | 5722 | ctxn = pmu->task_ctx_nr; |
| 5687 | if (ctxn < 0) | 5723 | if (ctxn < 0) |
| 5688 | goto next; | 5724 | goto next; |
| @@ -5692,12 +5728,6 @@ perf_event_aux(perf_event_aux_output_cb output, void *data, · 3 unmodified lines | |||
| 5692 | next: | 5728 | next: |
| 5693 | put_cpu_ptr(pmu->pmu_cpu_context); | 5729 | put_cpu_ptr(pmu->pmu_cpu_context); |
| 5694 | } | 5730 | } |
| 5695 | |||
| 5696 | if (task_ctx) { | ||
| 5697 | preempt_disable(); | ||
| 5698 | perf_event_aux_ctx(task_ctx, output, data); | ||
| 5699 | preempt_enable(); | ||
| 5700 | } | ||
| 5701 | rcu_read_unlock(); | 5731 | rcu_read_unlock(); |
| 5702 | } | 5732 | } |
| 5703 | 5733 | ||
| @@ -8787,10 +8817,8 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn) · 3083 unmodified lines | |||
| 8787 | struct perf_event_context *child_ctx, *clone_ctx = NULL; | 8817 | struct perf_event_context *child_ctx, *clone_ctx = NULL; |
| 8788 | unsigned long flags; | 8818 | unsigned long flags; |
| 8789 | 8819 | ||
| 8790 | if (likely(!child->perf_event_ctxp[ctxn])) { | 8820 | if (likely(!child->perf_event_ctxp[ctxn])) |
| 8791 | perf_event_task(child, NULL, 0); | ||
| 8792 | return; | 8821 | return; |
| 8793 | } | ||
| 8794 | 8822 | ||
| 8795 | local_irq_save(flags); | 8823 | local_irq_save(flags); |
| 8796 | /* | 8824 | /* |
| @@ -8874,6 +8902,14 @@ void perf_event_exit_task(struct task_struct *child) · 77 unmodified lines | |||
| 8874 | 8902 | ||
| 8875 | for_each_task_context_nr(ctxn) | 8903 | for_each_task_context_nr(ctxn) |
| 8876 | perf_event_exit_task_context(child, ctxn); | 8904 | perf_event_exit_task_context(child, ctxn); |
| 8905 | |||
| 8906 | /* | ||
| 8907 | * The perf_event_exit_task_context calls perf_event_task | ||
| 8908 | * with child's task_ctx, which generates EXIT events for | ||
| 8909 | * child contexts and sets child->perf_event_ctxp[] to NULL. | ||
| 8910 | * At this point we need to send EXIT events to cpu contexts. | ||
| 8911 | */ | ||
| 8912 | perf_event_task(child, NULL, 0); | ||
| 8877 | } | 8913 | } |
| 8878 | 8914 | ||
| 8879 | static void perf_free_event(struct perf_event *event, | 8915 | static void perf_free_event(struct perf_event *event, |
| @@ -9452,7 +9488,9 @@ static void perf_cgroup_css_free(struct cgroup_subsys_state *css) · 572 unmodified lines | |||
| 9452 | static int __perf_cgroup_move(void *info) | 9488 | static int __perf_cgroup_move(void *info) |
| 9453 | { | 9489 | { |
| 9454 | struct task_struct *task = info; | 9490 | struct task_struct *task = info; |
| 9491 | rcu_read_lock(); | ||
| 9455 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT | PERF_CGROUP_SWIN); | 9492 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT | PERF_CGROUP_SWIN); |
| 9493 | rcu_read_unlock(); | ||
| 9456 | return 0; | 9494 | return 0; |
| 9457 | } | 9495 | } |
| 9458 | 9496 | ||
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | |||
| 19 | * Authors: | 19 | * Authors: |
| 20 | * Srikar Dronamraju | 20 | * Srikar Dronamraju |
| 21 | * Jim Keniston | 21 | * Jim Keniston |
| 22 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 22 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 2 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra |
| 3 | * | 3 | * |
| 4 | * Provides a framework for enqueueing and running callbacks from hardirq | 4 | * Provides a framework for enqueueing and running callbacks from hardirq |
| 5 | * context. The enqueueing is NMI-safe. | 5 | * context. The enqueueing is NMI-safe. |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * jump label support | 2 | * jump label support |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Jason Baron <jbaron@redhat.com> | 4 | * Copyright (C) 2009 Jason Baron <jbaron@redhat.com> |
| 5 | * Copyright (C) 2011 Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2011 Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | */ | 7 | */ |
| 8 | #include <linux/memory.h> | 8 | #include <linux/memory.h> |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 10 | * | 10 | * |
| 11 | * this code maps all the lock dependencies as they occur in a live kernel | 11 | * this code maps all the lock dependencies as they occur in a live kernel |
| 12 | * and will warn about the following classes of locking bugs: | 12 | * and will warn about the following classes of locking bugs: |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 10 | * | 10 | * |
| 11 | * Code for /proc/lockdep and /proc/lockdep_stats: | 11 | * Code for /proc/lockdep and /proc/lockdep_stats: |
| 12 | * | 12 | * |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * sched_clock for unstable cpu clocks | 2 | * sched_clock for unstable cpu clocks |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * Updates and enhancements: | 6 | * Updates and enhancements: |
| 7 | * Copyright (C) 2008 Red Hat, Inc. Steven Rostedt <srostedt@redhat.com> | 7 | * Copyright (C) 2008 Red Hat, Inc. Steven Rostedt <srostedt@redhat.com> |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | |||
| 17 | * Copyright (C) 2007, Thomas Gleixner <tglx@linutronix.de> | 17 | * Copyright (C) 2007, Thomas Gleixner <tglx@linutronix.de> |
| 18 | * | 18 | * |
| 19 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra | 19 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra |
| 20 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 20 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include <linux/latencytop.h> | 23 | #include <linux/latencytop.h> |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * trace event based perf event profiling/tracing | 2 | * trace event based perf event profiling/tracing |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Red Hat Inc, Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2009 Red Hat Inc, Peter Zijlstra |
| 5 | * Copyright (C) 2009-2010 Frederic Weisbecker <fweisbec@gmail.com> | 5 | * Copyright (C) 2009-2010 Frederic Weisbecker <fweisbec@gmail.com> |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2007-2008 Joern Engel <joern@logfs.org> | 6 | * Copyright (c) 2007-2008 Joern Engel <joern@logfs.org> |
| 7 | * Bits and pieces stolen from Peter Zijlstra's code, which is | 7 | * Bits and pieces stolen from Peter Zijlstra's code, which is |
| 8 | * Copyright 2007, Red Hat Inc. Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright 2007, Red Hat Inc. Peter Zijlstra |
| 9 | * GPLv2 | 9 | * GPLv2 |
| 10 | * | 10 | * |
| 11 | * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch | 11 | * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Floating proportions | 2 | * Floating proportions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * Description: | 6 | * Description: |
| 7 | * | 7 | * |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * mm/page-writeback.c | 2 | * mm/page-writeback.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2002, Linus Torvalds. | 4 | * Copyright (C) 2002, Linus Torvalds. |
| 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | * Contains functions related to writing back dirty pages at the | 7 | * Contains functions related to writing back dirty pages at the |
| 8 | * address_space level. | 8 | * address_space level. |