swsusp: Reduce code duplication between user.c and disk.c
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Quoted 7 lines
However, this modifies the user-observable behavior in such a way that if the user sets 'shutdown mode = platform' in the s2disk's configuration file, the kernel will use the hibernation mode resulting from the sysfs interface settings. That is, if there is 'shutdown mode = platform' in the s2disk's configuration file, but the hibernation mode is set to 'reboot' in the sysfs interface, the system will be rebooted instead of going for the 'ACPI
S0->S4transition'.
This I don't understand. Without looking at the code, it seems that you're invoking some common code that checks the sysfs file. Couldn't those functions take an argument instead? Or even kill off the ioctl interface completely and just use whatever was in the sysfs file (and change userland to change the sysfs file). There isn't much point in having two separate configuration entries for one thing, imho.
johannes
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Johannes Berg
Hi,
Quoted 7 lines
However, this modifies the user-observable behavior in such a way that if the user sets 'shutdown mode = platform' in the s2disk's configuration file, the kernel will use the hibernation mode resulting from the sysfs interface settings. That is, if there is 'shutdown mode = platform' in the s2disk's configuration file, but the hibernation mode is set to 'reboot' in the sysfs interface, the system will be rebooted instead of going for the 'ACPI
S0->S4transition'.
Quoted 3 lines
This I don't understand. Without looking at the code, it seems that you're invoking some common code that checks the sysfs file. Couldn't those functions take an argument instead?
I'll second this. Can we pass down an argument, meaning userland interface does not change?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Pavel Machek
Quoted 10 lines · Johannes Berg
Hi,
Quoted 7 lines
However, this modifies the user-observable behavior in such a way that if the user sets 'shutdown mode = platform' in the s2disk's configuration file, the kernel will use the hibernation mode resulting from the sysfs interface settings. That is, if there is 'shutdown mode = platform' in the s2disk's configuration file, but the hibernation mode is set to 'reboot' in the sysfs interface, the system will be rebooted instead of going for the 'ACPI
S0->S4transition'.
Quoted 6 lines
Quoted 3 lines
This I don't understand. Without looking at the code, it seems that you're invoking some common code that checks the sysfs file. Couldn't those functions take an argument instead?
I'll second this. Can we pass down an argument, meaning userland interface does not change?
Yes, we can. I'll have an updated patch in a couple of days.
Greetings,
Rafael
A message that is not in the archive (sent off-list or not yet received): [email protected]
cover swsusp: Reduce code duplication between user.c and disk.c (rev. 2)
Hi,
This two patches are aimed at reducing the code duplication between kernel/power/disk.c and kernel/power/user.c .
The first of them removes the calls to 'platform mode' functions from the restore part. As far as I can tell after reading the ACPI specification, they shouldn't be there.
The second patch actually removes the above-metntioned duplication of code.
Comments welcome.
Greetings,
Rafael
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC PATCH 1/2 swsusp: Remove platform callbacks from restore code
From: Rafael J. Wysocki <[email protected]>
The restore part of the hibernation code should not call any 'platform' functions, since it doesn't carry out any power transition of the system. Still, such functions are called from the restore code in kernel/power/user.c . Fix that.
--- kernel/power/user.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
kernel/power/user.c +4 -13
@@ -179,34 +179,25 @@ static inline int snapshot_suspend(int preturn error; } -static inline int snapshot_restore (int platform_suspend) +static inline int snapshot_restore (void ) {int error;mutex_lock (&pm_mutex);pm_prepare_console (); -if (platform_suspend) { - error =platform_prepare (); -if (error) - goto Finish; - }suspend_console (); error =device_suspend (PMSG_PRETHAW );if (error) - goto Resume_devices; + goto Finish; error =disable_nonboot_cpus ();if (!error) error =swsusp_resume ();enable_nonboot_cpus (); - Resume_devices: -if (platform_suspend) -platform_finish (); - + Finish:device_resume ();resume_console (); - Finish:pm_restore_console ();mutex_unlock (&pm_mutex);return error;
@@ -272,7 +263,7 @@ static int snapshot_ioctl(struct inode * error = -EPERM ;break ; } - error =snapshot_restore (data->platform_suspend); + error =snapshot_restore ();break ;case SNAPSHOT_FREE :
RFC PATCH 2/2 swsusp: Reduce code duplication between user.c and disk.c (rev. 2)
In reply to a message not in the archiveFrom: Rafael J. Wysocki <[email protected]>
Currently, much of the code in kernel/power/disk.c is duplicated in kernel/power/user.c , mainly for historical reasons. By eliminating this code duplication we can reduce the size of user.c quite substantially and remove the maintenance difficulty resulting from it.
--- kernel/power/disk.c | 184 ++++++++++++++++++++++++++++----------------------- kernel/power/power.h | 5 + kernel/power/user.c | 96 +------------------------- 3 files changed, 115 insertions(+), 170 deletions(-)
kernel/power/disk.c +104 -80
@@ -74,9 +74,9 @@ void hibernation_set_ops(struct hibernat* platform driver if so configured and return an error code if it fails */ -static int platform_prepare (void ) +static int platform_prepare (int platform_mode) { -return (hibernation_mode ==HIBERNATION_PLATFORM && hibernation_ops) ? +return (platform_mode && hibernation_ops) ? hibernation_ops->prepare () :0 ; }
@@ -85,20 +85,111 @@ static int platform_prepare(void)* using the platform driver (must be called after platform_prepare()) */ -static void platform_finish (void ) +static void platform_finish (int platform_mode) { -if (hibernation_mode ==HIBERNATION_PLATFORM && hibernation_ops) +if (platform_mode && hibernation_ops) hibernation_ops->finish (); }/** +* hibernation_snapshot - quiesce devices and create the hibernation +* snapshot image. +* @platform_mode - if set, use the platform driver, if available, to +* prepare the platform frimware for the power transition. +* +* Must be called with pm_mutex held +*/ + +int hibernation_snapshot (int platform_mode) +{ +int error; + +/* Free memory before shutting down devices. */ + error =swsusp_shrink_memory (); +if (error) + goto Finish; + + error =platform_prepare (platform_mode); +if (error) + goto Finish; + +suspend_console (); + error =device_suspend (PMSG_FREEZE ); +if (error) + goto Resume_devices; + + error =disable_nonboot_cpus (); +if (!error) { +if (hibernation_mode !=HIBERNATION_TEST ) { + in_suspend =1 ; + error =swsusp_suspend (); +/* Control returns here after successful restore */ + }else { +printk ("swsusp debug: Waiting for 5 seconds.\n" ); +mdelay (5000 ); + } + } +enable_nonboot_cpus (); + Resume_devices: +platform_finish (platform_mode); +device_resume (); +resume_console (); + Finish: +return error; +} + +/** +* hibernation_restore - quiesce devices and restore the hibernation +* snapshot image. If successful, control returns in hibernation_snaphot() +* +* Must be called with pm_mutex held +*/ + +int hibernation_restore (void ) +{ +int error; + +pm_prepare_console (); +suspend_console (); + error =device_suspend (PMSG_PRETHAW ); +if (error) + goto Finish; + + error =disable_nonboot_cpus (); +if (!error) + error =swsusp_resume (); + +enable_nonboot_cpus (); + Finish: +device_resume (); +resume_console (); +pm_restore_console (); +return error; +} + +/** +* hibernation_platform_enter - enter the hibernation state using the +* platform driver (if available) +*/ + +int hibernation_platform_enter (void ) +{ +if (hibernation_ops) { +kernel_shutdown_prepare (SYSTEM_SUSPEND_DISK ); +return hibernation_ops->enter (); + }else { +return -ENOSYS ; + } +} + +/** * power_down - Shut the machine down for hibernation. * * Use the platform driver, if configured so; otherwise try * to power off or reboot. */ -static void power_down (void ) +void power_down (void ) {switch (hibernation_mode) {case HIBERNATION_TEST :
@@ -111,11 +202,7 @@ static void power_down(void)kernel_restart (NULL );break ;case HIBERNATION_PLATFORM : -if (hibernation_ops) { -kernel_shutdown_prepare (SYSTEM_SUSPEND_DISK ); - hibernation_ops->enter (); -break ; - } +hibernation_platform_enter (); }kernel_halt ();/*
@@ -171,62 +258,17 @@ int hibernate(void)mdelay (5000 ); goto Thaw; } - -/* Free memory before shutting down devices. */ - error =swsusp_shrink_memory (); -if (error) - goto Thaw; - - error =platform_prepare (); -if (error) - goto Thaw; - -suspend_console (); - error =device_suspend (PMSG_FREEZE ); -if (error) { -printk (KERN_ERR "PM: Some devices failed to suspend\n" ); - goto Resume_devices; - } - error =disable_nonboot_cpus (); -if (error) - goto Enable_cpus; - -if (hibernation_mode ==HIBERNATION_TEST ) { -printk ("swsusp debug: Waiting for 5 seconds.\n" ); -mdelay (5000 ); - goto Enable_cpus; - } - -pr_debug ("PM: snapshotting memory.\n" ); - in_suspend =1 ; - error =swsusp_suspend (); -if (error) - goto Enable_cpus; - -if (in_suspend) { -enable_nonboot_cpus (); -platform_finish (); -device_resume (); -resume_console (); + error =hibernation_snapshot (hibernation_mode ==HIBERNATION_PLATFORM ); +if (in_suspend && !error) {pr_debug ("PM: writing image.\n" ); error =swsusp_write (); +swsusp_free ();if (!error)power_down (); -else { -swsusp_free (); - goto Thaw; - } }else {pr_debug ("PM: Image restored successfully.\n" ); +swsusp_free (); } - -swsusp_free (); - Enable_cpus: -enable_nonboot_cpus (); - Resume_devices: -platform_finish (); -device_resume (); -resume_console (); Thaw:mutex_unlock (&pm_mutex);unprepare_processes ();
@@ -301,29 +343,11 @@ static int software_resume(void)pr_debug ("PM: Reading swsusp image.\n" ); error =swsusp_read (); -if (error) { -swsusp_free (); - goto Thaw; - } - -pr_debug ("PM: Preparing devices for restore.\n" ); - -suspend_console (); - error =device_suspend (PMSG_PRETHAW ); -if (error) - goto Free; - - error =disable_nonboot_cpus ();if (!error) -swsusp_resume (); +hibernation_restore (); -enable_nonboot_cpus (); - Free: -swsusp_free (); -device_resume (); -resume_console (); - Thaw:printk (KERN_ERR "PM: Restore failed, recovering.\n" ); +swsusp_free ();unprepare_processes (); Done:free_basic_memory_bitmaps ();
@@ -333,7 +357,7 @@ static int software_resume(void) Unlock:mutex_unlock (&pm_mutex);pr_debug ("PM: Resume from disk failed.\n" ); -return 0 ; +return error; }late_initcall (software_resume);
kernel/power/power.h +4 -1
@@ -25,7 +25,10 @@ struct swsusp_info {*/ #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) -extern struct hibernation_ops *hibernation_ops; +/* kernel/power/disk.c */ +extern int hibernation_snapshot (int platform_mode); +extern int hibernation_restore (void ); +extern int hibernation_platform_enter (void );#endif extern struct mutex pm_mutex;
kernel/power/user.c +7 -89
123 lines not on this page · raw message
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
I expect http://bugzilla.kernel.org/show_bug.cgi?id=7887 this bug to pop again with this patch.
Regards,
Alex.
Quoted 69 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The restore part of the hibernation code should not call any 'platform' functions, since it doesn't carry out any power transition of the system. Still, such functions are called from the restore code in
kernel/power/user.c. Fix that.Signed-off-by Rafael J. Wysocki <[email protected]>--- kernel/power/user.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)Index:
linux-2.6.21/kernel/power/user.c
===================================================================kernel/power/user.c 2007-05-08 23:03:17.000000000 +0200 renamed from kernel/power/user.c 2007-05-08 22:10:36.000000000 +0200 +4
-13@@ -179,34 +179,25 @@ static inline int snapshot_suspend(int p return error; } -static inline int snapshot_restore(int platform_suspend) +static inline int snapshot_restore(void) { int error; mutex_lock(&pm_mutex); pm_prepare_console(); - if (platform_suspend) { - error = platform_prepare(); - if (error) - goto Finish; - } suspend_console(); error = device_suspend(PMSG_PRETHAW); if (error) - goto Resume_devices; + goto Finish; error = disable_nonboot_cpus(); if (!error) error = swsusp_resume(); enable_nonboot_cpus(); - Resume_devices: - if (platform_suspend) - platform_finish(); - + Finish: device_resume(); resume_console(); - Finish: pm_restore_console(); mutex_unlock(&pm_mutex); return error;@@ -272,7 +263,7 @@ static int snapshot_ioctl(struct inode * error = -EPERM; break; } - error = snapshot_restore(data->platform_suspend); + error = snapshot_restore(); break; case SNAPSHOT_FREE:_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
This patch will disable EC GPE, which seems to be major problem.
Regards,
Alex
Quoted 69 lines · Alexey Starikovskiy
I expect http://bugzilla.kernel.org/show_bug.cgi?id=7887 this bug to pop again with this patch.
Regards,
Alex.Quoted 62 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The restore part of the hibernation code should not call any 'platform' functions, since it doesn't carry out any power transition of the system. Still, such functions are called from the restore code in
kernel/power/user.c. Fix that.Signed-off-by Rafael J. Wysocki <[email protected]>--- kernel/power/user.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)Index:
linux-2.6.21/kernel/power/user.c
===================================================================kernel/power/user.c 2007-05-08 23:03:17.000000000 +0200 renamed from kernel/power/user.c 2007-05-08 22:10:36.000000000 +0200 +4
-13@@ -179,34 +179,25 @@ static inline int snapshot_suspend(int p return error; } -static inline int snapshot_restore(int platform_suspend) +static inline int snapshot_restore(void) { int error; mutex_lock(&pm_mutex); pm_prepare_console(); - if (platform_suspend) { - error = platform_prepare(); - if (error) - goto Finish; - } suspend_console(); error = device_suspend(PMSG_PRETHAW); if (error) - goto Resume_devices; + goto Finish; error = disable_nonboot_cpus(); if (!error) error = swsusp_resume(); enable_nonboot_cpus(); - Resume_devices: - if (platform_suspend) - platform_finish(); - + Finish: device_resume(); resume_console(); - Finish: pm_restore_console(); mutex_unlock(&pm_mutex); return error;@@ -272,7 +263,7 @@ static int snapshot_ioctl(struct inode * error = -EPERM; break; } - error = snapshot_restore(data->platform_suspend); + error = snapshot_restore(); break;
Quoted 8 lines
Quoted 7 lines
kernel/power/user.c 2007-05-08 23:03:17.000000000 +0200 renamed from kernel/power/user.c 2007-05-08 22:10:36.000000000 +0200 +0
-0case SNAPSHOT_FREE:_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Disable EC GPE during suspend/resume
From: <>
---
drivers/acpi/ec.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-)
drivers/acpi/ec.c +34 -0
@@ -79,6 +79,8 @@ static int acpi_ec_remove(struct acpi_device *device, int type);static int acpi_ec_start (struct acpi_device *device);static int acpi_ec_stop (struct acpi_device *device,int type);static int acpi_ec_add (struct acpi_device *device); +static int acpi_ec_suspend (struct acpi_device *device,pm_message_t state); +static int acpi_ec_resume (struct acpi_device *device);static struct acpi_driver acpi_ec_driver = { .name ="ec" ,
@@ -89,6 +91,8 @@ static struct acpi_driver acpi_ec_driver = { .remove = acpi_ec_remove, .start = acpi_ec_start, .stop = acpi_ec_stop, + .suspend = acpi_ec_suspend, + .resume = acpi_ec_resume, }, };
@@ -772,6 +776,36 @@ static int acpi_ec_stop(struct acpi_device *device, int type)return 0 ; } +static int acpi_ec_suspend (struct acpi_device *device,pm_message_t state) +{ +struct acpi_ec *ec; + +if (!device) +return -EINVAL ; + + ec =acpi_driver_data (device); +if (!ec) +return -EINVAL ; +acpi_disable_gpe (NULL , ec->gpe,ACPI_NOT_ISR ); + +return 0 ; +} + +static int acpi_ec_resume (struct acpi_device *device) +{ +struct acpi_ec *ec; + +if (!device) +return -EINVAL ; + + ec =acpi_driver_data (device); +if (!ec) +return -EINVAL ; +acpi_enable_gpe (NULL , ec->gpe,ACPI_NOT_ISR ); + +return 0 ; +} +static acpi_status ec_parse_device (acpi_handle handle,u32 Level,void *context,void **retval) {
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
In reply to a message not in the archiveQuoted 2 lines · Alexey Starikovskiy
I expect http://bugzilla.kernel.org/show_bug.cgi?id=7887 this bug to pop again with this patch.
Well, this change only reflects what's done in kernel/power/disk.c .
Greetings,
Rafael
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
Quoted 1 line · Alexey Starikovskiy
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
Rafael
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
we needed to call pm_prepare() on boot kernel only to disable GPEs to resolve 7887. It will also blink the LEDs during the resume image load, but it's possible to live without it.
If you drop call to pm_prepare(), we still need to disable GPEs, so they will not fire during image switch. So if we disable GPE in suspend() method of EC it will work as soon as there are no other so much active GPEs at boot time...
Quoted 8 lines · Rafael J. Wysocki
Quoted 1 line · Alexey Starikovskiy
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
Rafael
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
Quoted 7 lines · Alexey Starikovskiy
we needed to call
pm_prepare()on boot kernel only to disable GPEs to resolve 7887. It will also blink the LEDs during the resume image load, but it's possible to live without it.
If you drop call topm_prepare(), we still need to disable GPEs, so they will not fire during image switch. So if we disable GPE insuspend()method of EC it will work as soon as there are no other so much active GPEs at boot time...
Okay, I just wanted to clarify.
In that case, I think, we should add a special callback to disable the GPEs in the restore code path (before we restore the image).
I also think that it would be sufficient if this callback only executed the following loop:
status = acpi_hw_disable_all_gpes();
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}and it should be called right before disable_nonboot_cpus().
Is that correct?
Now, assumig that it's correct, we'll need a complementary callback to be executed in the restore error code paths, right after enable_nonboot_cpus(), to enable the GPEs if there's an error during the restore. I think it might contain the following code:
status = acpi_hw_enable_all_runtime_gpes();
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}Greetings,
Rafael
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Alexey Starikovskiy
Quoted 1 line
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
Rafael
Signature · 3 lines
If you don't have the time to read, you don't have the time or the tools to write. - Stephen King
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
Yes, something like that should do...
I'd prefer not to call ACPI functions from outside of drivers/acpi, but this could be cleaned later.
Quoted 60 lines · Rafael J. Wysocki
Quoted 7 lines · Alexey Starikovskiy
we needed to call
pm_prepare()on boot kernel only to disable GPEs to resolve 7887. It will also blink the LEDs during the resume image load, but it's possible to live without it.
If you drop call topm_prepare(), we still need to disable GPEs, so they will not fire during image switch. So if we disable GPE insuspend()method of EC it will work as soon as there are no other so much active GPEs at boot time...Okay, I just wanted to clarify.
In that case, I think, we should add a special callback to disable the GPEs in the restore code path (before we restore the image).
I also think that it would be sufficient if this callback only executed the following loop:
status = acpi_hw_disable_all_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }and it should be called right before
disable_nonboot_cpus().Is that correct?
Now, assumig that it's correct, we'll need a complementary callback to be executed in the restore error code paths, right after
enable_nonboot_cpus(), to enable the GPEs if there's an error during the restore. I think it might contain the following code:status = acpi_hw_enable_all_runtime_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }Greetings,
RafaelQuoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Alexey Starikovskiy
Quoted 1 line
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
Rafael--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
Quoted 10 lines · Rafael J. Wysocki
Quoted 3 lines · Alexey Starikovskiy
Yes, something like that should do...
I'd prefer not to call ACPI functions from outside ofdrivers/acpi, but this could be cleaned later.Actually, I was thinking of adding two operations to
hibernation_ops()(now, that we have it :-)).Would you mind if I made this change on top of 2/2, as a third patch in the series? That would be easier.
Go ahead :)
Quoted 71 lines
Quoted 57 lines · Rafael J. Wysocki
Quoted 54 lines · Alexey Starikovskiy
Quoted 7 lines
we needed to call
pm_prepare()on boot kernel only to disable GPEs to resolve 7887. It will also blink the LEDs during the resume image load, but it's possible to live without it.
If you drop call topm_prepare(), we still need to disable GPEs, so they will not fire during image switch. So if we disable GPE insuspend()method of EC it will work as soon as there are no other so much active GPEs at boot time...Okay, I just wanted to clarify.
In that case, I think, we should add a special callback to disable the GPEs in the restore code path (before we restore the image).
I also think that it would be sufficient if this callback only executed the following loop:
status = acpi_hw_disable_all_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }and it should be called right before
disable_nonboot_cpus().Is that correct?
Now, assumig that it's correct, we'll need a complementary callback to be executed in the restore error code paths, right after
enable_nonboot_cpus(), to enable the GPEs if there's an error during the restore. I think it might contain the following code:status = acpi_hw_enable_all_runtime_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }Greetings,
RafaelQuoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Alexey Starikovskiy
Quoted 1 line
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
RafaelQuoted 8 lines
Quoted 6 lines
--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King
Re: [RFC][PATCH -mm 1/2] swsusp: Remove platform callbacks from restore code
In reply to a message not in the archiveQuoted 3 lines · Alexey Starikovskiy
Yes, something like that should do...
I'd prefer not to call ACPI functions from outside ofdrivers/acpi, but this could be cleaned later.
Actually, I was thinking of adding two operations to hibernation_ops() (now, that we have it :-)).
Would you mind if I made this change on top of 2/2, as a third patch in the series? That would be easier.
Quoted 63 lines · Rafael J. Wysocki
Quoted 60 lines · Alexey Starikovskiy
Quoted 7 lines
we needed to call
pm_prepare()on boot kernel only to disable GPEs to resolve 7887. It will also blink the LEDs during the resume image load, but it's possible to live without it.
If you drop call topm_prepare(), we still need to disable GPEs, so they will not fire during image switch. So if we disable GPE insuspend()method of EC it will work as soon as there are no other so much active GPEs at boot time...Okay, I just wanted to clarify.
In that case, I think, we should add a special callback to disable the GPEs in the restore code path (before we restore the image).
I also think that it would be sufficient if this callback only executed the following loop:
status = acpi_hw_disable_all_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }and it should be called right before
disable_nonboot_cpus().Is that correct?
Now, assumig that it's correct, we'll need a complementary callback to be executed in the restore error code paths, right after
enable_nonboot_cpus(), to enable the GPEs if there's an error during the restore. I think it might contain the following code:status = acpi_hw_enable_all_runtime_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }Greetings,
RafaelQuoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Alexey Starikovskiy
Quoted 1 line
This patch will disable EC GPE, which seems to be major problem.
Could you please explain to me why you think so?
Greetings,
Rafael--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King
Signature · 3 lines
If you don't have the time to read, you don't have the time or the tools to write. - Stephen King