ACPI: PM: s2idle: Add module parameter for LPS0 constraints checking
Rafael J. Wysocki
maintainerPATCH 1/1 ACPI: PM: s2idle: Add module parameter for LPS0 constraints checking
From: Rafael J. Wysocki <[email protected]>
Commit 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0 _DSM Function 1 in lps0_device_attach() because pm_debug_messages_on might never be set (and that is the case on production systems most of the time), but it turns out that LPS0 _DSM Function 1 is generally problematic on some platforms and causes suspend issues to occur when pm_debug_messages_on is set now.
In Linux, LPS0 _DSM Function 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the other pm_debug_messages_on diagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.
For this reason, add a module parameter called check_lps0_constraints to control whether or not the list of LPS0 constraints will be checked in acpi_s2idle_prepare_late_lps0() and so whether or not to evaluate LPS0 _DSM Function 1 (once) in acpi_s2idle_begin_lps0().
--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/x86/s2idle.c +6 -2
@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" ); +static const struct acpi_device_id lps0_device_ids[] = { {"PNP0D80" , }, {"" , },
@@ -515,7 +519,7 @@ static struct acpi_scan_handler lps0_hanstatic int acpi_s2idle_begin_lps0 (void ) { -if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on && +if (lps0_device_handle && !sleep_no_lps0 && check_lps0_constraints && !lpi_constraints_table) {if (acpi_s2idle_vendor_amd ())lpi_device_get_constraints_amd ();
@@ -540,7 +544,7 @@ static int acpi_s2idle_prepare_late_lps0if (!lps0_device_handle || sleep_no_lps0)return 0 ; -if (pm_debug_messages_on) +if (check_lps0_constraints)lpi_check_constraints ();/* Screen off */
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Commit
32ece31db4df("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0_DSMFunction 1 inlps0_device_attach()becausepm_debug_messages_onmight never be set (and that is the case on production systems most of the time), but it turns out that LPS0_DSMFunction 1 is generally problematic on some platforms and causes suspend issues to occur whenpm_debug_messages_onis set now.
Any ideas why it's causing problems? AML doing something it shouldn't?
Quoted 23 lines
In Linux, LPS0
_DSMFunction 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the otherpm_debug_messages_ondiagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.For this reason, add a module parameter called
check_lps0_constraintsto control whether or not the list of LPS0 constraints will be checked inacpi_s2idle_prepare_late_lps0()and so whether or not to evaluate LPS0_DSMFunction 1 (once) inacpi_s2idle_begin_lps0().Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/x86/s2idle.c static bool sleep_no_lps0 __read_mostly; · line 33
Quoted 6 lines
drivers/acpi/x86/s2idle.c +3
-0@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" );
I'm personally not really a fan of another module parameter for debugging. I know some other subsystem maintainers are very anti-module parameters too.
I did like having /sys/power/pm_debug_messages able to be a one stop shop for debugging messages at runtime.
So I had another idea I wanted to throw around. What if instead we had a file /sys/kernel/debug/x86/lps0_constraints?
If the file is never accessed never evaluate constraints. If you read it once then you can get a dump of all the current constraints and any future suspends during that boot will also include constraints in the logs (IE call lpi_check_constraints()).
Quoted 25 lines
drivers/acpi/x86/s2idle.c +3
-2+static const struct acpi_device_id lps0_device_ids[] = { {"PNP0D80" , }, {"" , },@@ -515,7 +519,7 @@ static struct acpi_scan_handler lps0_hanstatic int acpi_s2idle_begin_lps0 (void ) { -if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on && +if (lps0_device_handle && !sleep_no_lps0 && check_lps0_constraints && !lpi_constraints_table) {if (acpi_s2idle_vendor_amd ())lpi_device_get_constraints_amd ();@@ -540,7 +544,7 @@ static int acpi_s2idle_prepare_late_lps0if (!lps0_device_handle || sleep_no_lps0)return 0 ; -if (pm_debug_messages_on) +if (check_lps0_constraints)lpi_check_constraints ();/* Screen off */
Rafael J. Wysocki
maintainerQuoted 11 lines · Mario Limonciello
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Commit
32ece31db4df("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0_DSMFunction 1 inlps0_device_attach()becausepm_debug_messages_onmight never be set (and that is the case on production systems most of the time), but it turns out that LPS0_DSMFunction 1 is generally problematic on some platforms and causes suspend issues to occur whenpm_debug_messages_onis set now.
Quoted 1 line
Any ideas why it's causing problems? AML doing something it shouldn't?
It's not a clear AML bug AFAICS. Rather, it seems to have dependencies on something that is not ready when it is evaluated, so an ordering issue or similar.
Quoted 34 lines
Quoted 23 lines
In Linux, LPS0
_DSMFunction 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the otherpm_debug_messages_ondiagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.For this reason, add a module parameter called
check_lps0_constraintsto control whether or not the list of LPS0 constraints will be checked inacpi_s2idle_prepare_late_lps0()and so whether or not to evaluate LPS0_DSMFunction 1 (once) inacpi_s2idle_begin_lps0().Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/acpi/x86/s2idle.c static bool sleep_no_lps0 __read_mostly; · line 33
Quoted 6 lines
drivers/acpi/x86/s2idle.c +3
-0@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" );I'm personally not really a fan of another module parameter for debugging. I know some other subsystem maintainers are very anti-module parameters too.
Quoted 2 lines
I did like having
/sys/power/pm_debug_messagesable to be a one stop shop for debugging messages at runtime.
Well, this is not just debug messages, rather a whole debug facility enabled via pm_debug_messages, which is kind of confusing.
Quoted 2 lines
So I had another idea I wanted to throw around. What if instead we had a file
/sys/kernel/debug/x86/lps0_constraints?
Then you cannot use this without debugfs.
Quoted 4 lines
If the file is never accessed never evaluate constraints. If you read it once then you can get a dump of all the current constraints and any future suspends during that boot will also include constraints in the logs (IE call
lpi_check_constraints()).
So if it is not in debugfs, it would need to be in sysfs and then I don't see much difference between it and a module param, honestly.
I actually prefer the latter because it uses an existing infra.
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Mario Limonciello
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Commit
32ece31db4df("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0_DSMFunction 1 inlps0_device_attach()becausepm_debug_messages_onmight never be set (and that is the case on production systems most of the time), but it turns out that LPS0_DSMFunction 1 is generally problematic on some platforms and causes suspend issues to occur whenpm_debug_messages_onis set now.
Quoted 5 lines
Quoted 1 line
Any ideas why it's causing problems? AML doing something it shouldn't?
It's not a clear AML bug AFAICS. Rather, it seems to have dependencies on something that is not ready when it is evaluated, so an ordering issue or similar.
Ah I see.
Quoted 35 lines
Quoted 35 lines
Quoted 24 lines
In Linux, LPS0
_DSMFunction 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the otherpm_debug_messages_ondiagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.For this reason, add a module parameter called
check_lps0_constraintsto control whether or not the list of LPS0 constraints will be checked inacpi_s2idle_prepare_late_lps0()and so whether or not to evaluate LPS0_DSMFunction 1 (once) inacpi_s2idle_begin_lps0().Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/acpi/x86/s2idle.c static bool sleep_no_lps0 __read_mostly; · line 33
Quoted 6 lines
drivers/acpi/x86/s2idle.c +3
-0@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" );I'm personally not really a fan of another module parameter for debugging. I know some other subsystem maintainers are very anti-module parameters too.
Quoted 5 lines
Quoted 2 lines
I did like having
/sys/power/pm_debug_messagesable to be a one stop shop for debugging messages at runtime.Well, this is not just debug messages, rather a whole debug facility enabled via
pm_debug_messages, which is kind of confusing.
Good point.
Quoted 5 lines
Quoted 3 lines
So I had another idea I wanted to throw around. What if instead we had a file
/sys/kernel/debug/x86/lps0_constraints?Then you cannot use this without debugfs.
I mean; yeah. But it really is debugging and most distros have debugfs enabled by default these days don't they?
Quoted 10 lines
Quoted 5 lines
If the file is never accessed never evaluate constraints. If you read it once then you can get a dump of all the current constraints and any future suspends during that boot will also include constraints in the logs (IE call
lpi_check_constraints()).So if it is not in debugfs, it would need to be in sysfs and then I don't see much difference between it and a module param, honestly.
I actually prefer the latter because it uses an existing infra.
I agree if debugfs is decided to be out sysfs and module parameter are equal footing and then this patch makes sense.
Rafael J. Wysocki
maintainerQuoted 66 lines · Mario Limonciello
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Mario Limonciello
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Commit
32ece31db4df("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0_DSMFunction 1 inlps0_device_attach()becausepm_debug_messages_onmight never be set (and that is the case on production systems most of the time), but it turns out that LPS0_DSMFunction 1 is generally problematic on some platforms and causes suspend issues to occur whenpm_debug_messages_onis set now.Quoted 5 lines
Quoted 1 line
Any ideas why it's causing problems? AML doing something it shouldn't?
It's not a clear AML bug AFAICS. Rather, it seems to have dependencies on something that is not ready when it is evaluated, so an ordering issue or similar.
Ah I see.
Quoted 35 lines
Quoted 35 lines
Quoted 24 lines
In Linux, LPS0
_DSMFunction 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the otherpm_debug_messages_ondiagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.For this reason, add a module parameter called
check_lps0_constraintsto control whether or not the list of LPS0 constraints will be checked inacpi_s2idle_prepare_late_lps0()and so whether or not to evaluate LPS0_DSMFunction 1 (once) inacpi_s2idle_begin_lps0().Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/acpi/x86/s2idle.c static bool sleep_no_lps0 __read_mostly; · line 33
Quoted 6 lines
drivers/acpi/x86/s2idle.c +3
-0@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" );I'm personally not really a fan of another module parameter for debugging. I know some other subsystem maintainers are very anti-module parameters too.
Quoted 5 lines
Quoted 2 lines
I did like having
/sys/power/pm_debug_messagesable to be a one stop shop for debugging messages at runtime.Well, this is not just debug messages, rather a whole debug facility enabled via
pm_debug_messages, which is kind of confusing.Good point.
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So I had another idea I wanted to throw around. What if instead we had a file
/sys/kernel/debug/x86/lps0_constraints?Then you cannot use this without debugfs.
I mean; yeah. But it really is debugging and most distros have debugfs enabled by default these days don't they?
Some of them don't.
That's one of the reasons why tracing has its own pseudo-filesystem now, so it is a real obstacle.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
If the file is never accessed never evaluate constraints. If you read it once then you can get a dump of all the current constraints and any future suspends during that boot will also include constraints in the logs (IE call
lpi_check_constraints()).
Quoted 7 lines
Quoted 4 lines
So if it is not in debugfs, it would need to be in sysfs and then I don't see much difference between it and a module param, honestly.
I actually prefer the latter because it uses an existing infra.
I agree if debugfs is decided to be out sysfs and module parameter are equal footing and then this patch makes sense.
I think that debugfs cannot be relied on to be always present.
Mario Limonciello (AMD) (kernel.org)
Reviewed-byQuoted 90 lines · Rafael J. Wysocki
Quoted 66 lines · Mario Limonciello
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Mario Limonciello
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Commit
32ece31db4df("ACPI: PM: s2idle: Only retrieve constraints when needed") attempted to avoid useless evaluation of LPS0_DSMFunction 1 inlps0_device_attach()becausepm_debug_messages_onmight never be set (and that is the case on production systems most of the time), but it turns out that LPS0_DSMFunction 1 is generally problematic on some platforms and causes suspend issues to occur whenpm_debug_messages_onis set now.Quoted 5 lines
Quoted 1 line
Any ideas why it's causing problems? AML doing something it shouldn't?
It's not a clear AML bug AFAICS. Rather, it seems to have dependencies on something that is not ready when it is evaluated, so an ordering issue or similar.
Ah I see.
Quoted 35 lines
Quoted 35 lines
Quoted 24 lines
In Linux, LPS0
_DSMFunction 1 is only useful for diagnostics and only in the cases when the system does not reach the deepest platform idle state during suspend-to-idle for some reason. If such diagnostics is not necessary, evaluating it is a loss of time, so using it along with the otherpm_debug_messages_ondiagnostics is questionable because the latter is expected to be suitable for collecting debug information even during production use of system suspend.For this reason, add a module parameter called
check_lps0_constraintsto control whether or not the list of LPS0 constraints will be checked inacpi_s2idle_prepare_late_lps0()and so whether or not to evaluate LPS0_DSMFunction 1 (once) inacpi_s2idle_begin_lps0().Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/x86/s2idle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/acpi/x86/s2idle.c static bool sleep_no_lps0 __read_mostly; · line 33
Quoted 6 lines
drivers/acpi/x86/s2idle.c +3
-0@@ -28,6 +28,10 @@ static bool sleep_no_lps0 __read_mostly;module_param (sleep_no_lps0, bool,0644 );MODULE_PARM_DESC (sleep_no_lps0,"Do not use the special LPS0 device interface" ); +static bool check_lps0_constraints__read_mostly ; +module_param (check_lps0_constraints, bool,0644 ); +MODULE_PARM_DESC (check_lps0_constraints,"Check LPS0 device constraints" );I'm personally not really a fan of another module parameter for debugging. I know some other subsystem maintainers are very anti-module parameters too.
Quoted 5 lines
Quoted 2 lines
I did like having
/sys/power/pm_debug_messagesable to be a one stop shop for debugging messages at runtime.Well, this is not just debug messages, rather a whole debug facility enabled via
pm_debug_messages, which is kind of confusing.Good point.
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So I had another idea I wanted to throw around. What if instead we had a file
/sys/kernel/debug/x86/lps0_constraints?Then you cannot use this without debugfs.
I mean; yeah. But it really is debugging and most distros have debugfs enabled by default these days don't they?
Some of them don't.
That's one of the reasons why tracing has its own pseudo-filesystem now, so it is a real obstacle.
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
If the file is never accessed never evaluate constraints. If you read it once then you can get a dump of all the current constraints and any future suspends during that boot will also include constraints in the logs (IE call
lpi_check_constraints()).So if it is not in debugfs, it would need to be in sysfs and then I don't see much difference between it and a module param, honestly.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I actually prefer the latter because it uses an existing infra.
I agree if debugfs is decided to be out sysfs and module parameter are equal footing and then this patch makes sense.
I think that debugfs cannot be relied on to be always present.
OK, I think the patch is fine as is then.