Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 542EBECAAD3 for ; Mon, 5 Sep 2022 20:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=YNnIOuNQ0KUvjLT9RIo2h1Gh8KKgvK5X9+XEVNCs7tc=; b=akRp2w1ZPnPmSi 9dSeKYfhN+t5dmtAVo6CyuQAFgsN56lM4TkPa+5qqAf3Jt1gJwAIqDIuY3+bU1OQ6On2GgIbPWfOG yLWQ9qWiaJwvJTmHDM0qf9MtWGFIMLVvWjerV7qDxtohBAAWNpqAJSLhHHzDNf8SbkGAfXVJXNtB4 1xG14UK5W66A53niz1H3VMS0B1Rz65u1TrwwawdnftnvEq9UlVL3xxydNYMOcO7jBQSjWEwGflczP cl/hxMiMzHsZIpjjZ3pa5vThHnWu6RDtl1IobHDjL4l2z7unTp3f8jnopvF+iCkvTN4+DOYWdmZzV j+pnnJuhPwgvvT8bZaOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIXn-00ADvG-GS; Mon, 05 Sep 2022 20:18:08 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIOS-009y0m-KX for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 20:08:35 +0000 Received: by mail-pl1-x636.google.com with SMTP id iw17so2678096plb.0 for ; Mon, 05 Sep 2022 13:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=5guSbQFNQyVmfB+B0Sn+swphO/qeckhGkcuHgI8/A1M=; b=GbSPWqt8gG6J2ATWKTz2wfJxcu3DRXVRDN20RD5ehyC6dbpT8KIDGom/9eQ44dFGM7 L/o2lUuqCBsDufr1NecYe3yDRgR+EjD1qI7gIRiR9HSl8qmAYjRp6VPetqEyyq5/3bIj TI9gJmTNWUOMfRhwGb+kycAzGqk/8kclVyGyg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=5guSbQFNQyVmfB+B0Sn+swphO/qeckhGkcuHgI8/A1M=; b=0AhZocL+hZ/QiTptltU93J9Y2EMvXYXbFQknRHi3SYybMHjpel0CbiogDkVXJL05t1 nzKSYyDYKplu3tf1BblOJYdgLbqzBNPA13NdLS6pmKQMvE9F3i/krVlk14G+hiZMDXAm 6k4EqE2K4Td84sRxwLFqgP5nE9tggR7MKZR+TkOBLReiNftHHH3peGNJfLcxr3QmBMn/ XPmhNzYeDGZoSozTu3fb3jIIz51Km1dc+BdxEGq9mNi9yW50PWx22CgacRvkbad4RHAC XxX3xBGHUr5baUt9i7csQmIp/V5qCHsy7hak30zdLXSx/Ee07nFaAeQ5NMy/CiydqonF EQ7Q== X-Gm-Message-State: ACgBeo1Vqq5S2LNHqkHNYK6QWUl4mF1skhvFElq1z4T2afA3Sg0jyKxK BTWkkYLaYzEDwUU6iuNslmwtLQ== X-Google-Smtp-Source: AA6agR42vtu0Nq5uHnaQz5at0UBddPS8lC4jn0qgFmX/VFACMEIOGdpXYwqodvBy9AKfRi0yDDu3zA== X-Received: by 2002:a17:902:904b:b0:170:a3e6:9d98 with SMTP id w11-20020a170902904b00b00170a3e69d98mr50238722plz.50.1662408506678; Mon, 05 Sep 2022 13:08:26 -0700 (PDT) Received: from localhost.localdomain ([50.45.132.243]) by smtp.gmail.com with ESMTPSA id y2-20020a634942000000b0042f62120c1bsm6764258pgk.17.2022.09.05.13.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:08:26 -0700 (PDT) From: Doug Brown To: Lubomir Rintel , Russell King Cc: Eric Miao , Jason Chagas , linux-arm-kernel@lists.infradead.org, Doug Brown Subject: [PATCH] ARM: mmp: fix timer_read delay Date: Mon, 5 Sep 2022 13:08:04 -0700 Message-Id: <20220905200804.438049-1-doug@schmorgal.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_130828_862440_3CAB3055 X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The timer_read function was using an empty 100-iteration loop to wait for the TMR_CVWR register to capture the latest timer counter value. The delay wasn't long enough. This resulted in CPU idle time being extremely underreported on the PXA168 with CONFIG_NO_HZ_IDLE=y. Switch to the approach used in an older vendor kernel, which implements the capture delay by reading TMR_CVWR a few times instead. Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line") Signed-off-by: Doug Brown --- arch/arm/mach-mmp/time.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c index 41b2e8abc9e6..162603fdef0a 100644 --- a/arch/arm/mach-mmp/time.c +++ b/arch/arm/mach-mmp/time.c @@ -43,16 +43,18 @@ static void __iomem *mmp_timer_base = TIMERS_VIRT_BASE; /* - * FIXME: the timer needs some delay to stablize the counter capture + * Reads the timer through the CVWR register. Delay is required after + * requesting a read. We can't directly read the CR register due to + * metastability issues documented in the datasheet. */ static inline uint32_t timer_read(void) { - int delay = 100; + int delay = 3; __raw_writel(1, mmp_timer_base + TMR_CVWR(1)); while (delay--) - cpu_relax(); + __raw_readl(mmp_timer_base + TMR_CVWR(1)); return __raw_readl(mmp_timer_base + TMR_CVWR(1)); } -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel