* [PATCH 1/2] hvc_console polling mode timer backoff
@ 2007-04-17 14:44 Will Schmidt
2007-04-17 14:54 ` [PATCH 2/2] hvc_console typo fixes Will Schmidt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Will Schmidt @ 2007-04-17 14:44 UTC (permalink / raw)
To: ppcdev, Paul Mackerras
Paulus, I think this is ready to go, please apply, thanks.
Add a back-off mechanism to hvc_console's polling logic. This change
drops the timers/second ratio from ~90 to ~1/2 while the console is
idle.
This change is most noticeable when watching /proc/timer_stats output.
This only affects when the hvc_console is running in poll mode, i.e.
power4 and cell systems.
I've tested on Power4, Michael Ellerman has both contributed to the
patch and tested on cell.
Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
cc: Michael Ellerman <michael@ellerman.id.au>
---
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index a0a88aa..fc9bc77 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -47,8 +47,6 @@ #include "hvc_console.h"
#define HVC_MAJOR 229
#define HVC_MINOR 0
-#define TIMEOUT (10)
-
/*
* Wait this long per iteration while trying to push buffered data to the
* hypervisor before allowing the tty to complete a close operation.
@@ -550,6 +548,18 @@ static int hvc_chars_in_buffer(struct tt
return hp->n_outbuf;
}
+/*
+ * timeout will vary between the MIN and MAX values defined here. By default
+ * and during console activity we will use a default MIN_TIMEOUT of 10. When
+ * the console is idle, we increase the timeout value on each pass through
+ * msleep until we reach the max. This may be noticeable as a brief (average
+ * one second) delay on the console before the console responds to input when
+ * there has been no input for some time.
+ */
+#define MIN_TIMEOUT (10)
+#define MAX_TIMEOUT (2000)
+static u32 timeout = MIN_TIMEOUT;
+
#define HVC_POLL_READ 0x00000001
#define HVC_POLL_WRITE 0x00000002
@@ -642,9 +652,14 @@ #endif /* CONFIG_MAGIC_SYSRQ */
bail:
spin_unlock_irqrestore(&hp->lock, flags);
- if (read_total)
+ if (read_total) {
+ /* Activity is occurring, so reset the polling backoff value to
+ a minimum for performance. */
+ timeout = MIN_TIMEOUT;
+
tty_flip_buffer_push(tty);
-
+ }
+
return poll_mask;
}
@@ -688,8 +703,12 @@ int khvcd(void *unused)
if (!hvc_kicked) {
if (poll_mask == 0)
schedule();
- else
- msleep_interruptible(TIMEOUT);
+ else {
+ if (timeout < MAX_TIMEOUT)
+ timeout += (timeout >> 6) + 1;
+
+ msleep_interruptible(timeout);
+ }
}
__set_current_state(TASK_RUNNING);
} while (!kthread_should_stop());
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] hvc_console typo fixes
2007-04-17 14:44 [PATCH 1/2] hvc_console polling mode timer backoff Will Schmidt
@ 2007-04-17 14:54 ` Will Schmidt
2007-04-18 6:09 ` [PATCH 1/2] hvc_console polling mode timer backoff Michael Ellerman
2007-04-18 19:22 ` Linas Vepstas
2 siblings, 0 replies; 4+ messages in thread
From: Will Schmidt @ 2007-04-17 14:54 UTC (permalink / raw)
To: linuxppc-dev, Paul Mackerras; +Cc: willschm
Fix a handful of comment typos for hvc_console.
Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
---
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index fc9bc77..0f9ed7b 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -102,12 +102,12 @@ static DEFINE_SPINLOCK(hvc_structs_lock)
/*
* This value is used to assign a tty->index value to a hvc_struct based
* upon order of exposure via hvc_probe(), when we can not match it to
- * a console canidate registered with hvc_instantiate().
+ * a console candidate registered with hvc_instantiate().
*/
static int last_hvc = -1;
/*
- * Do not call this function with either the hvc_strucst_lock or the hvc_struct
+ * Do not call this function with either the hvc_structs_lock or the hvc_struct
* lock held. If successful, this function increments the kobject reference
* count against the target hvc_struct so it should be released when finished.
*/
@@ -160,7 +160,7 @@ void hvc_console_print(struct console *c
if (index >= MAX_NR_HVC_CONSOLES)
return;
- /* This console adapter was removed so it is not useable. */
+ /* This console adapter was removed so it is not usable. */
if (vtermnos[index] < 0)
return;
@@ -218,7 +218,7 @@ struct console hvc_con_driver = {
};
/*
- * Early console initialization. Preceeds driver initialization.
+ * Early console initialization. Precedes driver initialization.
*
* (1) we are first, and the user specified another driver
* -- index will remain -1
@@ -255,7 +255,7 @@ int hvc_instantiate(uint32_t vtermno, in
if (vtermnos[index] != -1)
return -1;
- /* make sure no no tty has been registerd in this index */
+ /* make sure no no tty has been registered in this index */
hp = hvc_get_by_index(index);
if (hp) {
kobject_put(&hp->kobj);
@@ -265,7 +265,7 @@ int hvc_instantiate(uint32_t vtermno, in
vtermnos[index] = vtermno;
cons_ops[index] = ops;
- /* reserve all indices upto and including this index */
+ /* reserve all indices up to and including this index */
if (last_hvc < index)
last_hvc = index;
@@ -526,7 +526,7 @@ static int hvc_write(struct tty_struct *
/*
* This is actually a contract between the driver and the tty layer outlining
- * how much write room the driver can guarentee will be sent OR BUFFERED. This
+ * how much write room the driver can guarantee will be sent OR BUFFERED. This
* driver MUST honor the return value.
*/
static int hvc_write_room(struct tty_struct *tty)
@@ -813,7 +813,7 @@ int __devexit hvc_remove(struct hvc_stru
/*
* We 'put' the instance that was grabbed when the kobject instance
- * was intialized using kobject_init(). Let the last holder of this
+ * was initialized using kobject_init(). Let the last holder of this
* kobject cause it to be removed, which will probably be the tty_hangup
* below.
*/
@@ -869,7 +869,7 @@ int __init hvc_init(void)
}
module_init(hvc_init);
-/* This isn't particularily necessary due to this being a console driver
+/* This isn't particularly necessary due to this being a console driver
* but it is nice to be thorough.
*/
static void __exit hvc_exit(void)
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] hvc_console polling mode timer backoff
2007-04-17 14:44 [PATCH 1/2] hvc_console polling mode timer backoff Will Schmidt
2007-04-17 14:54 ` [PATCH 2/2] hvc_console typo fixes Will Schmidt
@ 2007-04-18 6:09 ` Michael Ellerman
2007-04-18 19:22 ` Linas Vepstas
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2007-04-18 6:09 UTC (permalink / raw)
To: will_schmidt; +Cc: ppcdev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 3068 bytes --]
On Tue, 2007-04-17 at 09:44 -0500, Will Schmidt wrote:
> Paulus, I think this is ready to go, please apply, thanks.
>
>
>
> Add a back-off mechanism to hvc_console's polling logic. This change
> drops the timers/second ratio from ~90 to ~1/2 while the console is
> idle.
> This change is most noticeable when watching /proc/timer_stats output.
>
> This only affects when the hvc_console is running in poll mode, i.e.
> power4 and cell systems.
>
> I've tested on Power4, Michael Ellerman has both contributed to the
> patch and tested on cell.
>
> Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
> cc: Michael Ellerman <michael@ellerman.id.au>
That should probably be:
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
cheers
> ---
> diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
> index a0a88aa..fc9bc77 100644
> --- a/drivers/char/hvc_console.c
> +++ b/drivers/char/hvc_console.c
> @@ -47,8 +47,6 @@ #include "hvc_console.h"
> #define HVC_MAJOR 229
> #define HVC_MINOR 0
>
> -#define TIMEOUT (10)
> -
> /*
> * Wait this long per iteration while trying to push buffered data to the
> * hypervisor before allowing the tty to complete a close operation.
> @@ -550,6 +548,18 @@ static int hvc_chars_in_buffer(struct tt
> return hp->n_outbuf;
> }
>
> +/*
> + * timeout will vary between the MIN and MAX values defined here. By default
> + * and during console activity we will use a default MIN_TIMEOUT of 10. When
> + * the console is idle, we increase the timeout value on each pass through
> + * msleep until we reach the max. This may be noticeable as a brief (average
> + * one second) delay on the console before the console responds to input when
> + * there has been no input for some time.
> + */
> +#define MIN_TIMEOUT (10)
> +#define MAX_TIMEOUT (2000)
> +static u32 timeout = MIN_TIMEOUT;
> +
> #define HVC_POLL_READ 0x00000001
> #define HVC_POLL_WRITE 0x00000002
>
> @@ -642,9 +652,14 @@ #endif /* CONFIG_MAGIC_SYSRQ */
> bail:
> spin_unlock_irqrestore(&hp->lock, flags);
>
> - if (read_total)
> + if (read_total) {
> + /* Activity is occurring, so reset the polling backoff value to
> + a minimum for performance. */
> + timeout = MIN_TIMEOUT;
> +
> tty_flip_buffer_push(tty);
> -
> + }
> +
> return poll_mask;
> }
>
> @@ -688,8 +703,12 @@ int khvcd(void *unused)
> if (!hvc_kicked) {
> if (poll_mask == 0)
> schedule();
> - else
> - msleep_interruptible(TIMEOUT);
> + else {
> + if (timeout < MAX_TIMEOUT)
> + timeout += (timeout >> 6) + 1;
> +
> + msleep_interruptible(timeout);
> + }
> }
> __set_current_state(TASK_RUNNING);
> } while (!kthread_should_stop());
>
>
>
>
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] hvc_console polling mode timer backoff
2007-04-17 14:44 [PATCH 1/2] hvc_console polling mode timer backoff Will Schmidt
2007-04-17 14:54 ` [PATCH 2/2] hvc_console typo fixes Will Schmidt
2007-04-18 6:09 ` [PATCH 1/2] hvc_console polling mode timer backoff Michael Ellerman
@ 2007-04-18 19:22 ` Linas Vepstas
2 siblings, 0 replies; 4+ messages in thread
From: Linas Vepstas @ 2007-04-18 19:22 UTC (permalink / raw)
To: Will Schmidt; +Cc: ppcdev, Paul Mackerras
On Tue, Apr 17, 2007 at 09:44:46AM -0500, Will Schmidt wrote:
>
> Add a back-off mechanism to hvc_console's polling logic. This change
Acked-by: Linas Vepstas <linas@austin.ibm.com>
--linas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-18 19:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17 14:44 [PATCH 1/2] hvc_console polling mode timer backoff Will Schmidt
2007-04-17 14:54 ` [PATCH 2/2] hvc_console typo fixes Will Schmidt
2007-04-18 6:09 ` [PATCH 1/2] hvc_console polling mode timer backoff Michael Ellerman
2007-04-18 19:22 ` Linas Vepstas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).