Skip to content

Conversation

@ecjtusbs
Copy link
Contributor

@ecjtusbs ecjtusbs commented Dec 16, 2025

When HAOC is enabled via kernel command line, print an informational message to dmesg. This helps in verifying the feature status during boot.

Summary by Sourcery

Enhancements:

  • Add an informational kernel log message when HAOC is enabled via the command line during x86_64 memory initialization.

When HAOC  is enabled via kernel  command line, print an informational message to dmesg.
This helps in verifying the feature status during boot.
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds an informational kernel log message when HAOC is enabled via the kernel command line, emitted right before initializing the IEE mapping region, to make HAOC activation visible in dmesg during boot.

Sequence diagram for HAOC-enabled mem_init logging

sequenceDiagram
    participant Boot as BootProcess
    participant Kernel as Kernel
    participant Memory as mem_init
    participant Logger as printk
    participant IEE as iee_init

    Boot->>Kernel: start_kernel
    Kernel->>Memory: mem_init()
    Memory->>Memory: check haoc_enabled
    alt haoc_enabled is true
        Memory->>Logger: pr_info(HAOC is enabled by kernel command line.)
        Memory->>IEE: iee_init()
    else haoc_enabled is false
        Memory-->>IEE: iee_init() not called
    end
    Memory-->>Kernel: return
    Kernel-->>Boot: continue boot sequence
Loading

File-Level Changes

Change Details Files
Log HAOC activation when enabled and initializing the IEE mapping region.
  • Wrap existing haoc_enabled conditional body in braces to allow multiple statements.
  • Insert pr_info call that logs that HAOC is enabled by the kernel command line.
  • Retain the existing iee_init call and its behavior, only augmenting it with logging.
arch/x86/mm/init_64.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

deepin pr auto review

我来对这个git diff进行审查:

  1. 语法逻辑:
  • 代码修改在语法上是正确的。将单行if语句扩展为if块并添加日志输出是合理的做法。
  • 逻辑上,在启用haoc功能时添加日志输出,有助于调试和系统状态跟踪。
  1. 代码质量:
  • 优点:
    • 添加了日志输出,提高了代码的可观测性
    • 使用pr_info而不是printk,符合内核日志规范
  • 建议:
    • 可以考虑在日志中添加更多上下文信息,比如HAOC的具体配置参数
    • 建议在日志中包含函数名或模块名,方便追踪
  1. 代码性能:
  • 性能影响微乎其微:
    • 仅在haoc_enabled为true时执行一次
    • pr_info的开销很小
  • 无性能问题
  1. 代码安全:
  • 修改本身不引入安全风险
  • 日志输出可能泄露系统配置信息,但HAOC启用状态通常不是敏感信息

改进建议:

if (haoc_enabled) {
    pr_info("HAOC: Initializing Intel IEE (In-Memory Encryption Engine)\n");
    iee_init();
}

修改理由:

  1. 添加"HAOC:"前缀,使日志更容易过滤和识别
  2. 提供更详细的描述,说明IEE是什么
  3. 添加换行符\n,确保日志格式规范
  4. 使用规范的内核日志格式

这样的修改既保持了原有功能,又提高了代码的可维护性和可观测性。

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 there - 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 opsiff merged commit 4801cde into deepin-community:linux-6.6.y Dec 17, 2025
13 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: opsiff

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

The pull request process is described 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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds informational logging to indicate when the HAOC (Hardware-Assisted Object Confinement) feature is enabled during x86_64 memory initialization. The log message helps system administrators and developers verify that HAOC has been successfully activated via the kernel command line parameter during boot.

Key Changes

  • Added a pr_info() call to log when HAOC is enabled, improving boot-time observability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

*/
if (haoc_enabled)
if (haoc_enabled) {
pr_info("HAOC is enabled by kernel command line.");
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The log message should be more concise and consistent with kernel logging conventions. Based on similar feature enablement messages in the codebase (e.g., "PV spinlocks enabled", "CET detected: Indirect Branch Tracking enabled", "Virtual NMI enabled"), consider simplifying this message to just "HAOC enabled" without mentioning "by kernel command line", as this is implied by the fact that the log appears during boot initialization.

Suggested change
pr_info("HAOC is enabled by kernel command line.");
pr_info("HAOC enabled");

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants