On Wed, Dec 10, 2025 at 12:11:47PM +0200, Fernand Sieber wrote:
Does something like so work? It is still terrible, but perhaps slightly less so.
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 2b969386dcdd..493e6ba51e06 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -1558,13 +1558,22 @@ static inline bool intel_pmu_has_bts_period(struct perf_event *event, u64 period struct hw_perf_event *hwc = &event->hw; unsigned int hw_event, bts_event;
- if (event->attr.freq)
/*
* Only use BTS for fixed rate period==1 events.*/if (event->attr.freq || period != 1)
return false;/*
* BTS doesn't virtualize.*/if (event->attr.exclude_host) return false;
hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS);
- return hw_event == bts_event && period == 1;
- return hw_event == bts_event;
}
static inline bool intel_pmu_has_bts(struct perf_event *event)
Hi Peter,
I've pulled your changes and confirmed that they address the original bug report.
The repro I use is running on host, with a guest running: `perf record -e branches:u -c 2 -a &` `perf record -e branches:u -c 2 -a &` Then I monitor the enablement of BTS on the host and verify that without the change BTS is enabled, and with the change it's not.
This looks good to me, should we go ahead with your changes then?
Yeah, I suppose. Please stick a coherent changelog on and repost.