<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.openanolis.cn/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.openanolis.cn/"
          
          maintainer="service@openanolis.org"
>

    <bug>
          <bug_id>8006</bug_id>
          
          <creation_ts>2024-01-22 15:34:58 +0000</creation_ts>
          <short_desc>Intel: Backport SRF LBR branch counter support to kernel v6.6</short_desc>
          <delta_ts>2024-01-30 10:45:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>5</classification_id>
          <classification>ANCK</classification>
          <product>ANCK 6.6 Dev</product>
          <component>generic</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3-Medium</priority>
          <bug_severity>S3-normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="yunyings">yunying.sun</reporter>
          <assigned_to name="maqiao">mqaio</assigned_to>
          
          
          <qa_contact name="shuming">qingming.su</qa_contact>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25260</commentid>
    <comment_count>0</comment_count>
    <who name="yunyings">yunying.sun</who>
    <bug_when>2024-01-22 15:34:58 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25262</commentid>
    <comment_count>1</comment_count>
    <who name="小龙">yongchao</who>
    <bug_when>2024-01-22 15:42:46 +0000</bug_when>
    <thetext>The PR Link: https://gitee.com/anolis/anck-next/pulls/37</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25480</commentid>
    <comment_count>2</comment_count>
    <who name="小龙">yongchao</who>
    <bug_when>2024-01-30 10:45:57 +0000</bug_when>
    <thetext>The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/2680</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>