Skip to content

Revert "[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] Fix kabi for CWF PMU support"#1500

Closed
opsiff wants to merge 1 commit intolinux-6.6.yfrom
revert-1378-linux-6.6.y-2025-12-16-kabi
Closed

Revert "[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] Fix kabi for CWF PMU support"#1500
opsiff wants to merge 1 commit intolinux-6.6.yfrom
revert-1378-linux-6.6.y-2025-12-16-kabi

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Feb 10, 2026

Reverts #1378

Summary by Sourcery

Revert the previous change that introduced an auxiliary hw_perf_event_ext structure for Intel PMU ACR handling and restore use of the existing hw_perf_event fields and allocations.

Bug Fixes:

  • Restore dynamic constraint and ACR configuration handling to use the main hw_perf_event structure to align with the pre-regression behavior and avoid additional allocation failures.

Enhancements:

  • Simplify perf event data structures by removing the separate hw_perf_event_ext cache and associated allocations while keeping KABI reserves intact.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 10, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This revert removes the Deepin-specific hw_perf_event_ext extension and associated allocations, restoring the use of fields directly in struct hw_perf_event and updating ACR/dynamic constraint handling in the Intel PMU code accordingly.

Class diagram for reverted hw_perf_event_ext and updated perf_event/hw_perf_event

classDiagram
    class hw_perf_event {
        +u64 config
        +u64 config1
        +u64 last_tag
        +u64 dyn_constraint
        +unsigned long config_base
        +unsigned long event_base
        +int event_base_rdpmc
        +int idx
        +int last_cpu
        +int flags
    }

    class perf_event {
        +hw_perf_event hw
        +u32 orig_type
        +void* pmu
        +void* ctx
        +void* ns
        +u64 attr
        +unsigned int state
        +unsigned int pending_disable
        +unsigned int pending_wakeup
        +unsigned int pending_kill
        +unsigned int pending_read
        +unsigned int oncpu
        +unsigned int attach_state
        +unsigned int read_size
        +unsigned int mmap_locked
        +unsigned int rb_needed
        +unsigned int rb_node
        +unsigned int pending_sync
        +unsigned int pending_idx
        +unsigned int group_caps
        +unsigned int group_flags
        +unsigned int tp_list
        +unsigned int addr_filters
        +unsigned int mutex
        +unsigned int refcount
        +unsigned int kref
        +unsigned int fasync
        +unsigned int clock
        +unsigned int parent
        +unsigned int child_list
        +unsigned int sibling_list
        +unsigned int rb_entry
        +unsigned int rcuwait
        +unsigned int owner
        +unsigned int destroy
        +unsigned int id_header_size
        +unsigned int id
        +unsigned int hwc_idx
        +unsigned int pmu_private
        +unsigned int pmu_ctx
        +unsigned int pmu_disable_count
        +unsigned int event_caps
        +unsigned int event_flags
        +unsigned int mmap_mutex
        +unsigned int mmap_page
        +unsigned int total_time_enabled
        +unsigned int total_time_running
        +unsigned int child_total_time_enabled
        +unsigned int child_total_time_running
        +unsigned int overflow_handler
        +unsigned int overflow_ctx
        +unsigned int clock_data
        +unsigned int shadow_ctx_time
        +unsigned int pmu_data
        +unsigned int pending_list
        +unsigned int pending_list_entry
        +unsigned int pending_add
        +unsigned int pending_del
        +unsigned int pending_disable_next
        +unsigned int ctx_time
        +unsigned int tstamp
        +unsigned int tstamp_running
        +unsigned int tstamp_stopped
        +unsigned int group_leader
        +unsigned int group_entry
        +unsigned int group_list
        +unsigned int group_tree
        +unsigned int event_list
        +unsigned int event_entry
        +unsigned int swevent_hlist
        +unsigned int tp_event
        +unsigned int addr_filters_list
        +unsigned int pinned_groups
        +unsigned int flexible_groups
        +unsigned int cgroup
        +unsigned int cgroup_entry
        +unsigned int ctx_entry
        +unsigned int namespace
        +unsigned int ns_capable
        +unsigned int user
        +unsigned int mmap_count
        +unsigned int mmap_page_list
        +unsigned int rb
        +unsigned int rb_entry_list
        +unsigned int cpu
        +unsigned int on_list
        +unsigned int migrate_disable
        +unsigned int migrate_enable
        +unsigned int fasync_list
        +unsigned int pending_mmap
        +unsigned int pending_close
        +unsigned int pending_group
        +unsigned int pending_parent
        +unsigned int pending_child
        +unsigned int pending_unthrottle
        +unsigned int pending_throttle
        +unsigned int pending_mmap_event
        +unsigned int pending_task
        +unsigned int pending_ctx
        +unsigned int pending_list_node
        +unsigned int pending_event
        +unsigned int pending_state
        +unsigned int pending_time
        +unsigned int pending_cpu
        +unsigned int pending_idx2
        +unsigned int pending_flags
        +unsigned int pending_config
        +unsigned int pending_config1
        +unsigned int pending_dyn_constraint
        +unsigned int pending_last_tag
        +unsigned int pending_hw
        +unsigned int pending_hw_state
        +unsigned int pending_hw_flags
        +unsigned int pending_hw_config
        +unsigned int pending_hw_config1
        +unsigned int pending_hw_dyn_constraint
        +unsigned int pending_hw_last_tag
        +unsigned int pending_hw_idx
        +unsigned int pending_hw_last_cpu
        +unsigned int pending_hw_event_base
        +unsigned int pending_hw_config_base
        +unsigned int pending_hw_event_base_rdpmc
        +unsigned int pending_hw_extra
        +unsigned int pending_hw_branch_reg
        +unsigned int pending_hw_cache_reg
        +unsigned int pending_hw_extra_reg
        +unsigned int pending_hw_bts
        +unsigned int pending_hw_flags2
        +unsigned int pending_hw_state2
        +unsigned int pending_hw_config2
        +unsigned int pending_hw_config3
        +unsigned int pending_hw_aux
        +unsigned int pending_hw_aux_page
        +unsigned int pending_hw_aux_offset
        +unsigned int pending_hw_aux_size
        +unsigned int pending_hw_aux_head
        +unsigned int pending_hw_aux_tail
        +unsigned int pending_hw_aux_mode
        +unsigned int pending_hw_aux_watermark
        +unsigned int pending_hw_aux_flags
        +unsigned int pending_hw_aux_dir
        +unsigned int pending_hw_aux_mmap
        +unsigned int pending_hw_aux_map
        +unsigned int pending_hw_aux_user
        +unsigned int pending_hw_aux_owner
        +unsigned int pending_hw_aux_state
        +unsigned int pending_hw_aux_mutex
        +unsigned int pending_hw_aux_rb
        +unsigned int pending_hw_aux_rb_entry
        +unsigned int pending_hw_aux_list
        +unsigned int pending_hw_aux_list_entry
        +unsigned int pending_hw_aux_group
        +unsigned int pending_hw_aux_group_entry
        +unsigned int pending_hw_aux_shadow
        +unsigned int pending_hw_aux_shadow_entry
        +unsigned int pending_hw_aux_shadow_list
        +unsigned int pending_hw_aux_shadow_list_entry
        +unsigned int pending_hw_aux_shadow_group
        +unsigned int pending_hw_aux_shadow_group_entry
        +unsigned int pending_hw_aux_shadow_rb
        +unsigned int pending_hw_aux_shadow_rb_entry
        +unsigned int pending_hw_aux_shadow_rb_list
        +unsigned int pending_hw_aux_shadow_rb_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group
        +unsigned int pending_hw_aux_shadow_rb_group_entry
        +unsigned int pending_hw_aux_shadow_rb_group_list
        +unsigned int pending_hw_aux_shadow_rb_group_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree
        +unsigned int pending_hw_aux_shadow_rb_group_tree_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_list_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_group
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_group_entry
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_group_list
        +unsigned int pending_hw_aux_shadow_rb_group_tree_node_group_tree_node_group_list_entry
        +DEEPIN_KABI_RESERVE_1
        +DEEPIN_KABI_RESERVE_2
        +DEEPIN_KABI_RESERVE_3
        +DEEPIN_KABI_RESERVE_4
    }

    perf_event --> hw_perf_event : has

    %% Removed structure in this revert
    class hw_perf_event_ext {
        +u64 config1
        +u64 dyn_constraint
    }

    class perf_event_old {
        +hw_perf_event hw
        +hw_perf_event_ext* hw_ext
        +u32 orig_type
        +DEEPIN_KABI_USE_1
        +DEEPIN_KABI_RESERVE_2
        +DEEPIN_KABI_RESERVE_3
        +DEEPIN_KABI_RESERVE_4
    }

    perf_event_old --> hw_perf_event : has
    perf_event_old --> hw_perf_event_ext : had_pointer

    %% Show that hw_perf_event_ext was removed and its fields moved into hw_perf_event
    hw_perf_event_ext <.. hw_perf_event : fields_moved_from
    perf_event_old <.. perf_event : replaced_by
Loading

Flow diagram for updated perf_event allocation and free path

flowchart TD
    A[perf_event_init] --> B[Create kmem_cache perf_event_cache]
    B --> C[perf_event_alloc]

    subgraph Allocation_path
        C --> D[Allocate perf_event from perf_event_cache]
        D --> E[Initialize event.hw including dyn_constraint and config1]
        E --> F[Return initialized perf_event]
    end

    F --> G[Event used by PMU code
intel_pmu_hw_config
intel_pmu_enable_acr
intel_get_event_constraints]

    G --> H[free_event_rcu]

    subgraph Free_path
        H --> I[perf_event_free_filter]
        I --> J[Free perf_event to perf_event_cache]
    end

    %% Removed Deepin specific cache and allocations
    subgraph Removed_in_revert
        K[perf_hw_event_cache creation] -.-> L[Allocation of hw_perf_event_ext]
        L -.-> M[Free hw_perf_event_ext in free_event_rcu]
    end
Loading

File-Level Changes

Change Details Files
Remove hw_perf_event_ext indirection and move its fields into struct hw_perf_event, restoring original perf_event layout and KABI reserves.
  • Delete hw_perf_event_ext struct definition and its dedicated kmem cache management
  • Add config1 and dyn_constraint members directly to struct hw_perf_event and stop allocating hw_ext in perf_event_alloc
  • Change perf_event to use DEEPIN_KABI_RESERVE instead of DEEPIN_KABI_USE for the first KABI slot
include/linux/perf_event.h
kernel/events/core.c
Update Intel PMU and x86 perf code to use the in-struct hw fields instead of hw_ext for ACR and dynamic constraint handling.
  • Replace uses of event->hw_ext->config1 with event->hw.config1 in ACR configuration paths
  • Replace uses of event->hw_ext->dyn_constraint with event->hw.dyn_constraint in constraint computation and initialization
  • Adjust ACR constraint bit operations to operate on hw.config1 and hw.dyn_constraint
arch/x86/events/intel/core.c
arch/x86/events/core.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@opsiff
Copy link
Member Author

opsiff commented Feb 10, 2026

#1501

@opsiff opsiff closed this Feb 10, 2026
@opsiff opsiff deleted the revert-1378-linux-6.6.y-2025-12-16-kabi branch February 10, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants