Re: [PATCHv3] panic: avoid deadlocks in re-entrant console drivers

kbuild test robot
2018-10-25T10:51:01Z

[-- Attachment #1: Type: text/plain, Size: 5410 bytes --]

Hi Sergey,

I love your patch! Yet something to improve:

[auto build test ERROR on linux-sof-driver/master]
[also build test ERROR on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Sergey-Senozhatsky/panic-avoid-deadlocks-in-re-entrant-console-drivers/20181025-181929
base: https://github.com/thesofproject/linux master
config: i386-randconfig-x077-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

kernel/panic.c: In function 'panic':
>> kernel/panic.c:237:2: error: implicit declaration of function 'unblank_screen' [-Werror=implicit-function-declaration]
unblank_screen();
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/unblank_screen +237 kernel/panic.c

186
187 /*
188 * If we have crashed and we have a crash kernel loaded let it handle
189 * everything else.
190 * If we want to run this after calling panic_notifiers, pass
191 * the "crash_kexec_post_notifiers" option to the kernel.
192 *
193 * Bypass the panic_cpu check and call __crash_kexec directly.
194 */
195 if (!_crash_kexec_post_notifiers) {
196 printk_safe_flush_on_panic();
197 __crash_kexec(NULL);
198
199 /*
200 * Note smp_send_stop is the usual smp shutdown function, which
201 * unfortunately means it may not be hardened to work in a
202 * panic situation.
203 */
204 smp_send_stop();
205 } else {
206 /*
207 * If we want to do crash dump after notifier calls and
208 * kmsg_dump, we will need architecture dependent extra
209 * works in addition to stopping other CPUs.
210 */
211 crash_smp_send_stop();
212 }
213
214 /*
215 * Run any panic handlers, including those that might need to
216 * add information to the kmsg dump output.
217 */
218 atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
219
220 /* Call flush even twice. It tries harder with a single online CPU */
221 printk_safe_flush_on_panic();
222 kmsg_dump(KMSG_DUMP_PANIC);
223
224 /*
225 * If you doubt kdump always works fine in any situation,
226 * "crash_kexec_post_notifiers" offers you a chance to run
227 * panic_notifiers and dumping kmsg before kdump.
228 * Note: since some panic_notifiers can make crashed kernel
229 * more unstable, it can increase risks of the kdump failure too.
230 *
231 * Bypass the panic_cpu check and call __crash_kexec directly.
232 */
233 if (_crash_kexec_post_notifiers)
234 __crash_kexec(NULL);
235
236 #ifdef CONFIG_VT
> 237 unblank_screen();
238 #endif
239 console_unblank();
240
241 /*
242 * We may have ended up stopping the CPU holding the lock (in
243 * smp_send_stop()) while still having some valuable data in the console
244 * buffer. Try to acquire the lock then release it regardless of the
245 * result. The release will also print the buffers out. Locks debug
246 * should be disabled to avoid reporting bad unlock balance when
247 * panic() is not being callled from OOPS.
248 */
249 debug_locks_off();
250 console_flush_on_panic();
251
252 if (!panic_blink)
253 panic_blink = no_blink;
254
255 if (panic_timeout > 0) {
256 /*
257 * Delay timeout seconds before rebooting the machine.
258 * We can't use the "normal" timers since we just panicked.
259 */
260 pr_emerg("Rebooting in %d seconds..\n", panic_timeout);
261
262 for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) {
263 touch_nmi_watchdog();
264 if (i >= i_next) {
265 i += panic_blink(state ^= 1);
266 i_next = i + 3600 / PANIC_BLINK_SPD;
267 }
268 mdelay(PANIC_TIMER_STEP);
269 }
270 }
271 if (panic_timeout != 0) {
272 /*
273 * This will not be a clean reboot, with everything
274 * shutting down. But if there is a chance of
275 * rebooting the system it will be rebooted.
276 */
277 emergency_restart();
278 }
279 #ifdef __sparc__
280 {
281 extern int stop_a_enabled;
282 /* Make sure the user can actually press Stop-A (L1-A) */
283 stop_a_enabled = 1;
284 pr_emerg("Press Stop-A (L1-A) from sun keyboard or send break\n"
285 "twice on console to return to the boot prom\n");
286 }
287 #endif
288 #if defined(CONFIG_S390)
289 {
290 unsigned long caller;
291
292 caller = (unsigned long)__builtin_return_address(0);
293 disabled_wait(caller);
294 }
295 #endif
296 pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
297 local_irq_enable();
298 for (i = 0; ; i += PANIC_TIMER_STEP) {
299 touch_softlockup_watchdog();
300 if (i >= i_next) {
301 i += panic_blink(state ^= 1);
302 i_next = i + 3600 / PANIC_BLINK_SPD;
303 }
304 mdelay(PANIC_TIMER_STEP);
305 }
306 }
307

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33530 bytes --]