Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+19 -3
+1
include/uapi/linux/perf_event.h
··· 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,
+18 -3
kernel/events/core.c
··· 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; ··· 1414 1412 ctx->nr_freq--; 1415 1413 if (event->attr.exclusive || !cpuctx->active_oncpu) 1416 1414 cpuctx->exclusive = 0; 1415 + 1416 + perf_pmu_enable(event->pmu); 1417 1417 } 1418 1418 1419 1419 static void ··· 1656 1652 struct perf_event_context *ctx) 1657 1653 { 1658 1654 u64 tstamp = perf_event_time(event); 1655 + int ret = 0; 1659 1656 1660 1657 if (event->state <= PERF_EVENT_STATE_OFF) 1661 1658 return 0; ··· 1679 1674 */ 1680 1675 smp_wmb(); 1681 1676 1677 + perf_pmu_disable(event->pmu); 1678 + 1682 1679 if (event->pmu->add(event, PERF_EF_START)) { 1683 1680 event->state = PERF_EVENT_STATE_INACTIVE; 1684 1681 event->oncpu = -1; 1685 - return -EAGAIN; 1682 + ret = -EAGAIN; 1683 + goto out; 1686 1684 } 1687 1685 1688 1686 event->tstamp_running += tstamp - event->tstamp_stopped; ··· 1701 1693 if (event->attr.exclusive) 1702 1694 cpuctx->exclusive = 1; 1703 1695 1704 - return 0; 1696 + out: 1697 + perf_pmu_enable(event->pmu); 1698 + 1699 + return ret; 1705 1700 } 1706 1701 1707 1702 static int ··· 2754 2743 if (!event_filter_match(event)) 2755 2744 continue; 2756 2745 2746 + perf_pmu_disable(event->pmu); 2747 + 2757 2748 hwc = &event->hw; 2758 2749 2759 2750 if (hwc->interrupts == MAX_INTERRUPTS) { ··· 2765 2752 } 2766 2753 2767 2754 if (!event->attr.freq || !event->attr.sample_freq) 2768 - continue; 2755 + goto next; 2769 2756 2770 2757 /* 2771 2758 * stop the event and update event->count ··· 2787 2774 perf_adjust_period(event, period, delta, false); 2788 2775 2789 2776 event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); 2777 + next: 2778 + perf_pmu_enable(event->pmu); 2790 2779 } 2791 2780 2792 2781 perf_pmu_enable(ctx->pmu);