diff options
Diffstat (limited to 'kernel/async.c')
| -rw-r--r-- | kernel/async.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/kernel/async.c b/kernel/async.c index f286e9f2b736..67a2be71f517 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
| @@ -90,12 +90,12 @@ extern int initcall_debug; | |||
| 90 | static async_cookie_t __lowest_in_progress(struct list_head *running) | 90 | static async_cookie_t __lowest_in_progress(struct list_head *running) |
| 91 | { | 91 | { |
| 92 | struct async_entry *entry; | 92 | struct async_entry *entry; |
| 93 | if (!list_empty(&async_pending)) { | 93 | if (!list_empty(running)) { |
| 94 | entry = list_first_entry(&async_pending, | 94 | entry = list_first_entry(running, |
| 95 | struct async_entry, list); | 95 | struct async_entry, list); |
| 96 | return entry->cookie; | 96 | return entry->cookie; |
| 97 | } else if (!list_empty(running)) { | 97 | } else if (!list_empty(&async_pending)) { |
| 98 | entry = list_first_entry(running, | 98 | entry = list_first_entry(&async_pending, |
| 99 | struct async_entry, list); | 99 | struct async_entry, list); |
| 100 | return entry->cookie; | 100 | return entry->cookie; |
| 101 | } else { | 101 | } else { |
| @@ -104,6 +104,17 @@ static async_cookie_t __lowest_in_progress(struct list_head *running) | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | } | 106 | } |
| 107 | |||
| 108 | static async_cookie_t lowest_in_progress(struct list_head *running) | ||
| 109 | { | ||
| 110 | unsigned long flags; | ||
| 111 | async_cookie_t ret; | ||
| 112 | |||
| 113 | spin_lock_irqsave(&async_lock, flags); | ||
| 114 | ret = __lowest_in_progress(running); | ||
| 115 | spin_unlock_irqrestore(&async_lock, flags); | ||
| 116 | return ret; | ||
| 117 | } | ||
| 107 | /* | 118 | /* |
| 108 | * pick the first pending entry and run it | 119 | * pick the first pending entry and run it |
| 109 | */ | 120 | */ |
| @@ -127,15 +138,18 @@ static void run_one_entry(void) | |||
| 127 | 138 | ||
| 128 | /* 3) run it (and print duration)*/ | 139 | /* 3) run it (and print duration)*/ |
| 129 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 140 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
| 130 | printk("calling %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current)); | 141 | printk("calling %lli_%pF @ %i\n", (long long)entry->cookie, |
| 142 | entry->func, task_pid_nr(current)); | ||
| 131 | calltime = ktime_get(); | 143 | calltime = ktime_get(); |
| 132 | } | 144 | } |
| 133 | entry->func(entry->data, entry->cookie); | 145 | entry->func(entry->data, entry->cookie); |
| 134 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 146 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
| 135 | rettime = ktime_get(); | 147 | rettime = ktime_get(); |
| 136 | delta = ktime_sub(rettime, calltime); | 148 | delta = ktime_sub(rettime, calltime); |
| 137 | printk("initcall %lli_%pF returned 0 after %lld usecs\n", entry->cookie, | 149 | printk("initcall %lli_%pF returned 0 after %lld usecs\n", |
| 138 | entry->func, ktime_to_ns(delta) >> 10); | 150 | (long long)entry->cookie, |
| 151 | entry->func, | ||
| 152 | (long long)ktime_to_ns(delta) >> 10); | ||
| 139 | } | 153 | } |
| 140 | 154 | ||
| 141 | /* 4) remove it from the running queue */ | 155 | /* 4) remove it from the running queue */ |
| @@ -229,14 +243,15 @@ void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *r | |||
| 229 | starttime = ktime_get(); | 243 | starttime = ktime_get(); |
| 230 | } | 244 | } |
| 231 | 245 | ||
| 232 | wait_event(async_done, __lowest_in_progress(running) >= cookie); | 246 | wait_event(async_done, lowest_in_progress(running) >= cookie); |
| 233 | 247 | ||
| 234 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 248 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
| 235 | endtime = ktime_get(); | 249 | endtime = ktime_get(); |
| 236 | delta = ktime_sub(endtime, starttime); | 250 | delta = ktime_sub(endtime, starttime); |
| 237 | 251 | ||
| 238 | printk("async_continuing @ %i after %lli usec\n", | 252 | printk("async_continuing @ %i after %lli usec\n", |
| 239 | task_pid_nr(current), ktime_to_ns(delta) >> 10); | 253 | task_pid_nr(current), |
| 254 | (long long)ktime_to_ns(delta) >> 10); | ||
| 240 | } | 255 | } |
| 241 | } | 256 | } |
| 242 | EXPORT_SYMBOL_GPL(async_synchronize_cookie_special); | 257 | EXPORT_SYMBOL_GPL(async_synchronize_cookie_special); |
