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

相关推荐
帅得不敢出门5 小时前
安卓设备adb执行AT指令控制电话卡
android·adb·sim卡·at指令·电话卡
我又来搬代码了7 小时前
【Android】使用productFlavors构建多个变体
android
德育处主任8 小时前
Mac和安卓手机互传文件(ADB)
android·macos
芦半山8 小时前
Android“引用们”的底层原理
android·java
迃-幵9 小时前
力扣:225 用队列实现栈
android·javascript·leetcode
大风起兮云飞扬丶9 小时前
Android——从相机/相册获取图片
android
Rverdoser9 小时前
Android Studio 多工程公用module引用
android·ide·android studio
aaajj10 小时前
[Android]从FLAG_SECURE禁止截屏看surface
android
@OuYang10 小时前
android10 蓝牙(二)配对源码解析
android
Liknana10 小时前
Android 网易游戏面经
android·面试