SERVICE_FAILURE_ACTIONS

SERVICE_FAILURE_ACTIONS

The SERVICE_FAILURE_ACTIONS structure represents the action the service controller should take on each failure of a service. A service is considered failed when it terminates without reporting a status of SERVICE_STOPPED to the service controller.

typedef struct _SERVICE_FAILURE_ACTIONS {
DWORD dwResetPeriod;
LPTSTR lpRebootMsg;
LPTSTR lpCommand;
DWORD cActions;
SC_ACTION* lpsaActions; } SERVICE_FAILURE_ACTIONS,
*LPSERVICE_FAILURE_ACTIONS;
Members
dwResetPeriod
Time after which to reset the failure count to zero if there are no failures, in seconds. Specify INFINITE to indicate that this value should never be reset.
lpRebootMsg
Message to broadcast to server users before rebooting in response to the SC_ACTION_REBOOT service controller action.

If this value is NULL, the reboot message is unchanged. If the value is an empty string (""), the reboot message is deleted and no message is broadcast.

lpCommand
Command line of the process for the CreateProcess function to execute in response to the SC_ACTION_RUN_COMMAND service controller action. This process runs under the same account as the service.

If this value is NULL, the command is unchanged. If the value is an empty string (""), the command is deleted and no program is run when the service fails.

cActions
Number of elements in the lpsaActions array.

If this value is 0, but lpsaActions is not NULL, the reset period and array of failure actions are deleted.

lpsaActions
Pointer to an array of SC_ACTION structures.

If this value is NULL, the cActions and dwResetPeriod members are ignored.

Remarks

The service control manager counts the number of times each service has failed since the system booted. The count is reset to 0 if the service has not failed for dwResetPeriod seconds. When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of the lpsaActions array. If N is greater than cActions, the service controller repeats the last action in the array.

Requirements
ClientRequires Windows XP or Windows 2000 Professional.
ServerRequires Windows Server 2003 or Windows 2000 Server.
Header

Declared in Winsvc.h; include Windows.h.

Unicode

Implemented as SERVICE_FAILURE_ACTIONSW (Unicode) and SERVICE_FAILURE_ACTIONSA (ANSI).

<think>我们正在讨论高通平台上的tsens_service服务进程。tsens通常指温度传感器(Thermal Sensor),在高通芯片中用于监控芯片温度并实施温控策略。tsens_service很可能是一个管理温度传感器的守护进程。 根据用户之前的上下文(关于SA515模组),我们应聚焦于嵌入式Linux环境下的tsens_service分析。 ### 1. **tsens_service的功能** - **核心作用**:实时监控SoC(系统芯片)中多个温度传感器的读数,并根据预定义策略调整系统状态(如调节CPU频率、关闭核芯、通知驱动程序等),防止芯片过热。 - **关键技术点**: - 依赖高通芯片内置的**TSENS(Temperature Sensor)硬件**,通常有多个传感器分布在CPU/GPU/Modem等热点区域。 - 通过**内核驱动**(如`qcom-tsens.c`)获取原始温度数据。 - 用户空间服务(tsens_service)实现**温控策略**(如触发不同级别的散热措施)。 ### 2. **进程状态查看方法** #### (1) 检查进程是否运行 ```bash ps aux | grep tsens_service ``` **典型输出**: ``` root 456 0.0 0.3 8764 4200 ? Ssl Jul10 10:22 /usr/bin/tsens_service ``` - **关键字段**: - `STAT`:`Ssl`表示休眠状态(S),且是多线程(l),由系统启动(s)。 - 持续运行时间(示例中为Jul10启动,累计10分22秒)。 #### (2) 通过systemctl查看(若为systemd服务) ```bash systemctl status tsens_service.service # 实际服务名可能不同 ``` **输出关键**: ``` Active: active (running) since Tue 2023-07-10 14:00:00 UTC; 1 day ago Main PID: 456 (tsens_service) Tasks: 5 (limit: 512) Memory: 2.3M ``` - 若状态为`inactive`,需检查服务是否被禁用。 ### 3. **服务异常诊断** #### (1) 查看进程资源 ```bash # 假设PID为456 cat /proc/456/status | grep -e "VmRSS" -e "Threads" ``` 输出示例: ``` VmRSS: 2340 kB # 物理内存占用 Threads: 5 # 线程数 ``` #### (2) 检查日志 ```bash journalctl -u tsens_service.service --since "1 hour ago" ``` **常见错误**: - `TSENS sensor 0 read failure`:传感器0通信异常(可能硬件问题)。 - `Thermal zone x over temp`:温度区域x超温告警。 ### 4. **温控策略配置** - 策略文件通常位于`/etc/thermal-engine.conf`或`/vendor/etc/thermal-engine.conf`。 - 示例策略片段: ```conf [CPU_MONITOR] sensor: cpu-therm thresholds: 85000,95000,105000 actions: cpu,shutdown,cpu ``` - 当`sensor`温度达到85°C时,降低CPU频率;95°C时进一步降频;105°C时关机。 ### 5. **高通相关技术细节** - **中断机制**:TSENS通过PMIC(电源管理芯片)触发中断。例如引用[1]中的`PM8921_RTC_ALARM_IRQ`可能与温度告警中断相关(需查芯片手册)[^1]。 - **调试接口**: ```bash # 读取当前温度(需root) cat /sys/class/thermal/thermal_zone*/temp ``` ### 总结 | 项目 | 说明 | |--------------|----------------------------------------------------------------------| | **进程名** | `tsens_service` 或 `thermal-engine`(不同平台可能不同) | | **核心功能** | 温度监控与动态温控 | | **依赖** | 内核驱动(`qcom-tsens`)、硬件传感器、配置文件 | | **调试命令** | `ps`, `journalctl`, `cat /sys/class/thermal/*/temp` | 若服务崩溃,可尝试重启: ```bash systemctl restart tsens_service.service # 或 killall -SIGUSR1 tsens_service # 某些服务支持信号重载配置 ``` --- §§ 相关问题 §§ 1. 如何配置高通芯片的温控阈值(thermal-engine.conf)? 2. TSENS 传感器读数异常的可能原因有哪些? 3. 如何在嵌入式系统中添加自定义温度监控点? 4. 高通 Modem 部分的温度如何监控? [^1]: 引用自高通 PM8921 电源管理芯片数据手册</think>### tsens_service 服务进程解析 **tsens_service** 是高通平台(如 SA515 模组)用于管理温度传感器(Temperature Sensor, TSENS)的核心服务进程,主要功能包括芯片温度监控、热管理策略执行和异常保护。 --- ### 一、核心功能 1. **温度监控** - 实时采集 SoC 内部多个温度传感器数据(如 CPU/GPU/Modem 区域) - 通过内核驱动接口读取传感器值(路径示例): ```bash cat /sys/class/thermal/thermal_zone*/temp # 查看实时温度 ``` 2. **热管理策略** - 动态调节 CPU/GPU 频率防止过热 - 触发分级降温措施: - 温度阈值 $T_1$:降频 - 温度阈值 $T_2$:关闭核心($T_2 > T_1$) - 温度阈值 $T_3$:强制关机($T_3 > T_2$) 3. **异常处理** - 监控传感器失效(如 TSENS 读数超范围 $-40^\circ C \sim 150^\circ C$) - 响应 PMIC 温度中断(参考引用[1]的 IRQ 机制[^1]) --- ### 二、进程状态诊断 #### 1. 检查运行状态 ```bash ps aux | grep tsens_service # 查找进程 ``` **典型输出**: ``` root 123 0.2 0.5 9876 5500 ? Ssl 10:00 0:05 /system/bin/tsens_service ``` - **STAT 字段解析**: - `S`:休眠状态(等待传感器数据/中断) - `sl`:多线程 + 会话首进程 - 持续运行应为 **Ssl** 或 **Rsl**(R=运行中) #### 2. 查看资源占用 ```bash cat /proc/$(pidof tsens_service)/status | grep -e VmRSS -e Threads ``` ``` VmRSS: 5240 kB # 物理内存占用 Threads: 8 # 线程数(通常含监控/策略/日志线程) ``` #### 3. 日志分析 ```bash journalctl -u tsens_service | grep -i error ``` **常见错误**: ``` ERR tsens_sensor0_read: -110 (I2C timeout) # 传感器通信异常 WARN Thermal zone7 overtemp: 95°C # 温度超阈值 ``` --- ### 三、技术细节 1. **中断机制** - 依赖 PMIC 中断(如引用[1]的 `PM8921_RTC_ALARM_IRQ`[^1]) - 中断触发场景: - 温度阈值突破 - 传感器故障 2. **配置文件** 策略文件路径:`/vendor/etc/thermal-engine.conf` ```conf [sensor_cpu] sampling 1000 # 采样周期(ms) thresholds 80 85 90 # 分级温度阈值(°C) actions cpu cpu shutdown ``` 3. **调试接口** ```bash echo "force_cooling_level 1" > /sys/class/thermal/cooling_device0/state # 手动激活散热 ``` --- ### 四、故障处理流程 ```mermaid graph TD A[服务无响应] --> B{检查进程状态} B -->|进程存在| C[查看日志/journalctl] B -->|进程不存在| D[尝试重启服务] C --> E[分析错误类型] E -->|传感器超时| F[检测硬件连接] E -->|温度超限| G[优化散热/降负载] ``` ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值