diff options
author | Helge Deller <deller@gmx.de> | 2018-02-12 21:43:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-08 22:41:04 -0800 |
commit | 47e7fc96cddca4d78498dd0e8da98ca018b2633b (patch) | |
tree | c42a22f6d6e3124602b2c4322c92f7ec5ed911a7 /arch | |
parent | 90c3f0d36000dcddc0bf2b1b889784a8795cc4d6 (diff) | |
download | linux-stable-47e7fc96cddca4d78498dd0e8da98ca018b2633b.tar.gz linux-stable-47e7fc96cddca4d78498dd0e8da98ca018b2633b.tar.bz2 linux-stable-47e7fc96cddca4d78498dd0e8da98ca018b2633b.zip |
parisc: Reduce irq overhead when run in qemu
commit 636a415bcc7f4fd020ece8fd5fc648c4cef19c34 upstream.
When run under QEMU, calling mfctl(16) creates some overhead because the
qemu timer has to be scaled and moved into the register. This patch
reduces the number of calls to mfctl(16) by moving the calls out of the
loops.
Additionally, increase the minimal time interval to 8000 cycles instead
of 500 to compensate possible QEMU delays when delivering interrupts.
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # 4.14+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/parisc/kernel/time.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 68e88e5c0898..f7e684560186 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -76,10 +76,10 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id) next_tick = cpuinfo->it_value; /* Calculate how many ticks have elapsed. */ + now = mfctl(16); do { ++ticks_elapsed; next_tick += cpt; - now = mfctl(16); } while (next_tick - now > cpt); /* Store (in CR16 cycles) up to when we are accounting right now. */ @@ -103,16 +103,17 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id) * if one or the other wrapped. If "now" is "bigger" we'll end up * with a very large unsigned number. */ - while (next_tick - mfctl(16) > cpt) + now = mfctl(16); + while (next_tick - now > cpt) next_tick += cpt; /* Program the IT when to deliver the next interrupt. * Only bottom 32-bits of next_tick are writable in CR16! * Timer interrupt will be delivered at least a few hundred cycles - * after the IT fires, so if we are too close (<= 500 cycles) to the + * after the IT fires, so if we are too close (<= 8000 cycles) to the * next cycle, simply skip it. */ - if (next_tick - mfctl(16) <= 500) + if (next_tick - now <= 8000) next_tick += cpt; mtctl(next_tick, 16); |