Re: [PATCH] cpuidle: Keep non-boot CPUs online during deep sleep to handle boot CPU deadlocks

From: fengtian guo
Date: Mon Nov 17 2025 - 06:43:39 EST


I want to ask the Expert , if we have better solution for The system hangs/freezes completely after entering deep sleep ? 
It's seem linux need a system function to resolve is issue 
the kernel proceeds to suspend. Naturally, the WDT module is also shut down during this phase, If a hang occurs later in the suspend sequence...


Subject: System Hang During Deep Sleep on Spreadtrum 7885 (cpu 8 cores) - Suspected CPU0 Deadlock

Problem Description:
Our Spreadtrum 7885 (cpu 8 cores)  device experiences complete system hangs during 
deep sleep states, phone power keys and etc no response. The system becomes 
unresponsive for approximately 40 minutes and no any log and finnaly manual long forced power key for forced hardware resets.

Key Log Evidence:

>From hilog_kmsg.022.20251103-160607:
Line 8105: 11-03 16:27:58.707 <6> [24285.271346] ;-Disabling non-boot CPUs ...
Line 8208: 11-03 16:27:58.711 <6> [24285.291750] ;-Enabling non-boot CPUs ...
Line 8546: 11-03 16:27:59.765 <6> [24285.851102] ;-Disabling non-boot CPUs ...
...
Line 13573: 11-03 16:28:43.678 <6> [24292.094583] ;-Disabling non-boot CPUs ...
Line 13675: 11-03 16:28:43.679 <6> [24292.115024] ;-Enabling non-boot CPUs ...

>From hilog_kmsg.023.20251103-171330:
Last normal log entry:
11-03 16:28:43.680 <6> [24292.437838] -sprd-vpu-pd: vpu_pd_dec:vpu_pw_off OK
11-03 16:28:43.680 <6> [24292.437887] -sprd-vpu-pd: vpu_pd_enc1:vpu_pw_off OK

System reboot after 45 minutes of silence:
11-03 17:13:29.991 <6> [0.000000] -Booting Linux on physical CPU 0x0000000000 [0x412fd050]

Analysis:

1. Deep Sleep Pattern: before bug appear The system enters deep sleep for about 13 times and each deep sleep then resume in one second,
wakeup by wifi and the phone behavior as wifi hot connect for many other devices  
   disabling all non-boot CPUs (CPUs 1-7), leaving only the boot CPU (CPU0) active.

2. Watchdog Vulnerability: During deep sleep:
   - Only CPU0 remains powered
   - Other CPUs cannot handle interrupts or run watchdog callback handlers
   - If CPU0 encounters a deadlock, the entire system freezes
   - Watchdog cannot detect the hang since no CPUs are available to schedule 
     watchdog processes

3. Timeline:
   - 16:05:37: Deep sleep cycles begin
   - 16:28:43: Last successful log entry before hang
   - 17:13:30: System forcibly rebooted after ~45 minutes of unresponsiveness

4. Additional Context: We observe frequent GPU and WLAN sleep/wake cycles, 
   but the primary issue appears related to CPU power management during deep sleep.

in my attachment Proposed Solution:

It contain patches and kernel/cpu.c file after apply patches

I recommend modifying the deep sleep implementation to keep additional CPUs 
(e.g., CPU1 and CPU2) powered during deep sleep states. This would ensure:

- Watchdog processes have available CPUs for scheduling
- System can detect and recover from CPU0 deadlocks
- Maintain proper crash dump collection and system logging during hangs

 


BestRegards
Fengtian Guo


Attachment: fengtian_cpu0_fix_patch_and_source.zip
Description: fengtian_cpu0_fix_patch_and_source.zip