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

相关推荐
阿甘知识库35 分钟前
宝塔面板跨服务器数据同步教程:双机备份零停机
android·运维·服务器·备份·同步·宝塔面板·建站
元争栈道1 小时前
webview+H5来实现的android短视频(短剧)音视频播放依赖控件资源
android·音视频
居居飒2 小时前
Android学习(四)-Kotlin编程语言-for循环
android·学习·kotlin
Henry_He5 小时前
桌面列表小部件不能点击的问题分析
android
工程师老罗5 小时前
Android笔试面试题AI答之Android基础(1)
android
qq_397562317 小时前
android studio更改应用图片,和应用名字。
android·ide·android studio
峥嵘life7 小时前
Android Studio版本升级那些事
android·ide·android studio
新手上路狂踩坑7 小时前
Android Studio的笔记--BusyBox相关
android·linux·笔记·android studio·busybox
TroubleMaker9 小时前
OkHttp源码学习之retryOnConnectionFailure属性
android·java·okhttp
叶羽西11 小时前
Android Studio IDE环境配置
android·ide·android studio