On Mon, Oct 14, 2024 at 11:40:21AM -0400, Liang, Kan wrote: > >> @@ -11842,7 +11860,21 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type) > >> if (!pmu->event_idx) > >> pmu->event_idx = perf_event_idx_default; > >> > >> - list_add_rcu(&pmu->entry, &pmus); > >> + /* > >> + * Initialize passthru_pmu with the core pmu that has > >> + * PERF_PMU_CAP_PASSTHROUGH_VPMU capability. > >> + */ > >> + if (pmu->capabilities & PERF_PMU_CAP_PASSTHROUGH_VPMU) { > >> + if (!passthru_pmu) > >> + passthru_pmu = pmu; > >> + > >> + if (WARN_ONCE(passthru_pmu != pmu, "Only one passthrough PMU is supported\n")) { > >> + ret = -EINVAL; > >> + goto free_dev; > > > > Why impose this limit? Changelog also fails to explain this. > > Because the passthru_pmu is global variable. If there are two or more > PMUs with the PERF_PMU_CAP_PASSTHROUGH_VPMU, the former one will be > implicitly overwritten if without the check. That is not the question; but is has been answered elsewhere. For some reason you thought the srcu+list thing was expensive.