From patchwork Wed Jun 4 17:30:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4296161 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9DD189F1D6 for ; Wed, 4 Jun 2014 17:33:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D696D201DE for ; Wed, 4 Jun 2014 17:32:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E4C720149 for ; Wed, 4 Jun 2014 17:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbaFDRbE (ORCPT ); Wed, 4 Jun 2014 13:31:04 -0400 Received: from mail-vc0-f201.google.com ([209.85.220.201]:61306 "EHLO mail-vc0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbaFDRbB (ORCPT ); Wed, 4 Jun 2014 13:31:01 -0400 Received: by mail-vc0-f201.google.com with SMTP id hq11so954263vcb.2 for ; Wed, 04 Jun 2014 10:31:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rofhwCN75l0oob/8kBbcFaRegX6SNvJbH+42I7lZl3U=; b=Pvs5CDmfD1eLVOGLWhZ4MxLZxWQ/FxjWwA4I1EMFc4w9w+I+lubbw3AWp1Fvz+/nO+ srSRP2RB9vgjoBVAlkJZN8d9kWj/h7dTzHXO+CQ7YcP7PTHGeztJRBwmox7UpQUhOT+k DC2x7j4zU9mjdkSu7pz1ROKrp5tMVQuQR2tt2tVubyyOqAi13HtwomvY6CIuStFLMFhe pXwMfqiZ1USyZB72+1pcOTzEmz5QKqFPebXCgjiSOMa1peY4VDTPBr1kZnGnzlQnJ7QD ITFWQ00DmfGN1XRFKwUXyNIVuNPt0TcvfZgu41PvjNtdMam4HEi177xeK28FJ1WP6jHK u/GA== X-Gm-Message-State: ALoCoQksQLR1o+gKVthYJgfFq8UdcfUFF0zU3e9ni7wRDEknPPKU1cXv5sZfe9If0CjJRj1Pt/7N X-Received: by 10.58.119.100 with SMTP id kt4mr11611179veb.42.1401903060574; Wed, 04 Jun 2014 10:31:00 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id o69si301110yhp.6.2014.06.04.10.31.00 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jun 2014 10:31:00 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 572175A4C59; Wed, 4 Jun 2014 10:30:57 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 02F6880D2C; Wed, 4 Jun 2014 10:30:56 -0700 (PDT) From: Doug Anderson To: Kukjin Kim , Tomasz Figa Cc: Daniel Lezcano , Vincent Guittot , Chirantan Ekbote , David Riley , olof@lixom.net, linux-samsung-soc@vger.kernel.org, Mandeep Singh Baines , Andrew Bresticker , Doug Anderson , tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] clocksource: exynos_mct: cache mct upper count Date: Wed, 4 Jun 2014 10:30:33 -0700 Message-Id: <1401903034-20074-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 In-Reply-To: <1401903034-20074-1-git-send-email-dianders@chromium.org> References: <1401903034-20074-1-git-send-email-dianders@chromium.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mandeep Singh Baines Saves one register read. Note that the upper count only changes every ~178 seconds with a 24MHz source clock, so it's likely it hasn't changed from call to call. Before: 1323852 us for 1000000 gettimeofday in userspace After: 1173084 us for 1000000 gettimeofday in userspace Note that even with this change the CPU is in exynos_frc_read() more than 2% of the time in real world profiles of ChromeOS. That indicates that it's important to optimize. Signed-off-by: Mandeep Singh Baines Signed-off-by: Andrew Bresticker Signed-off-by: Doug Anderson --- drivers/clocksource/exynos_mct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index ba3a683..7cbe4aa 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -167,8 +167,8 @@ static void exynos4_mct_frc_start(u32 hi, u32 lo) static inline cycle_t notrace _exynos4_frc_read(void) { - unsigned int lo, hi; - u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); + u32 lo, hi; + static u32 hi2; do { hi = hi2;