Bug 211227 - [BISECTED][REGRESSION] Linux 5.10.7 breaks s3 resume on opal encrypted ssd
Summary: [BISECTED][REGRESSION] Linux 5.10.7 breaks s3 resume on opal encrypted ssd
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: SCSI (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: linux-scsi@vger.kernel.org
Depends on:
Reported: 2021-01-16 07:08 UTC by chriscjsus
Modified: 2021-03-31 12:37 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.10.7
Tree: Mainline
Regression: Yes

Debug patch. (1.75 KB, patch)
2021-02-19 18:44 UTC, Bart Van Assche
Details | Diff

Description chriscjsus 2021-01-16 07:08:09 UTC
In linux 4.14 the ability to resume from s3/sleep on an opal hardware encrypted SATA ssd was added, by unlocking the drive on resume from s3.


Linux 5.10.7 breaks that.  The ssd is not unlocked on resume from s3.  I am able to do an alt-sysreq-b reboot to an installation medium to verify that its not unlocked.  Reverting to 5.10.6 fixes that. This also occurs in linux 5.11. 

I bisected this to commit 271822bbf9fea586aabdcd3b10b303837863ccce
scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE

$ git bisect log
git bisect start

 bad: [659361086d8b2ee2c8318f390029a350a6e7fb61] Linux 5.10.7
git bisect bad 659361086d8b2ee2c8318f390029a350a6e7fb61

 good: [5650152ddab1a6b367e6804deea344e001bd656e] Linux 5.10.6
git bisect good 3a009ea166de1d0b804ddc6274b559c2ce0eebf3

 bad: [cb5a170e979e7d1b15185c9943c546bda2bc6445] powerpc: Handle .text.{hot,unlikely}.* in linker script
git bisect bad cb5a170e979e7d1b15185c9943c546bda2bc6445

 good: [0d6eeee3b9d4e08a9698038998d2752f157207f3] erspan: fix version 1 check in gre_parse_header()
git bisect good 0d6eeee3b9d4e08a9698038998d2752f157207f3

 good: [46e4355836104706853819244adf21ae1e3cd621] scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff()
git bisect good 46e4355836104706853819244adf21ae1e3cd621

 bad: [8532d3ec57e55e7df3c1f04fcf1b67d7610cb69c] lib/genalloc: fix the overflow when size is too big
git bisect bad 8532d3ec57e55e7df3c1f04fcf1b67d7610cb69c

 good: [2d8b9f991de7c86fe64b09efedff75562036ba0e] scsi: ide: Do not set the RQF_PREEMPT flag for sense requests
git bisect good 2d8b9f991de7c86fe64b09efedff75562036ba0e

 good: [a97d55de10aa7d75eca047adeaaee3a11cd64a09] scsi: scsi_transport_spi: Set RQF_PM for domain validation commands
git bisect good a97d55de10aa7d75eca047adeaaee3a11cd64a09

 bad: [2179bae04b12532812e7c9eb9cc5fa6d4131e577] local64.h: make <asm/local64.h> mandatory
git bisect bad 2179bae04b12532812e7c9eb9cc5fa6d4131e577

 bad: [271822bbf9fea586aabdcd3b10b303837863ccce] scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE
git bisect bad 271822bbf9fea586aabdcd3b10b303837863ccce

 first bad commit: [271822bbf9fea586aabdcd3b10b303837863ccce] scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE
Comment 1 Bart Van Assche 2021-02-19 18:43:28 UTC
Thank you for having reported this. Please apply the attached patch to kernel v5.11 and report which kernel warnings are reported when booting the resulting patched kernel. Please note that the attached patch is not a fix but rather an attempt to extract more information about how the SED OPAL code is incompatible with the Linux power management model.
Comment 2 Bart Van Assche 2021-02-19 18:44:27 UTC
Created attachment 295369 [details]
Debug patch.
Comment 3 chriscjsus 2021-02-20 15:13:30 UTC
I patched kernel 5.10.17 and there was no debug messages from your patch in either the console, dmesg, or the journal.  I booted with parameters no_console_suspend=1 and ignore_loglevel.

Your patch does however fix the issue.

If I boot without your patch, resume from S3 hangs and I need to reboot using alt-sysreq-b.

If I boot with your patch, resume from S3 is normal and the drive is obviously being unlocked.  When power is cut from the drive during S3, it locks itself automatically and needs to be unlocked by the kernel on resume.
Comment 4 chriscjsus 2021-02-20 15:27:02 UTC
Forgot to mention that CONFIG_PM=y in the kernel configs that I use.
Comment 5 chriscjsus 2021-03-31 12:37:53 UTC
Fixed in 5.10.20 and 5.11.3.

Note You need to log in before you can comment on or make changes to this bug.