Re: [4.1.3-rt10][RFC PATCH] PM / sleep: freeze: fix bug "sleeping function called from invalid context"
From: kbuild test robot
Date: Tue Oct 20 2015 - 18:37:01 EST
Hi Grygorii,
[auto build test ERROR on v4.3-rc6 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Grygorii-Strashko/PM-sleep-freeze-fix-bug-sleeping-function-called-from-invalid-context/20151021-043733
config: avr32-atngw100_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=avr32
All error/warnings (new ones prefixed by >>):
>> kernel/power/suspend.c:32:31: error: linux/wait-simple.h: No such file or directory
>> kernel/power/suspend.c:41: warning: type defaults to 'int' in declaration of 'DEFINE_SWAIT_HEAD'
>> kernel/power/suspend.c:41: warning: parameter names (without types) in function declaration
kernel/power/suspend.c: In function 'freeze_enter':
>> kernel/power/suspend.c:74: error: implicit declaration of function 'swait_event'
>> kernel/power/suspend.c:74: error: 'suspend_freeze_wait_head' undeclared (first use in this function)
kernel/power/suspend.c:74: error: (Each undeclared identifier is reported only once
kernel/power/suspend.c:74: error: for each function it appears in.)
kernel/power/suspend.c: In function 'freeze_wake':
>> kernel/power/suspend.c:95: error: implicit declaration of function 'swait_wake'
kernel/power/suspend.c:95: error: 'suspend_freeze_wait_head' undeclared (first use in this function)
vim +32 kernel/power/suspend.c
26 #include <linux/suspend.h>
27 #include <linux/syscore_ops.h>
28 #include <linux/ftrace.h>
29 #include <trace/events/power.h>
30 #include <linux/compiler.h>
31 #include <linux/moduleparam.h>
> 32 #include <linux/wait-simple.h>
33
34 #include "power.h"
35
36 const char *pm_labels[] = { "mem", "standby", "freeze", NULL };
37 const char *pm_states[PM_SUSPEND_MAX];
38
39 static const struct platform_suspend_ops *suspend_ops;
40 static const struct platform_freeze_ops *freeze_ops;
> 41 static DEFINE_SWAIT_HEAD(suspend_freeze_wait_head);
42
43 enum freeze_state __read_mostly suspend_freeze_state;
44 static DEFINE_RAW_SPINLOCK(suspend_freeze_lock);
45
46 void freeze_set_ops(const struct platform_freeze_ops *ops)
47 {
48 lock_system_sleep();
49 freeze_ops = ops;
50 unlock_system_sleep();
51 }
52
53 static void freeze_begin(void)
54 {
55 suspend_freeze_state = FREEZE_STATE_NONE;
56 }
57
58 static void freeze_enter(void)
59 {
60 if (pm_wakeup_pending())
61 goto out;
62
63 raw_spin_lock_irq(&suspend_freeze_lock);
64 suspend_freeze_state = FREEZE_STATE_ENTER;
65 raw_spin_unlock_irq(&suspend_freeze_lock);
66
67 get_online_cpus();
68 cpuidle_resume();
69
70 /* Push all the CPUs into the idle loop. */
71 wake_up_all_idle_cpus();
72 pr_debug("PM: suspend-to-idle\n");
73 /* Make the current CPU wait so it can enter the idle loop too. */
> 74 swait_event(suspend_freeze_wait_head,
75 suspend_freeze_state == FREEZE_STATE_WAKE);
76 pr_debug("PM: resume from suspend-to-idle\n");
77
78 cpuidle_pause();
79 put_online_cpus();
80
81 raw_spin_lock_irq(&suspend_freeze_lock);
82
83 out:
84 suspend_freeze_state = FREEZE_STATE_NONE;
85 raw_spin_unlock_irq(&suspend_freeze_lock);
86 }
87
88 void freeze_wake(void)
89 {
90 unsigned long flags;
91
92 raw_spin_lock_irqsave(&suspend_freeze_lock, flags);
93 if (suspend_freeze_state > FREEZE_STATE_NONE) {
94 suspend_freeze_state = FREEZE_STATE_WAKE;
> 95 swait_wake(&suspend_freeze_wait_head);
96 }
97 raw_spin_unlock_irqrestore(&suspend_freeze_lock, flags);
98 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data