2 Replies Latest reply on Oct 3, 2015 9:45 AM by JimR

    Edison occasionally hangs trying to suspend

    JimR

      I'm using release 2.1 ww18-15.  Most of the time when I suspend the edison (echo mem > /sys/power/state), suspend works.  I can wake the edison back up using the console (ttyMFD2).

       

      Occasionally, when I suspend the edison it hangs and remains unresponsive until the watchdog fires and resets the system.

       

      To debug, I added "no_console_suspend=1" to the kernel arguments in u-boot.  Then I added a printk in drivers/base/power/main.c:dpm_suspend() before device_suspend() is called for each device.

       

      I compared a list of all devices being suspended when sleep fails and when sleep succeeds and the list is the same until it hangs in the failure.  The last device being suspended before the hang is "mmc0:0001".

       

      Here's the end of the output when suspend fails:

      suspending device mmcblk0p2

      suspending device mmcblk0p1

      suspending device mmcblk0

      suspending device 179:0

      suspending device mmc0:0001


      Here's an excerpt of the corresponding output when suspend works:

      suspending device mmcblk0p2

      suspending device mmcblk0p1

      suspending device mmcblk0

      suspending device 179:0

      suspending device mmc0:0001

      suspending device mmc0

      suspending device cooling_device0

      suspending device hwmon5

      suspending device thermal_zone4

        • 1. Re: Edison occasionally hangs trying to suspend
          JimR

          I believe this is a bug in the Intel code added for RPMB partition support.  The call to mmc_claim_host() blocks sometimes because sometimes the mmc host is still claimed.

           

          This is the commit that added the code:

          commit 9e36a6d9898a3bc9433778a42d1c8dbf9e522299

          Author: Rodriguez Fabien <fabienx.rodriguez@intel.com>

          Date:   Wed Oct 29 09:54:49 2014 +0100

           

              mmc: rpmb partition support

             

              This patch contains all bugs fixing for supporting RPMB partition

              in MMC driver side.

             

              Signed-off-by: Rodriguez Fabien <fabienx.rodriguez@intel.com>

           

          This is the specific code that is causing a problem in drivers/mmc/card/block.c:

           

          static int mmc_blk_suspend(struct mmc_card *card)

          {

            struct mmc_blk_data *part_md;

            struct mmc_blk_data *md = mmc_get_drvdata(card);

           

            if (md) {

            mmc_queue_suspend(&md->queue);

            list_for_each_entry(part_md, &md->part, part) {

            mmc_queue_suspend(&part_md->queue);

          + if (part_md->part_type ==

          + EXT_CSD_PART_CONFIG_ACC_RPMB) {

          + /*

          + * RPMB partition is accessed by API directly.

          + * Driver need to set a flag when suspending

          + * MMC block device to notify API that the

          + * accessing of RPMB partition needs to be

          + * stopped

          + */

          + mmc_claim_host(card->host);

          + part_md->flags |= MMC_BLK_SUSPENDED;

          + mmc_release_host(card->host);

          + }

            }

            }

            return 0;

          }

          • 2. Re: Edison occasionally hangs trying to suspend
            JimR

            I believe that I have found the root cause.  There was a bug in the kernel that was leaking the mmc host claim.  A commit to the kernel after 3.10 fixes the issue for me.  The hang is rare on the stock intel 2.1 release.  It only happened one in ten boots or less but suspend would hang seven out of ten boots on my build with additional services.  After I backported the following fix, the system has successfully suspended 200+ times in a row.

             

            This is the commit that needs to be backported to the 3.10 linux kernel to prevent suspend from hanging on the edison:

            https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=f662ae48ae67dfd42739e65750274fe8de46240a