Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1369175 > unrolled thread
| Started by | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| First post | 2016-04-01 12:40 +0200 |
| Last post | 2016-04-03 05:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RT] Warning from swake_up_all_locked in rt-4.4.4-rt11 Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-04-01 12:40 +0200
Re: [RT] Warning from swake_up_all_locked in rt-4.4.4-rt11 Clark Williams <williams@redhat.com> - 2016-04-03 05:50 +0200
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-04-01 12:40 +0200 |
| Subject | Re: [RT] Warning from swake_up_all_locked in rt-4.4.4-rt11 |
| Message-ID | <rj4EG-2X4-17@gated-at.bofh.it> |
* Thomas Gleixner | 2016-03-14 09:49:52 [+0100]:
>On Sun, 13 Mar 2016, Clark Williams wrote:
>
>> I'm hitting the WARN_ON(wakes > 2) in $SUBJECT when resuming from suspend on my laptop (quad-core i7 with HT on). Looks like the warning gets hit 36 times on resume. E.g.:
>If resume is the only case, then we can filter that out and not worry about it
>at all :)
This works with the "mem" and "disk" target:
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -194,6 +194,12 @@ struct platform_freeze_ops {
void (*end)(void);
};
+#if defined(CONFIG_SUSPEND) || defined(CONFIG_HIBERNATION)
+extern bool pm_in_action;
+#else
+# define pm_in_action false
+#endif
+
#ifdef CONFIG_SUSPEND
/**
* suspend_set_ops - set platform dependent suspend operations
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index bfd9e0982f15..fbb23f93e8d6 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -648,6 +648,10 @@ static void power_down(void)
cpu_relax();
}
+#ifndef CONFIG_SUSPEND
+bool pm_in_action;
+#endif
+
/**
* hibernate - Carry out system hibernation, including saving the image.
*/
@@ -660,6 +664,8 @@ int hibernate(void)
return -EPERM;
}
+ pm_in_action = true;
+
lock_system_sleep();
/* The snapshot device should not be opened while we're running */
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
@@ -725,6 +731,7 @@ int hibernate(void)
atomic_inc(&snapshot_device_available);
Unlock:
unlock_system_sleep();
+ pm_in_action = false;
return error;
}
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 80ebc0726290..393bc342c586 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -522,6 +522,8 @@ static int enter_state(suspend_state_t state)
return error;
}
+bool pm_in_action;
+
/**
* pm_suspend - Externally visible function for suspending the system.
* @state: System sleep state to enter.
@@ -536,6 +538,8 @@ int pm_suspend(suspend_state_t state)
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL;
+ pm_in_action = true;
+
error = enter_state(state);
if (error) {
suspend_stats.fail++;
@@ -543,6 +547,7 @@ int pm_suspend(suspend_state_t state)
} else {
suspend_stats.success++;
}
+ pm_in_action = false;
return error;
}
EXPORT_SYMBOL(pm_suspend);
diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
index 8459561f0379..205fe36868f9 100644
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -1,5 +1,6 @@
#include <linux/sched.h>
#include <linux/swait.h>
+#include <linux/suspend.h>
void __init_swait_queue_head(struct swait_queue_head *q, const char *name,
struct lock_class_key *key)
@@ -42,7 +43,9 @@ void swake_up_all_locked(struct swait_queue_head *q)
list_del_init(&curr->task_list);
wakes++;
}
- WARN_ON(wakes > 2);
+ if (pm_in_action)
+ return;
+ WARN(wakes > 2, "complate_all() with %d waiters\n", wakes);
}
EXPORT_SYMBOL(swake_up_all_locked);
Sebastian
[toc] | [next] | [standalone]
| From | Clark Williams <williams@redhat.com> |
|---|---|
| Date | 2016-04-03 05:50 +0200 |
| Message-ID | <rjHd0-5IW-7@gated-at.bofh.it> |
| In reply to | #1369175 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, 1 Apr 2016 12:33:18 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> * Thomas Gleixner | 2016-03-14 09:49:52 [+0100]:
>
> >On Sun, 13 Mar 2016, Clark Williams wrote:
> >
> >> I'm hitting the WARN_ON(wakes > 2) in $SUBJECT when resuming from suspend on my laptop (quad-core i7 with HT on). Looks like the warning gets hit 36 times on resume. E.g.:
> >If resume is the only case, then we can filter that out and not worry about it
> >at all :)
>
> This works with the "mem" and "disk" target:
>
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -194,6 +194,12 @@ struct platform_freeze_ops {
> void (*end)(void);
> };
>
> +#if defined(CONFIG_SUSPEND) || defined(CONFIG_HIBERNATION)
> +extern bool pm_in_action;
> +#else
> +# define pm_in_action false
> +#endif
> +
> #ifdef CONFIG_SUSPEND
> /**
> * suspend_set_ops - set platform dependent suspend operations
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index bfd9e0982f15..fbb23f93e8d6 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -648,6 +648,10 @@ static void power_down(void)
> cpu_relax();
> }
>
> +#ifndef CONFIG_SUSPEND
> +bool pm_in_action;
> +#endif
> +
> /**
> * hibernate - Carry out system hibernation, including saving the image.
> */
> @@ -660,6 +664,8 @@ int hibernate(void)
> return -EPERM;
> }
>
> + pm_in_action = true;
> +
> lock_system_sleep();
> /* The snapshot device should not be opened while we're running */
> if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
> @@ -725,6 +731,7 @@ int hibernate(void)
> atomic_inc(&snapshot_device_available);
> Unlock:
> unlock_system_sleep();
> + pm_in_action = false;
> return error;
> }
>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index 80ebc0726290..393bc342c586 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -522,6 +522,8 @@ static int enter_state(suspend_state_t state)
> return error;
> }
>
> +bool pm_in_action;
> +
> /**
> * pm_suspend - Externally visible function for suspending the system.
> * @state: System sleep state to enter.
> @@ -536,6 +538,8 @@ int pm_suspend(suspend_state_t state)
> if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
> return -EINVAL;
>
> + pm_in_action = true;
> +
> error = enter_state(state);
> if (error) {
> suspend_stats.fail++;
> @@ -543,6 +547,7 @@ int pm_suspend(suspend_state_t state)
> } else {
> suspend_stats.success++;
> }
> + pm_in_action = false;
> return error;
> }
> EXPORT_SYMBOL(pm_suspend);
> diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
> index 8459561f0379..205fe36868f9 100644
> --- a/kernel/sched/swait.c
> +++ b/kernel/sched/swait.c
> @@ -1,5 +1,6 @@
> #include <linux/sched.h>
> #include <linux/swait.h>
> +#include <linux/suspend.h>
>
> void __init_swait_queue_head(struct swait_queue_head *q, const char *name,
> struct lock_class_key *key)
> @@ -42,7 +43,9 @@ void swake_up_all_locked(struct swait_queue_head *q)
> list_del_init(&curr->task_list);
> wakes++;
> }
> - WARN_ON(wakes > 2);
> + if (pm_in_action)
> + return;
> + WARN(wakes > 2, "complate_all() with %d waiters\n", wakes);
> }
> EXPORT_SYMBOL(swake_up_all_locked);
>
> Sebastian
Applied to 4.4.6-rt12, suspended/resumed multiple times with no warnings from swake_up_all_locked().
Tested-by: Clark Williams <williams@redhat.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web