Merge tag 'perf-urgent-2026-01-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf events fixes from Ingo Molnar:

- Fix mmap_count warning & bug when creating a group member event
with the PERF_FLAG_FD_OUTPUT flag

- Disable the sample period == 1 branch events BTS optimization
on guests, because BTS is not virtualized

* tag 'perf-urgent-2026-01-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86/intel: Do not enable BTS for guests
perf: Fix refcount warning on event->mmap_count increment

+20 -2
+11 -2
arch/x86/events/perf_event.h
··· 1574 1574 struct hw_perf_event *hwc = &event->hw; 1575 1575 unsigned int hw_event, bts_event; 1576 1576 1577 - if (event->attr.freq) 1577 + /* 1578 + * Only use BTS for fixed rate period==1 events. 1579 + */ 1580 + if (event->attr.freq || period != 1) 1581 + return false; 1582 + 1583 + /* 1584 + * BTS doesn't virtualize. 1585 + */ 1586 + if (event->attr.exclude_host) 1578 1587 return false; 1579 1588 1580 1589 hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; 1581 1590 bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); 1582 1591 1583 - return hw_event == bts_event && period == 1; 1592 + return hw_event == bts_event; 1584 1593 } 1585 1594 1586 1595 static inline bool intel_pmu_has_bts(struct perf_event *event)
+9
kernel/events/core.c
··· 6997 6997 if (data_page_nr(event->rb) != nr_pages) 6998 6998 return -EINVAL; 6999 6999 7000 + /* 7001 + * If this event doesn't have mmap_count, we're attempting to 7002 + * create an alias of another event's mmap(); this would mean 7003 + * both events will end up scribbling the same user_page; 7004 + * which makes no sense. 7005 + */ 7006 + if (!refcount_read(&event->mmap_count)) 7007 + return -EBUSY; 7008 + 7000 7009 if (refcount_inc_not_zero(&event->rb->mmap_count)) { 7001 7010 /* 7002 7011 * Success -- managed to mmap() the same buffer