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
Unified · Split
| @@ -679,6 +679,7 @@ enum perf_event_type { · 678 unmodified lines | ||
| 679 | 679 | * |
| 680 | 680 | * { u64 weight; } && PERF_SAMPLE_WEIGHT |
| 681 | 681 | * { u64 data_src; } && PERF_SAMPLE_DATA_SRC |
| 682 | + * { u64 transaction; } && PERF_SAMPLE_TRANSACTION | |
| 682 | 683 | * }; |
| 683 | 684 | */ |
| 684 | 685 | PERF_RECORD_SAMPLE = 9, |
| @@ -1396,6 +1396,8 @@ event_sched_out(struct perf_event *event, · 1395 unmodified lines | ||
| 1396 | 1396 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
| 1397 | 1397 | return; |
| 1398 | 1398 | |
| 1399 | + perf_pmu_disable(event->pmu); | |
| 1400 | + | |
| 1399 | 1401 | event->state = PERF_EVENT_STATE_INACTIVE; |
| 1400 | 1402 | if (event->pending_disable) { |
| 1401 | 1403 | event->pending_disable = 0; |
| @@ -1412,6 +1414,8 @@ event_sched_out(struct perf_event *event, · 10 unmodified lines | ||
| 1412 | 1414 | ctx->nr_freq--; |
| 1413 | 1415 | if (event->attr.exclusive || !cpuctx->active_oncpu) |
| 1414 | 1416 | cpuctx->exclusive = 0; |
| 1417 | + | |
| 1418 | + perf_pmu_enable(event->pmu); | |
| 1415 | 1419 | } |
| 1416 | 1420 | |
| 1417 | 1421 | static void |
| @@ -1652,6 +1656,7 @@ event_sched_in(struct perf_event *event, · 234 unmodified lines | ||
| 1652 | 1656 | struct perf_event_context *ctx) |
| 1653 | 1657 | { |
| 1654 | 1658 | u64 tstamp = perf_event_time(event); |
| 1659 | + int ret = 0; | |
| 1655 | 1660 | |
| 1656 | 1661 | if (event->state <= PERF_EVENT_STATE_OFF) |
| 1657 | 1662 | return 0; |
| @@ -1674,10 +1679,13 @@ event_sched_in(struct perf_event *event, · 16 unmodified lines | ||
| 1674 | 1679 | */ |
| 1675 | 1680 | smp_wmb(); |
| 1676 | 1681 | |
| 1682 | + perf_pmu_disable(event->pmu); | |
| 1683 | + | |
| 1677 | 1684 | if (event->pmu->add(event, PERF_EF_START)) { |
| 1678 | 1685 | event->state = PERF_EVENT_STATE_INACTIVE; |
| 1679 | 1686 | event->oncpu = -1; |
| 1680 | − return -EAGAIN; | |
| 1687 | + ret = -EAGAIN; | |
| 1688 | + goto out; | |
| 1681 | 1689 | } |
| 1682 | 1690 | |
| 1683 | 1691 | event->tstamp_running += tstamp - event->tstamp_stopped; |
| @@ -1693,7 +1701,10 @@ event_sched_in(struct perf_event *event, · 9 unmodified lines | ||
| 1693 | 1701 | if (event->attr.exclusive) |
| 1694 | 1702 | cpuctx->exclusive = 1; |
| 1695 | 1703 | |
| 1696 | − return 0; | |
| 1704 | +out: | |
| 1705 | + perf_pmu_enable(event->pmu); | |
| 1706 | + | |
| 1707 | + return ret; | |
| 1697 | 1708 | } |
| 1698 | 1709 | |
| 1699 | 1710 | static int |
| @@ -2743,6 +2754,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 1043 unmodified lines | ||
| 2743 | 2754 | if (!event_filter_match(event)) |
| 2744 | 2755 | continue; |
| 2745 | 2756 | |
| 2757 | + perf_pmu_disable(event->pmu); | |
| 2758 | + | |
| 2746 | 2759 | hwc = &event->hw; |
| 2747 | 2760 | |
| 2748 | 2761 | if (hwc->interrupts == MAX_INTERRUPTS) { |
| @@ -2752,7 +2765,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 3 unmodified lines | ||
| 2752 | 2765 | } |
| 2753 | 2766 | |
| 2754 | 2767 | if (!event->attr.freq || !event->attr.sample_freq) |
| 2755 | − continue; | |
| 2768 | + goto next; | |
| 2756 | 2769 | |
| 2757 | 2770 | /* |
| 2758 | 2771 | * 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 | ||
| 2774 | 2787 | perf_adjust_period(event, period, delta, false); |
| 2775 | 2788 | |
| 2776 | 2789 | event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); |
| 2790 | + next: | |
| 2791 | + perf_pmu_enable(event->pmu); | |
| 2777 | 2792 | } |
| 2778 | 2793 | |
| 2779 | 2794 | perf_pmu_enable(ctx->pmu); |