This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3354: Freeze not working

Part Number: AM3354


Tool/software: Linux

Hi we use our own Yocto Distro and Custom-Hardware and have some strange behaviour that freeze is not working. It will wake up immediately and giving an error for the write to /sys/power state:

root:~# echo freeze > /sys/power/state
-sh: echo: write error: Invalid argument
root:~# echo $?
1

But /sys/power/state is populated ad the other states work:

root@:~# cat  /sys/power/state
freeze standby mem

There is no error in dmesg:

[12666.154766] PM: Syncing filesystems ... done.
[12666.161251] PM: Preparing system for sleep (freeze)
[12666.175630] Freezing user space processes ... (elapsed 0.005 seconds) done.
[12666.180876] Freezing remaining freezable tasks ...
[12666.186109] (elapsed 0.005 seconds)
[12666.186113] done.
[12666.186120] PM: Suspending system (freeze)
[12666.186146] PM: Finishing wakeup.
[12666.186150] Restarting tasks ...
[12666.190843] done.

We are using Linux 4.9 and the relevant configs are:

#
# Power management options
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_SUSPEND_SKIP_SYNC is not set
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
# CONFIG_PM_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_ADVANCED_DEBUG is not set
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_APM_EMULATION is not set
CONFIG_PM_OPP=y
CONFIG_PM_CLK=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
CONFIG_CPU_PM=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM_CPU_SUSPEND=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_NET=y
CONFIG_NET_INGRESS=y

My understandig is that freeze is a Software only state so the should be no Hardware support needed. Is there a Way to find our what caused the freezer to fail?

  • Hello Paul,

    Good catch. TI does not support freeze, but upstream requires the option to be there. Apparently freeze used to crash the processor, so now they avoid a crash by outputting that write error you see.

    I will add the fact that freeze is not supported to our current documentation. I plan to put it somewhere here, but if I put it elsewhere I will try to come back and update this post.

    Regards, 

    Nick

  • Hi Nick

    Thank you for the very fast answer but I am a little surprised. Linux Documentation states:

    state:		Suspend-To-Idle
    ACPI state:	S0
    Label:		"freeze"
    
    This state is a generic, pure software, light-weight, system sleep state.
    It allows more energy to be saved relative to runtime idle by freezing user
    space and putting all I/O devices into low-power states (possibly
    lower-power than available at run time), such that the processors can
    spend more time in their idle states.
    
    This state can be used for platforms without Power-On Suspend/Suspend-to-RAM
    support, or it can be used in addition to Suspend-to-RAM (memory sleep)
    to provide reduced resume latency.  It is always supported.

    So TI should not have to do anything in this state. The state should only freeze user space and freezable kernel tasks so the CPU can switch to it's Idle state more often. How can this crash the CPU? If you're driver is doing something that crashes the CPU maybe you just should deactivate that feature. Because as stated in Kernel Documentation the Hardware is not actually required to do anything, BUT the mode should ALWAYS be supported

  • Hello Paul, 

    Freeze was added by the community, not TI. Freeze is not supported at this time on TI platforms.

    We provided feedback that freeze does not work on TI platforms, but TI is not in charge of updating the kernel documentation. We suggest you look at mem or standby instead.

    Regards, 

    Nick

  • Hi Nick

    This still makes no sense to me. Freeze is a pure software state. There should be nothing TI needs to do. For the CPU there should just be less work to do. So the is nothing to implement or support. But somehow this Linux function is broken on AM335x so I assume a driver does something it should not which is a Bug.

    Do you know were this error is thrown in the kernel source?

    mem and standby are working no problem but we need some minimal functionality while saving as much power as possible so I was looking at freeze, because it does not stop the whole kernel.
  • Hello Paul,

    kernel/power/suspend.c would be a starting point in tracking down where the error is happening.

    Regards,
    Nick
  • Hello Paul,

    I am going to close the thread on my side. Please let us know if there are any updates or additional questions pop up!

    Regards,
    Nick