Skip to content

bsp: cvitek: fix cv18xx_aarch64 mnt init blocking #9249

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

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

Solonix-Chu
Copy link
Contributor

@Solonix-Chu Solonix-Chu commented Jul 25, 2024

The aarch64 core of duo on the master cannot enter the
console interface. It can only print the RT flag and hold it.

Analysis: The latest commit that can work is ae6a328 ("Add
psoc62, 61 config"). This phenomenon will occur after adding
754c59a ("[Feature] DFS mount auto by kernel parameters").
The specific reason is that when aarch bsp enables the device
tree, the current u-boot will pass in bootargs, which contains
"root=/dev/mmcblk0p2 rootwait rw", which means that the
kernel is required to wait until the rootfs in /dev/mmcblk0p2
loaded successfully. However, the current aarch64 bsp default
does not implement sdmmc device mounting, causing the
kernel file system mounting module (rootfs_mnt_init() of
components/drivers/core/mnt.c) to enter an infinite loop waiting.

Solution: At present, we do not plan to modify the startup
parameters of u-boot. The temporary solution adopted is to
create a pseudo /dev/mmcblk0p2 device during the board
initialization process, and then cancel the pseudo device
after mnt is completed. This allows the kernel boot to be
completed successfully.

Reviewed-by: Chen Wang [email protected]

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

Fixed #9243

你的解决方案是什么 (what is your solution)

伪造一个 /dev/mmcblk0p2 设备, 初始化结束之后反注册这个设备.

请提供验证的bsp和config (provide the config and bsp)

  • BSP: bsp/cvitek
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@Solonix-Chu
Copy link
Contributor Author

@unicornx

@unicornx unicornx self-requested a review July 25, 2024 05:31
@unicornx unicornx added BSP: Cvitek BSP related with cvitek Arch: ARM/AArch64 BSP related with arm labels Jul 25, 2024
@unicornx
Copy link
Contributor

arch64 only print version logo, unable to enter console

Analysis: 754c59a ("[Feature] DFS mount auto by kernel parameters") cv18xx_arch64 will infinite looping in rootfs_mnt_init because of miss bootargs.

Solution: mannually add the "/dev/mmcblk0p2" device and unregiste after inited.

Reviewed-by: Chen Wang [email protected]

commit 中应该是 aarch64,不是 arch64,请仔细检查一下

另外 commit 的描述不够准确。我再总结一下 #9243 的描述如下,供参考:

问题描述:目前 master 上的代码 duo 的 aarch64 大核无法启动进入控制台界面,只能打印出 RT flag 就 hold 住了。

问题分析:
bisect 看了一下,最近一个可以 work 的 commit 是 "ae6a328: Add psoc62、61 config", 加入 "754c59a4 [Feature] DFS mount auto by kernel parameters (#8989) " 后就会出现该现象。
具体原因是当 aarch bsp 启用设备树后,当前 u-boot 会传入 bootargs,其中含有 “root=/dev/mmcblk0p2 rootwait rw ”,其含义是要求内核持续等待,直到 /dev/mmcblk0p2 中的 rootfs 挂载成功。但目前 aarch64 bsp 默认 bsp 并没有实现 sdmmc 的设备挂载,导致内核的文件系统挂载模块(components/drivers/core/mnt.crootfs_mnt_init()) 进入死循环等待。

解决方案:目前我们暂不打算修改 u-boot 的启动参数,采用的临时解决方案是在 board 初始化过程中创建一个 pseudo 的 /dev/mmcblk0p2 设备,等 mnt 完成后再撤销该 pseudo 设备。从而让内核启动顺利完成。

Copy link
Contributor

@unicornx unicornx left a comment

Choose a reason for hiding this comment

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

见其他 comments。

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
* Copyright (c) 2006-2024 RT-Thread Development Team
Copy link
Contributor

Choose a reason for hiding this comment

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

为啥去掉逗号?我看了 RTT 的其他文件,都有逗号的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里是用formatting脚本刷了一下,该更改可以取消

* mannually add the "/dev/mmcblk0p2" device to avoid
* infinite loop when rootfs_mnt_init, after init will
* unregiste the device.
* This is a temporary workaround.
Copy link
Contributor

Choose a reason for hiding this comment

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

这句话放到开头去。另外开头加个 FIXME

FIXME: This is a temporary workaround.
balabala... 

另外注意句子开头字母大写。

具体的注释,可以将 commit 信息的内容 copy 一份过来即可

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的 已修改


return 0;
}
INIT_FS_EXPORT(pseudo_mmcblk_remove);
#endif /* RT_USING_OFW */
Copy link
Contributor

Choose a reason for hiding this comment

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

这个修改对 !RT_USING_OFW 应该不需要的吧,我这里只是和你确认一下。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的

The aarch64 core of duo on the master cannot enter the
console interface. It can only print the RT flag and hold it.

Analysis: The latest commit that can work is ae6a328 ("Add
psoc62, 61 config"). This phenomenon will occur after adding
754c59a ("[Feature] DFS mount auto by kernel parameters").
The specific reason is that when aarch bsp enables the device
tree, the current u-boot will pass in bootargs, which contains
"root=/dev/mmcblk0p2 rootwait rw", which means that the
kernel is required to wait until the rootfs in /dev/mmcblk0p2
loaded successfully. However, the current aarch64 bsp default
does not implement sdmmc device mounting, causing the
 kernel file system mounting module (rootfs_mnt_init() of
components/drivers/core/mnt.c) to enter an infinite loop waiting.

Solution: At present, we do not plan to modify the startup
parameters of u-boot. The temporary solution adopted is to
create a pseudo /dev/mmcblk0p2 device during the board
initialization process, and then cancel the pseudo device
after mnt is completed. This allows the kernel boot to be
completed successfully.

Signed-off-by: Shicheng Chu <[email protected]>
Reviewed-by: Chen Wang <[email protected]>
@mysterywolf mysterywolf merged commit a1b01ee into RT-Thread:master Jul 25, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: ARM/AArch64 BSP related with arm BSP: Cvitek BSP related with cvitek
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] bsp/cvitek/cv18xx_aarch64 无法 boot 进入控制台界面
3 participants