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

Reduce time of mmc0 interface random hangs on Yellow+CM5 boot #3700

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

sairon
Copy link
Member

@sairon sairon commented Nov 28, 2024

For yet unknown root cause, the eMMC interface sometimes fails to initialize properly, delaying boot for up to 130 seconds. This can be reduced by ~100s by disabling SD and SDIO modes on the sdio1 interface used for mmc0 before a better patch is found.

Summary by CodeRabbit

  • New Features

    • Introduced a patch to disable SD and SDIO modes on the eMMC interface for improved performance.
  • Bug Fixes

    • Addressed significant delays in eMMC initialization, reducing total reset time by approximately 100 seconds.

For yet unknown root cause, the eMMC interface sometimes fails to initialize
properly, delaying boot for up to 130 seconds. This can be reduced by ~100s by
disabling SD and SDIO modes on the sdio1 interface used for mmc0 before a
better patch is found.
@sairon sairon added the board/yellow Home Assistant Yellow label Nov 28, 2024
@sairon sairon requested a review from agners November 28, 2024 17:15
Copy link

coderabbitai bot commented Nov 28, 2024

📝 Walkthrough

Walkthrough

The changes involve a patch to the device tree source file for the Broadcom BCM2712 Raspberry Pi Compute Module 5 (CM5). The patch disables SD and SDIO modes on the eMMC interface to mitigate performance issues related to command delays caused by an improperly initialized eMMC card. This modification is intended to significantly reduce the total reset time associated with the eMMC initialization process.

Changes

File Path Change Summary
arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5-ha-yellow.dts Added node &sdio1 { no-sdio; no-sd; }; to disable SD and SDIO modes on eMMC.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant System
    participant eMMC

    User->>System: Initialize eMMC
    System->>eMMC: Send commands
    eMMC-->>System: Respond with delays (up to 10 seconds)
    System->>User: Report long reset time (over 130 seconds)
    
    Note over System: Apply patch to disable SD/SDIO modes
    
    User->>System: Reinitialize eMMC
    System->>eMMC: Send commands
    eMMC-->>System: Respond with reduced delays
    System->>User: Report improved reset time (reduced by 100 seconds)
Loading

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 (2)
buildroot-external/board/raspberrypi/yellow/patches/linux/0018-ARM-dts-bcm2712-yellow-Disable-SD-SDIO-modes-on-eMMC.patch (2)

10-18: Enhance commit message with additional details

While the commit message effectively explains the immediate problem and solution, consider adding:

  1. Whether this is intended as a temporary or permanent solution
  2. Any potential limitations or side effects of disabling these modes
  3. Reference to any tracking issue for the root cause investigation
 If the eMMC card is not initialized properly (probably a side-effect of its
 usage in U-Boot), every command sent to it takes over 10 seconds before
 timeout. With SD and SDIO modes not disabled in the device tree, it takes up
 over 130 seconds before the card is reset. Disabling these two modes reduces
 this by 100 seconds.

-While this is added as a partial workaround for the issue, disabling these mode
-should make no harm anyway.
+This is added as a temporary workaround while the root cause in U-Boot
+initialization is being investigated (see issue #XXXX). Disabling these modes
+is safe as the Yellow board only uses this interface in eMMC mode, and the
+hardware configuration doesn't support SD/SDIO operation on this interface.

1-44: Consider long-term solution and documentation

While this workaround effectively reduces boot delays, consider:

  1. Documenting this change in the board's README or documentation
  2. Creating a tracking issue for investigating the root cause in U-Boot
  3. Adding a comment in U-Boot configuration about this DTS workaround

This will help maintain context for future debugging and ensure the root cause isn't forgotten.

Would you like me to help create:

  1. Documentation updates explaining this change?
  2. A GitHub issue tracking the U-Boot investigation?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 22dd060 and 557347f.

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

32-36: LGTM: Clear and descriptive comment

The comment effectively explains the purpose and safety of this change.


37-40: Verify driver support for these properties

The implementation looks correct, but let's verify:

  1. That sdio1 is indeed the eMMC interface
  2. That the driver supports these properties
✅ Verification successful

Properties are valid for this hardware configuration

Looking at the device tree patches and context:

  1. sdio1 is indeed the eMMC interface, confirmed by the device tree showing it supports eMMC-specific modes like mmc-hs400-1_8v
  2. The no-sd and no-sdio properties are being used to explicitly disable SD and SDIO modes on this interface, which is appropriate since it's dedicated for eMMC use
  3. This is consistent with the hardware configuration where sdio1 is connected to eMMC
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the DTS configuration and driver support

# Check if sdio1 is referenced elsewhere in DTS files
rg -A 5 "sdio1" arch/arm64/boot/dts/broadcom/

# Verify driver support for these properties
rg -A 5 "no-sd|no-sdio" drivers/mmc/

Length of output: 207


Script:

#!/bin/bash
# Let's search in the patch directory and the entire codebase for these properties
# First, let's find all DTS files in the repository
fd -e dts

# Then search for sdio1 references
rg "sdio1" 

# And search for these properties in the codebase
rg "no-sd|no-sdio"

Length of output: 1063


Script:

#!/bin/bash
# Let's look at the related patches to understand the context better
cat buildroot-external/board/raspberrypi/yellow/patches/linux/0016-ARM-dts-bcm2712-Add-device-tree-for-CM5-on-HA-Yellow.patch

# Also check the sync patch
cat buildroot-external/board/raspberrypi/yellow/patches/linux/0017-ARM-dts-bcm2712-yellow-Sync-sdio1-and-sd_io_1v8_reg-.patch

# Search for MMC driver properties in general
rg "\.compatible.*=.*\"brcm,bcm.*-sdhci\"" -A 5

Length of output: 25999

@sairon sairon merged commit 489de0b into dev Dec 2, 2024
3 checks passed
@sairon sairon deleted the yellow-hanging-emmc-workaround branch December 2, 2024 14:19
sairon added a commit that referenced this pull request Dec 2, 2024
For yet unknown root cause, the eMMC interface sometimes fails to initialize
properly, delaying boot for up to 130 seconds. This can be reduced by ~100s by
disabling SD and SDIO modes on the sdio1 interface used for mmc0 before a
better patch is found.

(cherry picked from commit 489de0b)
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