Received: by 10.223.185.116 with SMTP id b49csp5435685wrg; Wed, 7 Mar 2018 11:42:04 -0800 (PST) X-Google-Smtp-Source: AG47ELvV8/VaLu1EDv1xUnu4IO/FQaQYP4QaWMjCdSCvgVfwrYsmntWNFrbIjRafIduQ+RcCk5zV X-Received: by 10.101.71.138 with SMTP id e10mr19630553pgs.317.1520451724750; Wed, 07 Mar 2018 11:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520451724; cv=none; d=google.com; s=arc-20160816; b=ztlZjwjXmqrVlJKTZGhdNTLpM0/6kmDRF4xe9nUlCaOvJkCamrHhpXvjPp0HwWCVXF zQVgciLcw1V7Aa+e3Y/TSYgrfbKVWdnwfwHOJpImp63mgt+59tOdHkg9pQNRBtFLWJAW dWI31E968zBbcqCAE2jGVGwi1Bf1s0qN7Er1yzvQtUGAZKJXMzU+/tUNpyqZQJZPMs2+ 3X4A5kLVpOoigH2YAUANmdbefSIrmtzxB6LLQjFcpf4CQeTZvOR6zoJ266gNwkg0v+TY on+vsCv0aknWrx9NdTMzmhUy3OzwYgkrfsNnHyP14msYIA8GjIL57yRo+dZhPZFVccv9 roow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=K2cYsOQBGwBW1tZ0NB5qgKqex4zUqkyeh0yaEykKmm4=; b=ddX+nPxMnirqICFHCYmpcu0EdTJ4STVsXS5mD5gmJY0IyAgzeJ1+u4XuPMVQaUBg75 Gc0MB11AAxjm2Hw/Blui5dn9H3fL+nqf2ppN27Y17i94mklx2pm77sijmmF/YGTg/vzQ ei4ZaZG7BM6R7/RIukseDTDk5gSIM8ImR0K3lC8yF82EfLpB3Hr+uoepsQuHzDVrrnD8 wDPNl9iszJYG0yb3bjgtuLTMMgroyHR0au4OO10TIPTEQbBTS7GsrxRKXL8BlqBPnWrx K8yR+yzIUkzFtadJWBNi36zgZ9BPaC+vhjySqkq3o3RaXWIkPsEG1UQbI/Dgy0gSLT1M plbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5-v6si13280528plv.94.2018.03.07.11.41.50; Wed, 07 Mar 2018 11:42:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934323AbeCGTk0 (ORCPT + 99 others); Wed, 7 Mar 2018 14:40:26 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40570 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754778AbeCGTkY (ORCPT ); Wed, 7 Mar 2018 14:40:24 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A2BA1F9E; Wed, 7 Mar 2018 19:40:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.15 025/122] parisc: Reduce irq overhead when run in qemu Date: Wed, 7 Mar 2018 11:37:17 -0800 Message-Id: <20180307191732.908858756@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Helge Deller 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 Cc: stable@vger.kernel.org # 4.14+ Signed-off-by: Greg Kroah-Hartman --- arch/parisc/kernel/time.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -76,10 +76,10 @@ irqreturn_t __irq_entry timer_interrupt( 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( * 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);