Skip to contentSkip to conversation

Alt-arrow console switch sometimes dropped

PATCH Pavel Machek 2 participants 3 messages Jan 3, 2004 – Jan 9, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

Hi!

Alt-arrow console switch is routinely dropped under high load. This patch fixes it: alt-arrow has to start from console _we want to switch to_, if switch is already pending. Please apply,
Pavel

drivers/char/keyboard.c +5 -1
Index: linux.new/drivers/char/keyboard.c
===================================================================
@@ -507,8 +528,12 @@
 static void fn_inc_console(struct vc_data *vc, struct pt_regs *regs)
 {
 	int i;
+	int cur = fg_console;
 
-	for (i = fg_console+1; i != fg_console; i++) {
+	if (want_console != -1)
+		cur = want_console;
+
+	for (i = cur+1; i != cur; i++) {
 		if (i == MAX_NR_CONSOLES)
 			i = 0;
 		if (vc_cons_allocated(i))
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw

In message <[email protected]> you write:

Quoted 6 lines

Hi!

Alt-arrow console switch is routinely dropped under high load. This patch fixes it: alt-arrow has to start from console _we want to switch to_, if switch is already pending. Please apply,
Pavel

Sure, but a comment would be nice:

	/* Currently switching?  Queue this next switch relative to that. */

Thanks,
Trivial Rusty.

Quoted 9 lines

Index: linux.new/drivers/char/keyboard.c
===================================================================

drivers/char/keyboard.c +0 -0
@@ -507,8 +528,12 @@
 static void fn_inc_console(struct vc_data *vc, struct pt_regs *regs)
 {
 	int i;

drivers/char/keyboard.c line 539

Quoted 10 lines
drivers/char/keyboard.c +5 -1
+	int cur = fg_console;
 
-	for (i = fg_console+1; i != fg_console; i++) {
+	if (want_console != -1)
+		cur = want_console;
+
+	for (i = cur+1; i != cur; i++) {
 		if (i == MAX_NR_CONSOLES)
 			i = 0;
 		if (vc_cons_allocated(i))

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#2 lore raw

Hi!

Quoted 9 lines
Quoted 4 lines

Alt-arrow console switch is routinely dropped under high load. This patch fixes it: alt-arrow has to start from console _we want to switch to_, if switch is already pending. Please apply,
Pavel

Sure, but a comment would be nice:

	/* Currently switching?  Queue this next switch relative to
Quoted 1 line

that. */

Oops, there was exactly the same problem in "fn_dec_console". Here's incremental patch to add the comment and fix fn_dec_console, too. I hope it is applicable.

Pavel

drivers/char/keyboard.c renamed from linux/drivers/char/keyboard.c +7 -1
@@ -515,8 +515,13 @@
 static void fn_dec_console(struct vc_data *vc, struct pt_regs *regs)
 {
 	int i;
+	int cur = fg_console;
+
+	/* Currently switching?  Queue this next switch relative to that. */
+	if (want_console != -1)
+		cur = want_console;
  
-	for (i = fg_console-1; i != fg_console; i--) {
+	for (i = cur-1; i != cur; i--) {
 		if (i == -1)
 			i = MAX_NR_CONSOLES-1;
 		if (vc_cons_allocated(i))
@@ -530,6 +535,7 @@
 	int i;
 	int cur = fg_console;
 
+	/* Currently switching?  Queue this next switch relative to that. */
 	if (want_console != -1)
 		cur = want_console;
 
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]