Re: 2.1.111: CONSOLE: STILL reproducible oddities

Martin Mares (mj@albireo.ucw.cz)
Mon, 27 Jul 1998 18:54:36 +0200


> Well, I tried the same with pre-112-1 and I was about to report that the
> problem had gone, because I couldn't reproduce it. Then I had the smart
> idea of pressing <Up, Return> lots of times to put some work in the
> keyboard buffer, then switching to another vt and doing the same. I got
> about 0.5 seconds of motionless screen (list of files, but offset left /
> right by about 1/2 screen) before the machine spontaneously hard booted
> itself. NB I don't run any watchdogs, hard or soft.

[and some other similar bug reports]

The console code was full of nasty races even in 2.0.X, but they were
showing up very rarely and they usually caused only misscrolled screen.
The following patch should fix them, please test it.

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Uncle Ed's Rule of Thumb:  Never use your thumb for a rule."

diff -u -r1.29 keyboard.c --- drivers/char/keyboard.c 1998/07/06 21:24:22 1.29 +++ drivers/char/keyboard.c 1998/07/27 14:55:00 @@ -317,7 +317,7 @@ wake_up(&keypress_wait); if (tty) { tty_insert_flip_char(tty, ch, 0); - tty_schedule_flip(tty); + con_schedule_flip(tty); } } @@ -331,7 +331,7 @@ tty_insert_flip_char(tty, *cp, 0); cp++; } - tty_schedule_flip(tty); + con_schedule_flip(tty); } static void applkey(int key, char mode) @@ -443,7 +443,7 @@ if (!tty) return; tty_insert_flip_char(tty, 0, TTY_BREAK); - tty_schedule_flip(tty); + con_schedule_flip(tty); } static void scroll_forw(void) diff -u -r1.91 console.c --- drivers/char/console.c 1998/07/26 20:37:10 1.91 +++ drivers/char/console.c 1998/07/27 14:55:26 @@ -92,6 +92,7 @@ #include <linux/interrupt.h> #include <linux/config.h> #include <linux/version.h> +#include <linux/tqueue.h> #ifdef CONFIG_APM #include <linux/apm_bios.h> #endif @@ -170,6 +171,14 @@ static struct vc_data *master_display_fg = NULL; /* + * Unfortunately, we need to delay tty echo when we're currently writing to the + * console since the code is (and always was) not re-entrant, so we insert + * all filp requests to con_task_queue instead of tq_timer and run it from + * the console_bh. + */ +DECLARE_TASK_QUEUE(con_task_queue); + +/* * Low-Level Functions */ @@ -1068,7 +1077,7 @@ tty_insert_flip_char(tty, *p, 0); p++; } - tty_schedule_flip(tty); + con_schedule_flip(tty); } static void cursor_report(int currcons, struct tty_struct * tty) @@ -1893,6 +1902,7 @@ */ static void console_bh(void) { + run_task_queue(&con_task_queue); if (want_console >= 0) { if (want_console != fg_console && vc_cons_allocated(want_console)) { hide_cursor(fg_console); diff -u -r1.2 kbd_kern.h --- include/linux/kbd_kern.h 1998/07/06 21:51:31 1.2 +++ include/linux/kbd_kern.h 1998/07/27 14:55:28 @@ -151,4 +151,14 @@ extern unsigned int keymap_count; +/* console.c */ + +extern task_queue con_task_queue; + +extern inline void con_schedule_flip(struct tty_struct *t) +{ + queue_task(&t->flip.tqueue, &con_task_queue); + mark_bh(CONSOLE_BH); +} + #endif

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html