History

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar: "An ABI documentation fix, and a mixed-PMU perf-info-corruption fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Document the new transaction sample type perf: Disable all pmus on unthrottling and rescheduling

Linus Torvalds committed 12 years ago

Commit 58cac3f2 parents 9b1be0f 189b84f2 files · +19 −3Browse files

Unified · Split

2 files
  1. include/uapi/linux/perf_event.h +1 −0
  2. kernel/events/core.c +18 −3
include/uapi/linux/perf_event.h+1−0
@@ -679,6 +679,7 @@ enum perf_event_type { · 678 unmodified lines
679679 *
680680 * { u64 weight; } && PERF_SAMPLE_WEIGHT
681681 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
682+ * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
682683 * };
683684 */
684685 PERF_RECORD_SAMPLE = 9,
kernel/events/core.c+18−3
@@ -1396,6 +1396,8 @@ event_sched_out(struct perf_event *event, · 1395 unmodified lines
13961396 if (event->state != PERF_EVENT_STATE_ACTIVE)
13971397 return;
13981398
1399+ perf_pmu_disable(event->pmu);
1400+
13991401 event->state = PERF_EVENT_STATE_INACTIVE;
14001402 if (event->pending_disable) {
14011403 event->pending_disable = 0;
@@ -1412,6 +1414,8 @@ event_sched_out(struct perf_event *event, · 10 unmodified lines
14121414 ctx->nr_freq--;
14131415 if (event->attr.exclusive || !cpuctx->active_oncpu)
14141416 cpuctx->exclusive = 0;
1417+
1418+ perf_pmu_enable(event->pmu);
14151419 }
14161420
14171421 static void
@@ -1652,6 +1656,7 @@ event_sched_in(struct perf_event *event, · 234 unmodified lines
16521656 struct perf_event_context *ctx)
16531657 {
16541658 u64 tstamp = perf_event_time(event);
1659+ int ret = 0;
16551660
16561661 if (event->state <= PERF_EVENT_STATE_OFF)
16571662 return 0;
@@ -1674,10 +1679,13 @@ event_sched_in(struct perf_event *event, · 16 unmodified lines
16741679 */
16751680 smp_wmb();
16761681
1682+ perf_pmu_disable(event->pmu);
1683+
16771684 if (event->pmu->add(event, PERF_EF_START)) {
16781685 event->state = PERF_EVENT_STATE_INACTIVE;
16791686 event->oncpu = -1;
1680− return -EAGAIN;
1687+ ret = -EAGAIN;
1688+ goto out;
16811689 }
16821690
16831691 event->tstamp_running += tstamp - event->tstamp_stopped;
@@ -1693,7 +1701,10 @@ event_sched_in(struct perf_event *event, · 9 unmodified lines
16931701 if (event->attr.exclusive)
16941702 cpuctx->exclusive = 1;
16951703
1696− return 0;
1704+out:
1705+ perf_pmu_enable(event->pmu);
1706+
1707+ return ret;
16971708 }
16981709
16991710 static int
@@ -2743,6 +2754,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 1043 unmodified lines
27432754 if (!event_filter_match(event))
27442755 continue;
27452756
2757+ perf_pmu_disable(event->pmu);
2758+
27462759 hwc = &event->hw;
27472760
27482761 if (hwc->interrupts == MAX_INTERRUPTS) {
@@ -2752,7 +2765,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 3 unmodified lines
27522765 }
27532766
27542767 if (!event->attr.freq || !event->attr.sample_freq)
2755− continue;
2768+ goto next;
27562769
27572770 /*
27582771 * stop the event and update event->count
@@ -2774,6 +2787,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 15 unmodified lines
27742787 perf_adjust_period(event, period, delta, false);
27752788
27762789 event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
2790+ next:
2791+ perf_pmu_enable(event->pmu);
27772792 }
27782793
27792794 perf_pmu_enable(ctx->pmu);