Received: by 10.223.185.116 with SMTP id b49csp5466584wrg; Wed, 7 Mar 2018 12:14:58 -0800 (PST) X-Google-Smtp-Source: AG47ELvEg+qeN/udasrhmg6I6r2Qv/7JytVYcBIz0DamAPbYLzKTHGC8s8SZXoLVHpBKk7F2rCND X-Received: by 2002:a17:902:b418:: with SMTP id x24-v6mr21295290plr.320.1520453698278; Wed, 07 Mar 2018 12:14:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453698; cv=none; d=google.com; s=arc-20160816; b=NaMcBD/MqpPXCPqUWB3d/StyVfZxqBfPuZbIQVliYcrvIJ26PHl9O2Egu8VgH0fleJ aCn1u98SRKs7pB/45qBFv2XaXUCsS6unapqL1pFSqf3w04a3rtOrI2sxVNX4ZW3oCAUJ KgQty31rnICWITGow64jTNW69Zo0JyNJ6jopDLZodOD9wKOp42gmHOd4Bvg6QcizQrqB UQqpAsewL1tf8C7n6uN9CnBtpTCQfu0ZjAU+Xv63ddXHKzKjdhLP6/lE8ZsA7n44YEOy eaig4sHRsocmbQCh2ybl9rSnG2mo+HqiFZEa4cXwl/jMBiAZ5kLVB9AHHmJYrW8DyjR1 0WVw== 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=7z1PgoAAvCHq5g1O4S2UE8ayOv6pR8Zow9YXihbXb8w=; b=jL7PW3bqSFqdRTtMeuR7vna4CoWi7bmazW6Jabvc6n7LIsyR2rt5xWIaFfDMkRJE6e +JjYbN3MdwwMTpCcFQUKbaUbtaEo5d987Gmb1fQCjMec+nFw3HqQYw1Bru5u8GalltA1 6DHM7Ewi+mgbIRhKrIy5tduZ0RXeMbtKjoHP0X+Kt/DqyETpuMGWC0r0L6vqHwda4Bq4 eMxhPvrUfaw+4U/KhRXofMp8hApyIYGr5+ooFk/kUYjBFRQ18Hnr633WiOEpLjn5c/hc 6djkuhzrgBCj45uinjcWl+kEMmzOQ+MpIUkMRiSBjjcgG7lNQsOlpVkczc8qflYU/J5B EVpQ== 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 l6si11808008pgp.249.2018.03.07.12.14.43; Wed, 07 Mar 2018 12:14:58 -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 S964883AbeCGTpC (ORCPT + 99 others); Wed, 7 Mar 2018 14:45:02 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43996 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965182AbeCGTo7 (ORCPT ); Wed, 7 Mar 2018 14:44:59 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6B693F2F; Wed, 7 Mar 2018 19:44:58 +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.14 022/110] parisc: Reduce irq overhead when run in qemu Date: Wed, 7 Mar 2018 11:38:05 -0800 Message-Id: <20180307191042.523045231@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-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);