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: 4296191 Return-Path: X-Original-To: patchwork-linux-arm@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 742549F1D6 for ; Wed, 4 Jun 2014 17:33:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD0DA20251 for ; Wed, 4 Jun 2014 17:33:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2BA8201DE for ; Wed, 4 Jun 2014 17:33:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsF2N-0007yk-R0; Wed, 04 Jun 2014 17:31:43 +0000 Received: from mail-vc0-f201.google.com ([209.85.220.201]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsF22-0007et-1s for linux-arm-kernel@lists.infradead.org; Wed, 04 Jun 2014 17:31:24 +0000 Received: by mail-vc0-f201.google.com with SMTP id hq11so953569vcb.4 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=Zyoz9D1BSEMlyiksFz72LJNHSL9vKD57S6tyfa7hBSjuylNeCX4zFX3h6rDMEXPSZD 9gOTWtFUx21Z6XK6xDR/mxrjkQBTmPw2tLo6x/YNP/K2lOv54Gdr5BvWx+vrnkNMQllE Ix3nL6VUkMBjE4Tb45+Vt6QbwieUXMSws+sjsUxlK2+VtqgCJ/tJcG1TiPUprC8ntYTm ENokAFTwbzwwzty1lLjhHtFMhLBASWmNwmCnuIzBeDDUkuuSEOaNQ9b+JHP/LSzQgcu2 V5F35Jzd2VuOVXHdtn0V9nNCSNYdUKAXthKgcOTs8dm4UcNp9+Lzp+NUTr2ZhyrzJszp YcbQ== X-Gm-Message-State: ALoCoQnZL7xFI+5+ghMHNoNqaPDFkLai/39UT30GNrplxBb2M0pE3hMvZsUc/PZC9AkrsXrZiTxw 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140604_103122_205471_882F29DD X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: -1.4 (-) Cc: linux-samsung-soc@vger.kernel.org, David Riley , Chirantan Ekbote , Mandeep Singh Baines , Daniel Lezcano , Doug Anderson , linux-kernel@vger.kernel.org, Andrew Bresticker , olof@lixom.net, Vincent Guittot , tglx@linutronix.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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;