All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter
@ 2021-07-09  0:32 xiongxin
  2021-07-09 15:40 ` Rafael J. Wysocki
  2021-08-04 16:32 ` Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: xiongxin @ 2021-07-09  0:32 UTC (permalink / raw)
  To: rjw, pavel; +Cc: linux-pm, linux-kernel, xiongxin

From: xiongxin <xiongxin@kylinos.cn>

On the arm64 platform, the psci driver is used by default to set the
suspend_ops structure; but the psci_acpi_init() function is called
before the command-line parameter "mem_sleep_default=" is specified;
the user cannot set the desired suspend mode through the
"mem_sleep_default=" parameter;

In mem_sleep_default_setup(), judge whether suspend_ops is set, if it
has been assigned, rewrite the value of mem_sleep_current variable; in
order to complete the user setting;

Signed-off-by: xiongxin <xiongxin@kylinos.cn>

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index d8cae434f9eb..bef4b17de3f6 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str)
 			break;
 		}
 
+	/*
+	 * When the suspend_ops has been set, "mem_sleep_default=*" will
+	 * be invalid, here to fix this situation.
+	 */
+	if (suspend_ops) {
+		if (mem_sleep_default == PM_SUSPEND_TO_IDLE)
+			mem_sleep_current = PM_SUSPEND_TO_IDLE;
+		else if ((mem_sleep_default == PM_SUSPEND_STANDBY) &&
+				valid_state(PM_SUSPEND_STANDBY))
+			mem_sleep_current = PM_SUSPEND_STANDBY;
+		else if ((mem_sleep_default >= PM_SUSPEND_MEM) &&
+				valid_state(PM_SUSPEND_MEM))
+			mem_sleep_current = PM_SUSPEND_MEM;
+	}
+
 	return 1;
 }
 __setup("mem_sleep_default=", mem_sleep_default_setup);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter
  2021-07-09  0:32 [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter xiongxin
@ 2021-07-09 15:40 ` Rafael J. Wysocki
  2021-08-04 16:32 ` Rafael J. Wysocki
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-07-09 15:40 UTC (permalink / raw)
  To: xiongxin
  Cc: Rafael J. Wysocki, Pavel Machek, Linux PM,
	Linux Kernel Mailing List, xiongxin

On Fri, Jul 9, 2021 at 3:03 AM xiongxin <win239@126.com> wrote:
>
> From: xiongxin <xiongxin@kylinos.cn>
>
> On the arm64 platform, the psci driver is used by default to set the
> suspend_ops structure; but the psci_acpi_init() function is called
> before the command-line parameter "mem_sleep_default=" is specified;
> the user cannot set the desired suspend mode through the
> "mem_sleep_default=" parameter;
>
> In mem_sleep_default_setup(), judge whether suspend_ops is set, if it
> has been assigned, rewrite the value of mem_sleep_current variable; in
> order to complete the user setting;
>
> Signed-off-by: xiongxin <xiongxin@kylinos.cn>

It's the third submission of the same patch AFAICS.

Have you made any changes to it since the previous submissions?  If
not, it is not necessary (or even useful) to resend it.

>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index d8cae434f9eb..bef4b17de3f6 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str)
>                         break;
>                 }
>
> +       /*
> +        * When the suspend_ops has been set, "mem_sleep_default=*" will
> +        * be invalid, here to fix this situation.
> +        */
> +       if (suspend_ops) {
> +               if (mem_sleep_default == PM_SUSPEND_TO_IDLE)
> +                       mem_sleep_current = PM_SUSPEND_TO_IDLE;
> +               else if ((mem_sleep_default == PM_SUSPEND_STANDBY) &&
> +                               valid_state(PM_SUSPEND_STANDBY))
> +                       mem_sleep_current = PM_SUSPEND_STANDBY;
> +               else if ((mem_sleep_default >= PM_SUSPEND_MEM) &&
> +                               valid_state(PM_SUSPEND_MEM))
> +                       mem_sleep_current = PM_SUSPEND_MEM;
> +       }
> +
>         return 1;
>  }
>  __setup("mem_sleep_default=", mem_sleep_default_setup);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter
  2021-07-09  0:32 [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter xiongxin
  2021-07-09 15:40 ` Rafael J. Wysocki
@ 2021-08-04 16:32 ` Rafael J. Wysocki
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 16:32 UTC (permalink / raw)
  To: xiongxin
  Cc: Rafael J. Wysocki, Pavel Machek, Linux PM,
	Linux Kernel Mailing List, xiongxin, Sudeep Holla

On Fri, Jul 9, 2021 at 3:03 AM xiongxin <win239@126.com> wrote:
>
> From: xiongxin <xiongxin@kylinos.cn>
>
> On the arm64 platform, the psci driver is used by default to set the
> suspend_ops structure; but the psci_acpi_init() function is called
> before the command-line parameter "mem_sleep_default=" is specified;

You seem to mean that psci_acpi_init() runs before
mem_sleep_default_setup() and so there is a confusion regarding the
mem_sleep_default setting.

Clearly, suspend_ops cannot be set before mem_sleep_default_setup()
runs, so I'd prefer to fix the ordering instead of hacking the latter
to fix up the mess.

> the user cannot set the desired suspend mode through the
> "mem_sleep_default=" parameter;
>
> In mem_sleep_default_setup(), judge whether suspend_ops is set, if it
> has been assigned, rewrite the value of mem_sleep_current variable; in
> order to complete the user setting;
>
> Signed-off-by: xiongxin <xiongxin@kylinos.cn>
>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index d8cae434f9eb..bef4b17de3f6 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str)
>                         break;
>                 }
>
> +       /*
> +        * When the suspend_ops has been set, "mem_sleep_default=*" will
> +        * be invalid, here to fix this situation.
> +        */
> +       if (suspend_ops) {
> +               if (mem_sleep_default == PM_SUSPEND_TO_IDLE)
> +                       mem_sleep_current = PM_SUSPEND_TO_IDLE;
> +               else if ((mem_sleep_default == PM_SUSPEND_STANDBY) &&
> +                               valid_state(PM_SUSPEND_STANDBY))
> +                       mem_sleep_current = PM_SUSPEND_STANDBY;
> +               else if ((mem_sleep_default >= PM_SUSPEND_MEM) &&
> +                               valid_state(PM_SUSPEND_MEM))
> +                       mem_sleep_current = PM_SUSPEND_MEM;
> +       }
> +
>         return 1;
>  }
>  __setup("mem_sleep_default=", mem_sleep_default_setup);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter
@ 2021-07-07  7:32 xiongxin
  0 siblings, 0 replies; 5+ messages in thread
From: xiongxin @ 2021-07-07  7:32 UTC (permalink / raw)
  To: len.brown, rjw, pavel; +Cc: linux-pm, linux-kernel, xiongxin

On the arm64 platform, the psci driver is used by default to set the
suspend_ops structure; but the psci_acpi_init() function is called
before the command-line parameter "mem_sleep_default=" is specified;
the user cannot set the desired suspend mode through the
"mem_sleep_default=" parameter;

In mem_sleep_default_setup(), judge whether suspend_ops is set, if it
has been assigned, rewrite the value of mem_sleep_current variable; in
order to complete the user setting;

Signed-off-by: xiongxin <xiongxin@kylinos.cn>

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index d8cae434f9eb..bef4b17de3f6 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str)
 			break;
 		}
 
+	/*
+	 * When the suspend_ops has been set, "mem_sleep_default=*" will
+	 * be invalid, here to fix this situation.
+	 */
+	if (suspend_ops) {
+		if (mem_sleep_default == PM_SUSPEND_TO_IDLE)
+			mem_sleep_current = PM_SUSPEND_TO_IDLE;
+		else if ((mem_sleep_default == PM_SUSPEND_STANDBY) &&
+				valid_state(PM_SUSPEND_STANDBY))
+			mem_sleep_current = PM_SUSPEND_STANDBY;
+		else if ((mem_sleep_default >= PM_SUSPEND_MEM) &&
+				valid_state(PM_SUSPEND_MEM))
+			mem_sleep_current = PM_SUSPEND_MEM;
+	}
+
 	return 1;
 }
 __setup("mem_sleep_default=", mem_sleep_default_setup);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter
@ 2021-07-04  5:49 xiongxin
  0 siblings, 0 replies; 5+ messages in thread
From: xiongxin @ 2021-07-04  5:49 UTC (permalink / raw)
  To: len.brown; +Cc: rjw, pavel, linux-pm, linux-kernel, xiongxin

On the arm64 platform, the psci driver is used by default to set the
suspend_ops structure; but the psci_acpi_init() function is called
before the command-line parameter "mem_sleep_default=" is specified;
the user cannot set the desired suspend mode through the
"mem_sleep_default=" parameter;

In mem_sleep_default_setup(), judge whether suspend_ops is set, if it
has been assigned, rewrite the value of mem_sleep_current variable; in
order to complete the user setting;

Signed-off-by: xiongxin <xiongxin@kylinos.cn>

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index d8cae434f9eb..bef4b17de3f6 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str)
 			break;
 		}
 
+	/*
+	 * When the suspend_ops has been set, "mem_sleep_default=*" will
+	 * be invalid, here to fix this situation.
+	 */
+	if (suspend_ops) {
+		if (mem_sleep_default == PM_SUSPEND_TO_IDLE)
+			mem_sleep_current = PM_SUSPEND_TO_IDLE;
+		else if ((mem_sleep_default == PM_SUSPEND_STANDBY) &&
+				valid_state(PM_SUSPEND_STANDBY))
+			mem_sleep_current = PM_SUSPEND_STANDBY;
+		else if ((mem_sleep_default >= PM_SUSPEND_MEM) &&
+				valid_state(PM_SUSPEND_MEM))
+			mem_sleep_current = PM_SUSPEND_MEM;
+	}
+
 	return 1;
 }
 __setup("mem_sleep_default=", mem_sleep_default_setup);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-04 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09  0:32 [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter xiongxin
2021-07-09 15:40 ` Rafael J. Wysocki
2021-08-04 16:32 ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2021-07-07  7:32 xiongxin
2021-07-04  5:49 xiongxin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.