The branch counters logging (A.K.A LBR event logging) introduces a per-counter indication of precise event occurrences in LBRs. It can provide a means to attribute exposed retirement latency to combinations of events across a block of instructions. It also provides a means of attributing Timed LBR latencies to events. The feature will be first introduced with next Intel E-core Xeon Sierra Forest(SRF)/Grand Ridge(GRR). It is an enhancement of the Architectural LBR. It adds new fields in the LBR_INFO MSRs to log the occurrences of events on the GP counters. The information is displayed by the order of counters. To support this feature, both kernel PMU changes and user space perf tool changes are needed. Kernel commits(5 patches, from mainline kernel v6.8-rc1): 33744916196b perf/x86/intel: Support branch counters logging 318c49859112 perf/x86/intel: Reorganize attrs and is_visible 1f2376cd03dd perf: Add branch_sample_call_stack 85846b27072d perf/x86: Add PERF_X86_EVENT_NEEDS_BRANCH_STACK flag 571d91dcadfa perf: Add branch stack counters Reference: https://lore.kernel.org/lkml/20231025201626.3000228-5-kan.liang@linux.intel.com/ Perf tool commits(4 patches, from mainline kernel v6.8-rc1): 697579629f85 perf test: Basic branch counter support 9fbb4b02302b perf tools: Add branch counter knob ac9cd7245fff perf header: Support num and width of branch counters 76db7aab1fca tools headers UAPI: Sync include/uapi/linux/perf_event.h header with the kernel Reference: https://lore.kernel.org/lkml/20240109222804.28583-1-acme@kernel.org/ Since perf tool changes are independent to kernel versions, this ticket is only created for backporting the kernel commits to kernel v6.6. The perf tool commits will be useful for testing the kernel backport.
The PR Link: https://gitee.com/anolis/anck-next/pulls/37
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/2680