diff options
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r-- | drivers/char/hvc_console.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index a0a88aa23f5b..fc9bc7709fd9 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -47,8 +47,6 @@ | |||
47 | #define HVC_MAJOR 229 | 47 | #define HVC_MAJOR 229 |
48 | #define HVC_MINOR 0 | 48 | #define HVC_MINOR 0 |
49 | 49 | ||
50 | #define TIMEOUT (10) | ||
51 | |||
52 | /* | 50 | /* |
53 | * Wait this long per iteration while trying to push buffered data to the | 51 | * Wait this long per iteration while trying to push buffered data to the |
54 | * hypervisor before allowing the tty to complete a close operation. | 52 | * hypervisor before allowing the tty to complete a close operation. |
@@ -550,6 +548,18 @@ static int hvc_chars_in_buffer(struct tty_struct *tty) | |||
550 | return hp->n_outbuf; | 548 | return hp->n_outbuf; |
551 | } | 549 | } |
552 | 550 | ||
551 | /* | ||
552 | * timeout will vary between the MIN and MAX values defined here. By default | ||
553 | * and during console activity we will use a default MIN_TIMEOUT of 10. When | ||
554 | * the console is idle, we increase the timeout value on each pass through | ||
555 | * msleep until we reach the max. This may be noticeable as a brief (average | ||
556 | * one second) delay on the console before the console responds to input when | ||
557 | * there has been no input for some time. | ||
558 | */ | ||
559 | #define MIN_TIMEOUT (10) | ||
560 | #define MAX_TIMEOUT (2000) | ||
561 | static u32 timeout = MIN_TIMEOUT; | ||
562 | |||
553 | #define HVC_POLL_READ 0x00000001 | 563 | #define HVC_POLL_READ 0x00000001 |
554 | #define HVC_POLL_WRITE 0x00000002 | 564 | #define HVC_POLL_WRITE 0x00000002 |
555 | 565 | ||
@@ -642,9 +652,14 @@ static int hvc_poll(struct hvc_struct *hp) | |||
642 | bail: | 652 | bail: |
643 | spin_unlock_irqrestore(&hp->lock, flags); | 653 | spin_unlock_irqrestore(&hp->lock, flags); |
644 | 654 | ||
645 | if (read_total) | 655 | if (read_total) { |
656 | /* Activity is occurring, so reset the polling backoff value to | ||
657 | a minimum for performance. */ | ||
658 | timeout = MIN_TIMEOUT; | ||
659 | |||
646 | tty_flip_buffer_push(tty); | 660 | tty_flip_buffer_push(tty); |
647 | 661 | } | |
662 | |||
648 | return poll_mask; | 663 | return poll_mask; |
649 | } | 664 | } |
650 | 665 | ||
@@ -688,8 +703,12 @@ int khvcd(void *unused) | |||
688 | if (!hvc_kicked) { | 703 | if (!hvc_kicked) { |
689 | if (poll_mask == 0) | 704 | if (poll_mask == 0) |
690 | schedule(); | 705 | schedule(); |
691 | else | 706 | else { |
692 | msleep_interruptible(TIMEOUT); | 707 | if (timeout < MAX_TIMEOUT) |
708 | timeout += (timeout >> 6) + 1; | ||
709 | |||
710 | msleep_interruptible(timeout); | ||
711 | } | ||
693 | } | 712 | } |
694 | __set_current_state(TASK_RUNNING); | 713 | __set_current_state(TASK_RUNNING); |
695 | } while (!kthread_should_stop()); | 714 | } while (!kthread_should_stop()); |