Samsung / TizenRT

TizenRT is a lightweight RTOS-based platform to support low-end IoT devices
Apache License 2.0
562 stars 561 forks source link

os/arch/arm/src/amebasmart: Improve power efficiency for RTL8730E #6187

Closed edwakuwaku closed 1 month ago

edwakuwaku commented 2 months ago
sunghan-chang commented 2 months ago

@ritesh55555 Could you share our test result with this PR?

edwakuwaku commented 2 months ago

In my understanding, the WFE is a cpu sleep, and pending for any event to happen, which means any task with higher priority will be able to trigger the core to handle some operation (ie. context switch). This WFE is different from the power save (ie. Power gating mode), although we call both of them as sleep. But PG sleep is shutting down the core (ie. power lost), whereas WFE is just a kind of rest (?) for the cpu.

ritesh55555 commented 2 months ago

In my understanding, the WFE is a cpu sleep, and pending for any event to happen, which means any task with higher priority will be able to trigger the core to handle some operation (ie. context switch). This WFE is different from the power save (ie. Power gating mode), although we call both of them as sleep. But PG sleep is shutting down the core (ie. power lost), whereas WFE is just a kind of rest (?) for the cpu.

hi @edwakuwaku , i have a doubt . Sometimes state changes happen very fast like within milliseconds . In that case , if we make the core to WFE mode and wake up again quickly , will it save power or it will have a negative impact . Is this scenario tested?

edwakuwaku commented 2 months ago

In my understanding, the WFE is a cpu sleep, and pending for any event to happen, which means any task with higher priority will be able to trigger the core to handle some operation (ie. context switch). This WFE is different from the power save (ie. Power gating mode), although we call both of them as sleep. But PG sleep is shutting down the core (ie. power lost), whereas WFE is just a kind of rest (?) for the cpu.

hi @edwakuwaku , i have a doubt . Sometimes state changes happen very fast like within milliseconds . In that case , if we make the core to WFE mode and wake up again quickly , will it save power or it will have a negative impact . Is this scenario tested?

I will not say the core really went to sleep and will be woken up like what we did in the power save (ie. PG sleep case). The core is actually still actively pending for event to trigger for doing operation. If we simplify the routine, you may think it as: while(1) {//no instruction, cpu actively running, thus execution result in higher power consumption} while(1) {"WFE" do nothing, the cpu treat it as an infinite "NOP", when cpu execute this instruction, it act as go to "sleep" and pending for event to happen, thus saving power)

I have tested the basic power save cycle, and found that the total power consumption is much lesser, thus I conclude that "WFE" was taking effect. In conclusion, I don't think this will cause any negative impact as the asm instruction goes directly for cpu to stay pending for event (ie. I mean this change in cpu mode might react in a smaller time unit than we expect).

sunghan-chang commented 2 months ago

@ritesh55555 Could you share our test result with this PR?

@ritesh55555 Any update for test result? on operation and on power or current?

ritesh55555 commented 2 months ago

@ritesh55555 Could you share our test result with this PR?

@ritesh55555 Any update for test result? on operation and on power or current?

hi , operation is same as before. It is working as it should . because of lack of measuring device here,i have not yet tested regarding power and current . i will update it soon.

ewoodev commented 1 month ago

In my understanding, the WFE is a cpu sleep, and pending for any event to happen, which means any task with higher priority will be able to trigger the core to handle some operation (ie. context switch). This WFE is different from the power save (ie. Power gating mode), although we call both of them as sleep. But PG sleep is shutting down the core (ie. power lost), whereas WFE is just a kind of rest (?) for the cpu.

hello @edwakuwaku If the core enters the core while saving power with the WFE command, does the core will wakeup by the next tick irq or another hw irq?

is it used to just reduce meaningless behavior in idle thread?

edwakuwaku commented 1 month ago

In my understanding, the WFE is a cpu sleep, and pending for any event to happen, which means any task with higher priority will be able to trigger the core to handle some operation (ie. context switch). This WFE is different from the power save (ie. Power gating mode), although we call both of them as sleep. But PG sleep is shutting down the core (ie. power lost), whereas WFE is just a kind of rest (?) for the cpu.

hello @edwakuwaku If the core enters the core while saving power with the WFE command, does the core will wakeup by the next tick irq or another hw irq?

is it used to just reduce meaningless behavior in idle thread?

Hi @ewoodev , any ISR event will wakeup the core, HW irq is used to wakeup system from sleep. Both concept are different. I'm not sure what are you referring to "meaningless behaviour". This asm instruction is mainly just keeping core in low power state when there is no tasks ongoing, that's why we apply it in idle thread.

sunghan-chang commented 1 month ago

@edwakuwaku We can't verify this yet. Once we did, let you know and let me merge this. But it could be little bit some time later.

sunghan-chang commented 1 month ago

@gSahitya-samsung Once you check, please let us know result in operation and in power consumption.