Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable CQE on mmc0 to fix I/O freezes on Yellow+CM5 #3705

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

sairon
Copy link
Member

@sairon sairon commented Dec 2, 2024

The I/O operations on the eMMC can sometimes fail and lock up completely, and disabling CQE on the sdio1 (mmc0) interface seems to solve the issue. While it is a known (and potentially resolved) issue [1] for SD cards in Raspberry Pi's Linux fork, it is not acknowledged neither resolved for CM5's eMMC. With CQE enabled, the device usually locks up within the first 10 first boots, when the swap file is being created. After disabling CQE, no error occurred after more that 100 cold boots (every time with swap file removed).

[1] https://github.com/raspberrypi/linuxissues/6349

Summary by CodeRabbit

  • Bug Fixes
    • Disabled the Command Queue Engine (CQE) feature on the eMMC interface for improved stability during boot and I/O operations on the Raspberry Pi Compute Module 5.
    • Addressed issues causing random hangs and blocked tasks during system initialization.

The I/O operations on the eMMC can sometimes fail and lock up completely, and
disabling CQE on the sdio1 (mmc0) interface seems to solve the issue. While it
is a known (and potentially resolved) issue [1] for SD cards in Raspberry Pi's
Linux fork, it is not acknowledged neither resolved for CM5's eMMC. With CQE
enabled, the device usually locks up within the first 10 first boots, when the
swap file is being created. After disabling CQE, no error occurred after more
that 100 cold boots (every time with swap file removed).

[1] https://github.com/raspberrypi/linuxissues/6349
@sairon sairon added the board/yellow Home Assistant Yellow label Dec 2, 2024
@sairon sairon requested a review from agners December 2, 2024 15:31
Copy link

coderabbitai bot commented Dec 2, 2024

📝 Walkthrough

Walkthrough

The pull request introduces a patch to the device tree source file for the Broadcom BCM2712 Raspberry Pi Compute Module 5 (CM5). It disables the Command Queue Engine (CQE) feature on the eMMC interface due to issues causing random hangs during I/O operations, particularly at boot time. The specific change involves removing the supports-cqe; property from the device tree entry for the SDIO interface, addressing problems with blocked tasks.

Changes

File Path Change Summary
buildroot-external/board/raspberrypi/yellow/patches/linux/0019-ARM-dts-bcm2712-yellow-Disable-CQE-on-eMMC-interface.patch Disables CQE on eMMC interface by removing supports-cqe; from the device tree entry for SDIO.
arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5-ha-yellow.dts Removed the property supports-cqe; from the &sdio1 device tree node.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
buildroot-external/board/raspberrypi/yellow/patches/linux/0019-ARM-dts-bcm2712-yellow-Disable-CQE-on-eMMC-interface.patch (1)

30-32: Consider broader hardware impact and upstream reporting.

Since similar issues exist with SD cards but haven't been acknowledged for eMMC, consider:

  1. Investigating if this issue affects other BCM27xx boards with eMMC
  2. Reporting this issue upstream to the Raspberry Pi Linux repository with the collected evidence
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 489de0b and 47ac055.

📒 Files selected for processing (1)
  • buildroot-external/board/raspberrypi/yellow/patches/linux/0019-ARM-dts-bcm2712-yellow-Disable-CQE-on-eMMC-interface.patch (1 hunks)
🔇 Additional comments (2)
buildroot-external/board/raspberrypi/yellow/patches/linux/0019-ARM-dts-bcm2712-yellow-Disable-CQE-on-eMMC-interface.patch (2)

9-32: Well-documented problem and solution!

The commit message effectively documents the issue with concrete evidence from system logs, showing multiple tasks being blocked. The correlation with known SD card issues and the validation of the fix through extensive testing (>100 cold boots) provides strong justification for this change.


43-49: LGTM! Consider monitoring performance impact.

The removal of CQE support is a clean, minimal change that maintains other essential eMMC features. While CQE typically improves performance through command queuing, the stability improvement justifies its removal.

Consider monitoring eMMC performance metrics before and after this change:

✅ Verification successful

Let me generate additional scripts to search for any existing performance monitoring or testing infrastructure related to eMMC/storage.


Let me try one final search focusing specifically on the device tree and kernel configurations related to eMMC and CQE.


Verified: CQE removal is justified due to stability issues

The patch commit message and related changes in the codebase confirm that CQE was causing random I/O hangs, and its removal was a deliberate stability improvement. While performance monitoring would be beneficial, the critical stability issues outweigh potential performance benefits. The change is minimal and maintains other essential eMMC features.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any performance-related configurations or tests in the codebase

# Look for eMMC/SD performance test files
fd -t f -e sh -e py . | rg -i "test|bench|perf" | rg -i "mmc|sd|emmc"

# Look for related performance documentation
rg -i "performance|benchmark" -g "*.md" -A 5 -B 5

Length of output: 1226


Script:

#!/bin/bash
# Search for storage/eMMC related monitoring or testing code
rg -i "mmc|emmc|storage" -g "*.sh" -g "*.py" -g "*.c" -A 3 -B 3

# Look for any existing monitoring or diagnostic tools
fd -t f monitoring diagnostics tests

# Search for storage performance related configurations
rg -i "mmc|emmc" -g "*.conf" -g "*.yaml" -g "*.yml"

Length of output: 1368


Script:

#!/bin/bash
# Search for CQE and eMMC related configurations in device trees and kernel configs
rg -i "cqe|command.?queue" -g "*.dts" -g "*.dtsi" -A 3 -B 3

# Look for kernel config options related to eMMC CQE
rg -i "MMC.*CQE|CQE.*MMC" -g "defconfig" -g "*.config"

# Search for any performance-related comments in eMMC patches
fd -t f -e patch . | xargs rg -i "cqe|command.?queue|performance"

Length of output: 3130

@sairon sairon merged commit c514d6b into dev Dec 2, 2024
3 checks passed
@sairon sairon deleted the yellow-cm5-disable-cqe branch December 2, 2024 15:45
sairon added a commit that referenced this pull request Dec 2, 2024
The I/O operations on the eMMC can sometimes fail and lock up completely, and
disabling CQE on the sdio1 (mmc0) interface seems to solve the issue. While it
is a known (and potentially resolved) issue [1] for SD cards in Raspberry Pi's
Linux fork, it is not acknowledged neither resolved for CM5's eMMC. With CQE
enabled, the device usually locks up within the first 10 first boots, when the
swap file is being created. After disabling CQE, no error occurred after more
that 100 cold boots (every time with swap file removed).

[1] https://github.com/raspberrypi/linuxissues/6349

(cherry picked from commit c514d6b)
This was referenced Dec 2, 2024
This was referenced Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board/yellow Home Assistant Yellow cla-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants