Skip to content

Commit 186c204

Browse files
Bowen Youopsiff
authored andcommitted
Fix SDEI state machine issue during reboot process
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8325 -------------------------------- Add sdei event status check in sdei pm notifier, If event is already unregistered, don't do disable/enable in pm notifier. In this way, we can prevent incorrect state transitions, e.g., disabling or enabling after unregistering. Fixes: c8f96adca7fa ("arm64/watchdog: fix watchdog failure in low power scenarios") Signed-off-by: Bowen You <youbowen2@huawei.com> (cherry picked from commit 4f1e47d2241d253a802be3e0f5288626a590bec5) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 2542fa9 commit 186c204

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

arch/arm64/kernel/watchdog_sdei.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,27 @@ static int sdei_watchdog_pm_notifier(struct notifier_block *nb,
114114
unsigned long action, void *data)
115115
{
116116
int rv = 0;
117+
u64 result;
117118

118119
WARN_ON_ONCE(preemptible());
119120

121+
/*
122+
* Judge event status before disable or enable to prevent
123+
* incorrect state transitions, e.g., disabling after
124+
* unregistering.
125+
*/
126+
rv = sdei_api_event_status(sdei_watchdog_event_num, &result);
127+
if (rv)
128+
goto error;
129+
if (!result)
130+
goto success;
131+
132+
/*
133+
* After powering on/off the LPI (Low Power Idle),
134+
* the enable function must be called to enable the
135+
* EL3 Secure Timer, ensuring proper handling of
136+
* secure timer functionality.
137+
*/
120138
switch (action) {
121139
case CPU_PM_ENTER:
122140
if (per_cpu(sdei_usr_en, smp_processor_id()))
@@ -131,9 +149,10 @@ static int sdei_watchdog_pm_notifier(struct notifier_block *nb,
131149
return NOTIFY_DONE;
132150
}
133151

152+
error:
134153
if (rv)
135154
return notifier_from_errno(rv);
136-
155+
success:
137156
return NOTIFY_OK;
138157
}
139158

0 commit comments

Comments
 (0)