Linux从空闲循环挂起到RAM

时间:2021-02-23 15:49:30

I have a question regarding STR (Suspend To RAM) in the Linux kernel.

我有一个关于Linux内核中STR(Suspend To RAM)的问题。

I am working on a small embedded Linux (Kernel 3.4.22) and I want to implement a mechanism that will put the system into sleep (suspend to ram) while it has nothing to do.

我正在开发一个小型嵌入式Linux(Kernel 3.4.22),我想实现一种机制,让系统进入休眠状态(挂起ram),而它无关紧要。

This is done in order to save power.

这样做是为了节省电力。

The HW support RAM self-refresh meaning its content will stay persistence. And I'll take care of all the rest things which should be done (e.g keeping CPU context etc…)

硬件支持RAM自刷新意味着其内容将保持持久性。我会处理应该做的所有其他事情(例如保持CPU上下文等......)

I want to trigger the Kernel PM (power management) subsystem from within the idle loop. When the system has nothing to do, it should go into sleep.

我想从空闲循环内触发内核PM(电源管理)子系统。当系统无事可做时,它应该进入睡眠状态。

The HW also supports a way to wake up the system.

HW还支持唤醒系统的方法。

Doing some research, I have found out that Linux gives an option for the user space to switch to STR by writing "echo "mem" > /sys/power/state". This will trigger the PM subsystem and will perform the relevant callbacks.

做了一些研究,我发现Linux通过编写“echo”mem“> / sys / power / state”为用户空间提供了切换到STR的选项。这将触发PM子系统并执行相关的回调。

My questions are: Is there any other standard alternative to go into STR besides writing to the above proc?

我的问题是:除了写上述过程之外,还有其他标准替代方案进入STR吗?

Did anyone tried to put the system into STR from the idle loop code ?

有没有人试图将系统从空闲循环代码中放入STR?

Thanks,

2 个解决方案

#1


0  

Why would you need another method? Linux treats everything as a file. Is it any surprise that the contents of a psudo-file dictate the state of the system? Check for yourself. pm-utils is a popular tool set for managing the state of the system. All the commands are just calls to /sys files.

你为什么需要另一种方法? Linux将所有内容视为文件。 psudo文件的内容是否决定了系统的状态,这有什么意外吗?检查自己。 pm-utils是一种用于管理系统状态的流行工具集。所有命令只是对/ sys文件的调用。

#2


0  

This policy is actually platform dependent. You would have to look at the cpuidle driver for your platform to understand what it is doing. For example, on atmel platforms, it is using both RAM self refresh and WFI.

此策略实际上取决于平台。您必须查看平台的cpuidle驱动程序才能了解它正在做什么。例如,在atmel平台上,它使用RAM自刷新和WFI。

#1


0  

Why would you need another method? Linux treats everything as a file. Is it any surprise that the contents of a psudo-file dictate the state of the system? Check for yourself. pm-utils is a popular tool set for managing the state of the system. All the commands are just calls to /sys files.

你为什么需要另一种方法? Linux将所有内容视为文件。 psudo文件的内容是否决定了系统的状态,这有什么意外吗?检查自己。 pm-utils是一种用于管理系统状态的流行工具集。所有命令只是对/ sys文件的调用。

#2


0  

This policy is actually platform dependent. You would have to look at the cpuidle driver for your platform to understand what it is doing. For example, on atmel platforms, it is using both RAM self refresh and WFI.

此策略实际上取决于平台。您必须查看平台的cpuidle驱动程序才能了解它正在做什么。例如,在atmel平台上,它使用RAM自刷新和WFI。