qcom 平台SSR (Subsystem Restart)配置

qcom 平台如何配置不同子系统重启模式 SSR (Subsystem Restart) restart level

一、SSR level 说明:

在配置和使用subsystem restart level时,不同级别的restart level有如下几种:

No SSR (Subsystem Restart):

设置值:disabled或none

解释:该模式下,子系统不会自动重启,即使发生崩溃。

Related SSR:

设置值:related

解释:当子系统崩溃时,仅相关的子系统会自动重启,而不会影响到其他子系统。这是为了减少崩溃对整个系统的影响。

System SSR:

设置值:system

解释:当子系统崩溃时,整个系统会自动重启。该模式下,所有子系统都会被重新初始化,确保系统处于一个干净的状态。

Early SSR:

设置值:early

解释:在子系统崩溃检测到后会尽早进行重启操作,可能在检测到问题的早期阶段就执行重启操作。

配置和查看这些restart level的命令如下:

二、查看各子系统名称:

cat /sys/bus/msm_subsys/devices/subsys*/name

modem

adsp

wcnss

venus

三、查看subsystem restart level:

adb shell

cat /sys/bus/msm_subsys/devices/subsysX/restart_level

其中X表示子系统的编号,如0表示modem。

设置restart level:

echo related > /sys/bus/msm_subsys/devices/subsysX/restart_level

将related替换为所需的restart level值,如system、disabled等。

确认配置生效:

通过查看命令确认设置已生效:

cat /sys/bus/msm_subsys/devices/subsysX/restart_level

四、查看全部子系统restart_level:

cat /sys/bus/msm_subsys/devices/subsys*/restart_level

SYSTEM

SYSTEM

SYSTEM

SYSTEM

五、测试、验证、确认

diag命令手动触发modem crash: send_data 75 37 03 00

或者 echo 1 > /sys/kernel/restart_modem 手动触发modem重启(不是所有的qcom芯片平台都支持)

或者 echo c>/proc/sysrq-trigger -> 手动触发kernel panic

可以根据kernel log查看modem是否重启

cat /proc/kmsg

搜索关键log: subsys-restart: subsystem_powerup():[kworker/u9:4:508]: Powering up modem

六、设置restart level

单独子系统重启:

setprop persist.vendor.ssr.restart_level "modem wcnss" 空格分割

全部子系统重启:

setprop persist.vendor.ssr.restart_level ALL_ENABLE

mk文件中配置全部子系统重启:

SSR_SWITCH_LEVEL := ALL_ENABLE

SYSTEM_PROPERTY_OVERRIDES += persist.vendor.ssr.restart_level = $(SSR_SWITCH_LEVEL)

七、相关代码

android/vendor/qcom/proprietary/ss-restart/ssr_setup/ssr_setup.c

#define SSR_BUS_ROOT "/sys/bus/msm_subsys/devices"

#define SSR_SETUP_PROP "persist.vendor.ssr.restart_level"

#define MAX_NUM_SUBSYS 16

#define SUBSYS_NAME_LEN 30

int setup_ssr(int num_subsys){

...

snprintf(ssr_toggle_path,

sizeof(ssr_toggle_path),

"%s/%s/restart_level",

SSR_BUS_ROOT,

de->d_name);

fd = open(ssr_toggle_path, O_WRONLY);

if (fd < 0) {

ALOGE("Failed to open %s : %s, continuing",

ssr_toggle_path,

strerror(errno));

continue;

}

if (enable_ssr) {

ALOGI("Enabling SSR for %s", de->d_name);

if (write(fd, "related",7) < 0) {

ALOGE("Failed to write to ssr node: %s",

strerror(errno));

goto error;

}

} else {

ALOGI("Disabling ssr for %s", de->d_name);

if (write(fd, "system",6) < 0) {

ALOGE("Failed to write to ssr node: %s",

strerror(errno));

goto error;

}

}

...

}

rc

on property:persist.vendor.ssr.restart_level=*

start vendor.ssr_setup

on property:persist.vendor.ssr.enable_ramdumps=1

write /sys/module/subsystem_restart/parameters/enable_ramdumps 1

mkdir /data/vendor/ramdump_ssr 770 system system

start vendor.ss_ramdump

参考文档:

80-P8754-71_REV_J_Minidump_Software_User_Guide.pdf

Subsystem Restart User Guide (80-N5609-2)

MSM8x10 Android Subsystem Restart Overview (80-NC839-21)

MSM8974 Android Subsystem Restart (80-NA157-31)

content:

Kernel configuration for Linux minidump enhancement

In the chipsets such as SM8350/SM4350, which is compatible with GKI1.0, enhancement has

been made on the Linux side. To enable it, use the following configuration for specific

enhancement.

CONFIG_QCOM_MINIDUMP_FTRACE=y

CONFIG_QCOM_MINIDUMP_PANIC_DUMP=y

CONFIG_QCOM_IRQ_STAT=y

CONFIG_QCOM_INITIAL_LOGBUF=y

CONFIG_QCOM_DYN_MINIDUMP_STACK=y

CONFIG_QCOM_MINIDUMP_PANIC_CPU_CONTEXT=y

Simulate modem SSR minidump:

adb wait-for-device root

adb wait-for-device shell

setenforce permissive

setprop persist.vendor.ssr.restart_level ALL_ENABLE

setprop persist.vendor.ssr.enable_ramdumps 1

echo mini > /sys/kernel/dload/dload_mode

/vendor/bin/subsystem_ramdump &

/vendor/bin/testapp_diag_senddata 75 37 03 00 00

pull modem ramdump_md_modem_xxxx.elf from /data/vendor/ramdump

Use the following steps for SM8450 and later chipsets:

  1. Execute the following commands to enable modem SSR and coredump:

adb shell "cat /sys/class/remoteproc/remoteprocX/name"

adb shell "cat /sys/class/remoteproc/remoteprocX/state"

adb shell "cat /sys/class/remoteproc/remoteprocX/recovery"

adb shell "echo enabled > /sys/class/remoteproc/remoteprocX/recovery"

adb shell "echo enabled > /sys/class/remoteproc/remoteprocX/coredump"

  1. Run the following commands to enable mini RAM dump collection:

adb shell "echo mini > /sys/kernel/dload/dload_mode'

adb shell "echo 1 >

/sys/module/qcom_ramdump/parameters/enable_dump_collection"

adb shell "./vendor/bin/subsystem_ramdump &"

  1. Trigger modem SSR command in qxdm (send_data 75 37 03 00 00), then check if mini dump

is generated at /data/vendor/ramdump partitio

相关推荐
大白要努力!9 分钟前
android 使用SQLiteOpenHelper 如何优化数据库的性能
android·数据库·oracle
Estar.Lee16 分钟前
时间操作[取当前北京时间]免费API接口教程
android·网络·后端·网络协议·tcp/ip
Winston Wood27 分钟前
Perfetto学习大全
android·性能优化·perfetto
Dnelic-3 小时前
【单元测试】【Android】JUnit 4 和 JUnit 5 的差异记录
android·junit·单元测试·android studio·自学笔记
Eastsea.Chen6 小时前
MTK Android12 user版本MtkLogger
android·framework
长亭外的少年13 小时前
Kotlin 编译失败问题及解决方案:从守护进程到 Gradle 配置
android·开发语言·kotlin
建群新人小猿15 小时前
会员等级经验问题
android·开发语言·前端·javascript·php
1024小神17 小时前
tauri2.0版本开发苹果ios和安卓android应用,环境搭建和最后编译为apk
android·ios·tauri
兰琛17 小时前
20241121 android中树结构列表(使用recyclerView实现)
android·gitee
Y多了个想法17 小时前
RK3568 android11 适配敦泰触摸屏 FocalTech-ft5526
android·rk3568·触摸屏·tp·敦泰·focaltech·ft5526