[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] xen: Add acpu_sleep=s3_fake command-line option for testing



Not all hardware supports ACPI S3 suspend well, which makes automated
suspend testing potentially difficult.  However, a large number of the
bugs we want to test for won't need actual S3 state to trigger.

Add a command-line parameter for a "fake" S3, which will do everything
during suspend/restore except actually calling into the ACPI S3
handler.

Original-patch-by: Ben Guthro <benjamin.guthro@xxxxxxxxxx>
Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
Changes since v1:
- Instead of adding a new flag (as in the original), extend acpi_sleep.
- Print in dmesg that the S3 is being faked
- Use bool rather than bool_t

If we want osstest to be able to test this functionality it should
probably be backported.

(I haven't CC'd the release coordinator because I think this should be
backported when the osstest support is ready.)

CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Dario Faggioli <dfaggioli@xxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 docs/misc/xen-command-line.markdown |  2 ++
 xen/arch/x86/acpi/power.c           | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.markdown 
b/docs/misc/xen-command-line.markdown
index b6b1530a25..df341e43e6 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -133,6 +133,8 @@ resume.
 `s3_mode` instructs Xen to set up the boot time (option `vga=`) video
 mode during S3 resume.
 
+`s3_fake` instructs Xen to "fake" the S3 call for testing purposes.
+
 ### allow\_unsafe (x86)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index a704c7c340..e9f865ceca 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -33,6 +33,8 @@
 
 uint32_t system_reset_counter = 1;
 
+static bool __read_mostly opt_fake_s3 = false;
+
 static char __initdata opt_acpi_sleep[20];
 string_param("acpi_sleep", opt_acpi_sleep);
 
@@ -222,7 +224,10 @@ static int enter_state(u32 state)
     switch ( state )
     {
     case ACPI_STATE_S3:
-        do_suspend_lowlevel();
+        if ( !opt_fake_s3 )
+            do_suspend_lowlevel();
+        else
+            printk(XENLOG_INFO "Faking S3 suspend\n");
         system_reset_counter++;
         error = tboot_s3_resume();
         break;
@@ -467,6 +472,8 @@ static int __init acpi_sleep_init(void)
             acpi_video_flags |= 1;
         if ( !strncmp(p, "s3_mode", 7) )
             acpi_video_flags |= 2;
+        if ( !strncmp(p, "s3_fake", 7) )
+            opt_fake_s3 = true;
         p = strchr(p, ',');
         if ( p != NULL )
             p += strspn(p, ", \t");
@@ -479,6 +486,8 @@ static int __init acpi_sleep_init(void)
         {
             sleep_states[i] = 1;
             printk(" S%d", i);
+            if ( opt_fake_s3 )
+                printk("(fake)");
         }
         else
             sleep_states[i] = 0;
-- 
2.17.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.