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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull perf fixes from Ingo Molnar:
"Misc kernel fixes: a virtualization environment related fix, an uncore
PMU driver removal handling fix, a PowerPC fix and new events for
Knights Landing"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86/intel: Honour the CPUID for number of fixed counters in hypervisors
perf/powerpc: Don't call perf_event_disable() from atomic context
perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic
perf/x86/intel/cstate: Add C-state residency events for Knights Landing

+52 -14
+1 -1
arch/powerpc/kernel/hw_breakpoint.c
··· 275 275 if (!stepped) { 276 276 WARN(1, "Unable to handle hardware breakpoint. Breakpoint at " 277 277 "0x%lx will be disabled.", info->address); 278 - perf_event_disable(bp); 278 + perf_event_disable_inatomic(bp); 279 279 goto out; 280 280 } 281 281 /*
+7 -3
arch/x86/events/intel/core.c
··· 3607 3607 3608 3608 /* 3609 3609 * Quirk: v2 perfmon does not report fixed-purpose events, so 3610 - * assume at least 3 events: 3610 + * assume at least 3 events, when not running in a hypervisor: 3611 3611 */ 3612 - if (version > 1) 3613 - x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3); 3612 + if (version > 1) { 3613 + int assume = 3 * !boot_cpu_has(X86_FEATURE_HYPERVISOR); 3614 + 3615 + x86_pmu.num_counters_fixed = 3616 + max((int)edx.split.num_counters_fixed, assume); 3617 + } 3614 3618 3615 3619 if (boot_cpu_has(X86_FEATURE_PDCM)) { 3616 3620 u64 capabilities;
+26 -4
arch/x86/events/intel/cstate.c
··· 48 48 * Scope: Core 49 49 * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter 50 50 * perf code: 0x02 51 - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,SKL 51 + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 52 + * SKL,KNL 52 53 * Scope: Core 53 54 * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter 54 55 * perf code: 0x03 ··· 57 56 * Scope: Core 58 57 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. 59 58 * perf code: 0x00 60 - * Available model: SNB,IVB,HSW,BDW,SKL 59 + * Available model: SNB,IVB,HSW,BDW,SKL,KNL 61 60 * Scope: Package (physical package) 62 61 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. 63 62 * perf code: 0x01 64 - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL 63 + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL 65 64 * Scope: Package (physical package) 66 65 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. 67 66 * perf code: 0x02 68 - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,SKL 67 + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 68 + * SKL,KNL 69 69 * Scope: Package (physical package) 70 70 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. 71 71 * perf code: 0x03 ··· 120 118 121 119 /* Quirk flags */ 122 120 #define SLM_PKG_C6_USE_C7_MSR (1UL << 0) 121 + #define KNL_CORE_C6_MSR (1UL << 1) 123 122 124 123 struct perf_cstate_msr { 125 124 u64 msr; ··· 491 488 .quirks = SLM_PKG_C6_USE_C7_MSR, 492 489 }; 493 490 491 + 492 + static const struct cstate_model knl_cstates __initconst = { 493 + .core_events = BIT(PERF_CSTATE_CORE_C6_RES), 494 + 495 + .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) | 496 + BIT(PERF_CSTATE_PKG_C3_RES) | 497 + BIT(PERF_CSTATE_PKG_C6_RES), 498 + .quirks = KNL_CORE_C6_MSR, 499 + }; 500 + 501 + 502 + 494 503 #define X86_CSTATES_MODEL(model, states) \ 495 504 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) &(states) } 496 505 ··· 538 523 539 524 X86_CSTATES_MODEL(INTEL_FAM6_SKYLAKE_MOBILE, snb_cstates), 540 525 X86_CSTATES_MODEL(INTEL_FAM6_SKYLAKE_DESKTOP, snb_cstates), 526 + 527 + X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNL, knl_cstates), 541 528 { }, 542 529 }; 543 530 MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); ··· 574 557 /* SLM has different MSR for PKG C6 */ 575 558 if (cm->quirks & SLM_PKG_C6_USE_C7_MSR) 576 559 pkg_msr[PERF_CSTATE_PKG_C6_RES].msr = MSR_PKG_C7_RESIDENCY; 560 + 561 + /* KNL has different MSR for CORE C6 */ 562 + if (cm->quirks & KNL_CORE_C6_MSR) 563 + pkg_msr[PERF_CSTATE_CORE_C6_RES].msr = MSR_KNL_CORE_C6_RESIDENCY; 564 + 577 565 578 566 has_cstate_core = cstate_probe_msr(cm->core_events, 579 567 PERF_CSTATE_CORE_EVENT_MAX,
+1
include/linux/perf_event.h
··· 1257 1257 extern void perf_event_enable(struct perf_event *event); 1258 1258 extern void perf_event_disable(struct perf_event *event); 1259 1259 extern void perf_event_disable_local(struct perf_event *event); 1260 + extern void perf_event_disable_inatomic(struct perf_event *event); 1260 1261 extern void perf_event_task_tick(void); 1261 1262 #else /* !CONFIG_PERF_EVENTS: */ 1262 1263 static inline void *
+17 -6
kernel/events/core.c
··· 1960 1960 } 1961 1961 EXPORT_SYMBOL_GPL(perf_event_disable); 1962 1962 1963 + void perf_event_disable_inatomic(struct perf_event *event) 1964 + { 1965 + event->pending_disable = 1; 1966 + irq_work_queue(&event->pending); 1967 + } 1968 + 1963 1969 static void perf_set_shadow_time(struct perf_event *event, 1964 1970 struct perf_event_context *ctx, 1965 1971 u64 tstamp) ··· 7081 7075 if (events && atomic_dec_and_test(&event->event_limit)) { 7082 7076 ret = 1; 7083 7077 event->pending_kill = POLL_HUP; 7084 - event->pending_disable = 1; 7085 - irq_work_queue(&event->pending); 7078 + 7079 + perf_event_disable_inatomic(event); 7086 7080 } 7087 7081 7088 7082 READ_ONCE(event->overflow_handler)(event, data, regs); ··· 8861 8855 8862 8856 void perf_pmu_unregister(struct pmu *pmu) 8863 8857 { 8858 + int remove_device; 8859 + 8864 8860 mutex_lock(&pmus_lock); 8861 + remove_device = pmu_bus_running; 8865 8862 list_del_rcu(&pmu->entry); 8866 8863 mutex_unlock(&pmus_lock); 8867 8864 ··· 8878 8869 free_percpu(pmu->pmu_disable_count); 8879 8870 if (pmu->type >= PERF_TYPE_MAX) 8880 8871 idr_remove(&pmu_idr, pmu->type); 8881 - if (pmu->nr_addr_filters) 8882 - device_remove_file(pmu->dev, &dev_attr_nr_addr_filters); 8883 - device_del(pmu->dev); 8884 - put_device(pmu->dev); 8872 + if (remove_device) { 8873 + if (pmu->nr_addr_filters) 8874 + device_remove_file(pmu->dev, &dev_attr_nr_addr_filters); 8875 + device_del(pmu->dev); 8876 + put_device(pmu->dev); 8877 + } 8885 8878 free_pmu_context(pmu); 8886 8879 } 8887 8880 EXPORT_SYMBOL_GPL(perf_pmu_unregister);