summaryrefslogtreecommitdiffstats
path: root/sys/dev/dcons
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-02-19 18:22:25 +0000
committermav <mav@FreeBSD.org>2013-02-19 18:22:25 +0000
commit93c07fc1e48c046e06c76eda5315e3eaf46f3ef3 (patch)
treeccfbca5eb23431a394fcb07ffcece585eddce4c9 /sys/dev/dcons
parentb72d635ee90ed19d32f99bf5b95a4e18130a7641 (diff)
downloadFreeBSD-src-93c07fc1e48c046e06c76eda5315e3eaf46f3ef3.zip
FreeBSD-src-93c07fc1e48c046e06c76eda5315e3eaf46f3ef3.tar.gz
MFcalloutng:
Make dcons input polling adaptive, reducing poll rate to 1Hz after several minutes of inactivty to reduce global interrupt rate. Most of users never used FireWire debugging, so it is not very useful to consume power by it.
Diffstat (limited to 'sys/dev/dcons')
-rw-r--r--sys/dev/dcons/dcons_os.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c
index a37d64c..bf0be0b 100644
--- a/sys/dev/dcons/dcons_os.c
+++ b/sys/dev/dcons/dcons_os.c
@@ -74,6 +74,10 @@
#define DCONS_POLL_HZ 25
#endif
+#ifndef DCONS_POLL_IDLE
+#define DCONS_POLL_IDLE 256
+#endif
+
#ifndef DCONS_BUF_SIZE
#define DCONS_BUF_SIZE (16*1024)
#endif
@@ -90,6 +94,7 @@ static char bssbuf[DCONS_BUF_SIZE]; /* buf in bss */
static struct dcons_global dg;
struct dcons_global *dcons_conf;
static int poll_hz = DCONS_POLL_HZ;
+static u_int poll_idle = DCONS_POLL_HZ * DCONS_POLL_IDLE;
static struct dcons_softc sc[DCONS_NPORT];
@@ -214,14 +219,17 @@ dcons_timeout(void *v)
tp = dc->tty;
tty_lock(tp);
- while ((c = dcons_os_checkc_nopoll(dc)) != -1)
+ while ((c = dcons_os_checkc_nopoll(dc)) != -1) {
ttydisc_rint(tp, c, 0);
+ poll_idle = 0;
+ }
ttydisc_rint_done(tp);
tty_unlock(tp);
}
- polltime = hz / poll_hz;
- if (polltime < 1)
- polltime = 1;
+ poll_idle++;
+ polltime = hz;
+ if (poll_idle <= (poll_hz * DCONS_POLL_IDLE))
+ polltime /= poll_hz;
callout_reset(&dcons_callout, polltime, dcons_timeout, tp);
}
@@ -368,8 +376,6 @@ dcons_attach(void)
dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
callout_init(&dcons_callout, CALLOUT_MPSAFE);
polltime = hz / poll_hz;
- if (polltime < 1)
- polltime = 1;
callout_reset(&dcons_callout, polltime, dcons_timeout, NULL);
return(0);
}
OpenPOWER on IntegriCloud