fix: pm模块解冻线程时存在删除空链表且时间片频繁唤醒系统

1.如果冻结线程状态为delay,则此时pendlist为NULL,解冻时不需要delete
2.低功耗时关闭时间片,减少时间片频繁唤醒系统
3.risc-v 中64位相加存在溢出
Close #I4AKUS

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Icb9e8f7df8488635f9660d3932b06fa6f57e6133
This commit is contained in:
zhushengle 2021-09-17 20:08:57 +08:00
parent f1ac6bf160
commit 9f185b5b52
5 changed files with 20 additions and 10 deletions

View File

@ -255,7 +255,7 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
if (!tickTimerStop) {
currTime = OsGetCurrSchedTimeCycle();
OsSchedResetSchedResponseTime(0);
OsSchedSetNextExpireTime(currTime, OS_INVALID, OS_SCHED_MAX_RESPONSE_TIME, TRUE);
OsSchedUpdateExpireTime(currTime, TRUE);
}
sysSuspend = OsPmCpuSuspend(pm);
@ -685,8 +685,10 @@ VOID OsPmUnfreezeTaskUnsafe(UINT32 taskID)
}
SET_SORTLIST_VALUE(&taskCB->sortList, OS_SORT_LINK_INVALID_TIME);
LOS_ListDelete(&taskCB->pendList);
taskCB->taskStatus &= ~(OS_TASK_STATUS_DELAY | OS_TASK_STATUS_PEND_TIME);
if (taskCB->taskStatus & OS_TASK_STATUS_PEND) {
LOS_ListDelete(&taskCB->pendList);
}
taskCB->taskStatus &= ~(OS_TASK_STATUS_DELAY | OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_PEND);
return;
}

View File

@ -458,7 +458,6 @@ UINT32 LOS_PmReadLock(VOID);
*/
UINT32 LOS_PmSuspend(UINT32 wakeCount);
#if (LOSCFG_KERNEL_PM_DEBUG == 1)
/**
* @ingroup los_pm
* @brief Output the locking information of the pm lock.
@ -477,4 +476,3 @@ UINT32 LOS_PmSuspend(UINT32 wakeCount);
*/
VOID LOS_PmLockInfoShow(VOID);
#endif
#endif

View File

@ -52,12 +52,17 @@ WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler)
WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
{
UINT64 timeMax = (UINT64)LOSCFG_BASE_CORE_TICK_RESPONSE_MAX - 1;
UINT64 timer;
UINT32 timerL, timerH;
READ_UINT32(timerL, MTIMER);
READ_UINT32(timerH, MTIMER + MTIMER_HI_OFFSET);
timer = OS_COMBINED_64(timerH, timerL);
timer += nextResponseTime;
if ((timeMax - nextResponseTime) > timer) {
timer += nextResponseTime;
} else {
timer = timeMax;
}
HalIrqDisable(RISCV_MACH_TIMER_IRQ);
WRITE_UINT32(0xffffffff, MTIMERCMP + MTIMER_HI_OFFSET);

View File

@ -61,8 +61,6 @@ VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask);
UINT32 OsSchedSwtmrScanRegister(SchedScan func);
VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate);
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate);
VOID OsSchedTaskDeQueue(LosTaskCB *taskCB);

View File

@ -34,6 +34,9 @@
#include "los_tick.h"
#include "los_debug.h"
#include "los_hook.h"
#if (LOSCFG_KERNEL_PM == 1)
#include "los_pm.h"
#endif
#ifdef __cplusplus
#if __cplusplus
@ -179,7 +182,7 @@ STATIC INLINE VOID OsSchedTickReload(UINT64 nextResponseTime, UINT32 responseID,
HalSysTickReload(nextResponseTime);
}
VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate)
STATIC INLINE VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate)
{
UINT64 nextExpireTime;
UINT64 nextResponseTime = 0;
@ -216,6 +219,7 @@ VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEn
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate)
{
BOOL isPmMode = FALSE;
UINT64 endTime;
LosTaskCB *runTask = g_losTask.runTask;
@ -223,7 +227,10 @@ VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate)
return;
}
if (runTask->taskID != g_idleTaskID) {
#if (LOSCFG_KERNEL_PM == 1)
isPmMode = OsIsPmMode();
#endif
if ((runTask->taskID != g_idleTaskID) && !isPmMode) {
INT32 timeSlice = (runTask->timeSlice <= OS_TIME_SLICE_MIN) ? OS_SCHED_TIME_SLICES : runTask->timeSlice;
endTime = startTime + timeSlice;
} else {