From patchwork Thu Nov 15 13:32:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 151225 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6995063ljp; Thu, 15 Nov 2018 05:32:17 -0800 (PST) X-Google-Smtp-Source: AJdET5d0mk6qM5Wvfm5EVamP7XOcnXnx8bK7+fKgujk2rcaAogFEb2SmlEFM0A5+rkdkIo4XOO19 X-Received: by 2002:a63:7306:: with SMTP id o6mr5715594pgc.343.1542288736842; Thu, 15 Nov 2018 05:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542288736; cv=none; d=google.com; s=arc-20160816; b=FyJFtLfMe3WM9jZ9EBkQoy55rYzBsNIKLon7yQZRuhVGlz+96vb5+J4yHn0DNAYWAn PwZolthFCm6e62pqKfz8eyiMlxnqwmns4QMOwrz+TdboKCOJTt6t8nJ1aw9tEiCqlvzL WlheYpjxap+gMnTAv5u1I+lchvBCCSKjZdBMvTPFqrOnPAuXheZeMoZdOMbm2ZV/pgQu 0R/d1in1aeCtWHN69HfAQzw2LTr0BPzdsB8XgKeInriLxvUBS3Kz4CZu20Cg4254MCZM noDoOC1hTu0Q+eA1eZzctMyxJNPNDcoC8KaxX6GQLet8ADn4WUsndwO0GpOr4a7oD/ws iZ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=KUan3OzAdZ8g7FaQ0bp8nq8b/qVWijqdlEjN9w8ObM4=; b=DK/d3Fn7BHLjbn6GGumjpKv/qFPFgI/zgyDtkE1Iju000H1nVCa7LmHF7wlYgnkS+U ZTiYZO5R/f89hVaQpyCP5+IpzKjqnkxUgSmg2VzBDM8GtKdHniYGy+msj+u8fWLnIlKd Zgry82y/gBn+A9JFuEDgr76wjXx11ImuZbQgIWPaok9iPboDnFf1CtAKqJ5Rtn3LANse zS4ZjSpCnWSgiEY47N6Cv+k/6o6lgmneqD8qkvKURX3dF53iWHK6zKBXj+8F1c+cIVEo 7j1+sTo0QCs6b1fkBceZJQWITjSg/ei2m/K6QbCM0JfpKsGDPaspnOAuoKjwZgcSOs7D U0Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dDGCcTCl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si26871517pll.325.2018.11.15.05.32.13; Thu, 15 Nov 2018 05:32:16 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dDGCcTCl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388371AbeKOXkC (ORCPT + 32 others); Thu, 15 Nov 2018 18:40:02 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41263 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388290AbeKOXkC (ORCPT ); Thu, 15 Nov 2018 18:40:02 -0500 Received: by mail-lf1-f67.google.com with SMTP id c16so14135822lfj.8 for ; Thu, 15 Nov 2018 05:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=KUan3OzAdZ8g7FaQ0bp8nq8b/qVWijqdlEjN9w8ObM4=; b=dDGCcTClUlsV9dWCLEtW5f0S8V5MhLLsNnQeQ45ZkG6zEUFn7nh8Wc3U6lV0BJ8ZUj 6f17EtFTgR49AnhKEhiB1frnjfZw5mmwUxN183kE2UXFkcD8qvRL3Zi3OpWwgMpUol1H neG6lF5wDuCU9pyxjUI8G1fi4cBlmUhi0ZYVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KUan3OzAdZ8g7FaQ0bp8nq8b/qVWijqdlEjN9w8ObM4=; b=K8tpzp+wgsXxp5UDmOZz4ecpnNHJOrJu8zbfQR8LoUb2AfBlkxQi5hRO518+uO0hxV 5KzPW6VuezO4HRTFkODuWwjYyNrEeFOg8ObzdkF4kDa+W3cmhmAZIqDgOBfgWgzIWB81 E+n/CMKXzjfPgAk05SCH3CJlanDJUsf+M3sHnLrANoI6G5TE102pjQW/nSAYyZifQhOm QIM3N+P/xfRJBVT5uT6ibMpZvErsqOz6RUNyOwrSjwyKEFlId9kY9m2moj4Hy5qup0pn zDl4ah+zfLTvvrRx499KDRzOX6EYgqnjTqIJWM0dae0cyDdS5LEBGFlT3PCHgmlRZaCb HV8A== X-Gm-Message-State: AGRZ1gLnWsiJj7eK8Wy0cT4SUB1og/n+MBHpJVz7qACeUyA7tlQhtTYX JeNc7SD3kr3D9e5jg2UKM3cnfH3TO6jwhQ== X-Received: by 2002:a19:f813:: with SMTP id a19mr3325289lff.67.1542288728568; Thu, 15 Nov 2018 05:32:08 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f76sm4291949lfl.74.2018.11.15.05.32.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 05:32:07 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, Daniel Lezcano , Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij , Baolin Wang Subject: [PATCH 1/2] clocksource: Demote dbx500 PRCMU clocksource Date: Thu, 15 Nov 2018 14:32:02 +0100 Message-Id: <20181115133203.28567-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Demote the DBx500 PRCMU clocksource to quality 100 and mark it as NONSTOP so it will still be used for timekeeping across suspend/resume. The Nomadik MTU timer which has higher precision will be used when the system is up and running, thanks to the recent changes properly utilizing the suspend clocksources. This was discussed back in 2011 when the driver was written, but the infrastructure was not available upstream to use this timer properly. Now the infrastructure is there, so let's finalize the work. Cc: Baolin Wang Signed-off-by: Linus Walleij --- drivers/clocksource/clksrc-dbx500-prcmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.2 Reviewed-by: Baolin Wang diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c index c1b96dc5f444..4054539fe066 100644 --- a/drivers/clocksource/clksrc-dbx500-prcmu.c +++ b/drivers/clocksource/clksrc-dbx500-prcmu.c @@ -46,10 +46,10 @@ static u64 notrace clksrc_dbx500_prcmu_read(struct clocksource *cs) static struct clocksource clocksource_dbx500_prcmu = { .name = "dbx500-prcmu-timer", - .rating = 300, + .rating = 100, .read = clksrc_dbx500_prcmu_read, .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, + .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, }; #ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK From patchwork Thu Nov 15 13:32:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 151226 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6995145ljp; Thu, 15 Nov 2018 05:32:21 -0800 (PST) X-Google-Smtp-Source: AJdET5dFy+/O+JeauBJplW3sX4QfaXLm1hSHVxrpraGmHsHE2aZJoLyvQNvS7mwWHh29vLm5hNMP X-Received: by 2002:a65:484c:: with SMTP id i12mr5789654pgs.309.1542288740913; Thu, 15 Nov 2018 05:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542288740; cv=none; d=google.com; s=arc-20160816; b=OvbIlOpiMqcXyYG9Bj5kUnsLSwHkD4quHvBUZbgIuFi3MEXwJbLtnsyJHroKQZj1eX cbK1Ifio6W8mS0nShaUqO1MJ97hjQAqakZpFqG0JvJlOeDbbpJxNlem0+XFPB3t3Nt1v spsC89cRtEUFz9lH8+MW2oJg8kVcB9T0bxTkgsY/pKCXE5/baW6FNOD9+lEtUKr2qO6q KALKhLUWf/yEDg3w1ZsdoglzhNNEq5zQ+2lq5BfhF2/Mfw6/AEtvlfLNtj4QExd4Dqu/ dAP3ATzQtTz0GlEY++IW3MV/K7h3sBTB9yBUz+8oe7fn4PU5ZB75C97Avf0pfl7uckfV EHLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=o7M9G96s4mn6gVHofvS0Iq+dG/9ayDwkuUKUrD30CTM=; b=YjDZJDxQ+QLg1Bms93LpVOZNi7gApqlWrWck8hk1DQ7gXeWZ3U0rEeP49VbFFEzUHL 7RRa+cdQdYRk9ZBGI23k1TYQAp3Sz7SNW5OR9TP7ijWKKcdM8JjqsvhefYC+saFSKNiR KjNdp6vKeARGdaznkz948EJkAklZdhgwxKK7/AsKvRysWnPbAhomCyZVSUFZ2YIUzGus 9aBI2F4nHJ2UwV2QuFGyd1y55jYzyusW1o2ietiDww9f7I94gMi5CEAqkveOMtwxPEjV yv4f2H0juSGWdrRtszIYTkJM01HCSZEwgQ2AXYPoYAFIyadQnN494AU3OAmhacZJyOZF 3FQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eR0brWNV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si26871517pll.325.2018.11.15.05.32.17; Thu, 15 Nov 2018 05:32:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b=eR0brWNV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388394AbeKOXkH (ORCPT + 32 others); Thu, 15 Nov 2018 18:40:07 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36421 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388290AbeKOXkG (ORCPT ); Thu, 15 Nov 2018 18:40:06 -0500 Received: by mail-lf1-f67.google.com with SMTP id h192so14141395lfg.3 for ; Thu, 15 Nov 2018 05:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o7M9G96s4mn6gVHofvS0Iq+dG/9ayDwkuUKUrD30CTM=; b=eR0brWNVkbTbmDX1Uss1C6555F3RWGVEXK2PRUbhUeGJzOZ8IlZmIbq8cH66PSEJN6 AemtFqTTwI81Q3YbGLY5+aDS2YwNf1UL+9BpDWZ7bY0Hv1INwGBqfKEloikonPjY6mfu T4RTAGnCW/9EIt5bypacmzmf40zwcQgY5zX9U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o7M9G96s4mn6gVHofvS0Iq+dG/9ayDwkuUKUrD30CTM=; b=qZIVWQpZdYGvswXmcld/fTeYgdSQZ3dO84nMbxZxC/P2edc476clsyERGAInl276SF +LNF3mgUwN40No3gi/TJi/3QU5/BA+lKli8x/bmVwE3kCwnMkwZSA45x/usR6LzvbxCX SwLxytlTjrdE+/GBko/2/CDQIogjtNDSFK+iwXP/oS+JhkMlF2dQcD/QPWjD00s/AQuQ OCPj0V2OCGpT/HBuSgm0DrbtpwrQ1n6YtoU+fC2TBH9Bs5jgcJnS+bC6l6AvrHL8EhKP 9Fps0VytqX7NFGY157zooBjN7JUrYvjj6vnIE3ZPx1VcHjGvVIMYQqPojbED7py5BVek 1agw== X-Gm-Message-State: AGRZ1gJOOujb94dtmF326GHdoR0o0qw/m7oIroYxS23Z+UgUDIjhkNEJ 0lYMUesCG0eTWsko/wBRHAHwBY3J33/KuQ== X-Received: by 2002:a19:4f0c:: with SMTP id d12mr3298185lfb.121.1542288731296; Thu, 15 Nov 2018 05:32:11 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f76sm4291949lfl.74.2018.11.15.05.32.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 05:32:10 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, Daniel Lezcano , Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij , Baolin Wang Subject: [PATCH 2/2] clocksource: Drop Ux500 custom SCHED_CLOCK Date: Thu, 15 Nov 2018 14:32:03 +0100 Message-Id: <20181115133203.28567-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181115133203.28567-1-linus.walleij@linaro.org> References: <20181115133203.28567-1-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The two drivers used for Ux500 sched_clock use two Kconfig symbols to select which of the two gets used as sched_clock. This isn't right: the workaround is trying to make sure that the NONSTOP timer is used for sched_clock in order to keep that clock ticking consistently over a suspend/resume cycle. (Otherwise sched_clock simply stops during suspend and continues after resume). This will notably affect any timetstamped debug prints, so that they show the absolute number of seconds since the system was booted and does not loose wall-clock time during suspend and resume as if time stood still. The real way to fix this problem is to make sched_clock take advantage of any NONSTOP clock source on the system and adjust accordingly, not to try to work around this by using a different sched_clock depending on what system we are compiling for. This can solve the problem for everyone instead of providing a local solution. Cc: Baolin Wang Signed-off-by: Linus Walleij --- Any suggestions on how to proceed to make sched_clock keep ticking using NONSTOP clocksource is welcome. --- drivers/clocksource/Kconfig | 13 ------------- drivers/clocksource/clksrc-dbx500-prcmu.c | 18 ------------------ drivers/clocksource/nomadik-mtu.c | 4 ---- 3 files changed, 35 deletions(-) -- 2.17.2 diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 55c77e44bb2d..64d5759ddf0e 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -163,12 +163,6 @@ config CLKSRC_NOMADIK_MTU to multiple interrupt generating programmable 32-bit free running decrementing counters. -config CLKSRC_NOMADIK_MTU_SCHED_CLOCK - bool - depends on CLKSRC_NOMADIK_MTU - help - Use the Multi Timer Unit as the sched_clock. - config CLKSRC_DBX500_PRCMU bool "Clocksource PRCMU Timer" if COMPILE_TEST depends on HAS_IOMEM @@ -226,13 +220,6 @@ config INTEGRATOR_AP_TIMER help Enables support for the Integrator-ap timer. -config CLKSRC_DBX500_PRCMU_SCHED_CLOCK - bool "Clocksource PRCMU Timer sched_clock" - depends on (CLKSRC_DBX500_PRCMU && !CLKSRC_NOMADIK_MTU_SCHED_CLOCK) - default y - help - Use the always on PRCMU Timer as sched_clock - config CLKSRC_EFM32 bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32 depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST) diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c index 4054539fe066..51d53c4e646f 100644 --- a/drivers/clocksource/clksrc-dbx500-prcmu.c +++ b/drivers/clocksource/clksrc-dbx500-prcmu.c @@ -15,7 +15,6 @@ #include #include #include -#include #define RATE_32K 32768 @@ -26,8 +25,6 @@ #define PRCMU_TIMER_DOWNCOUNT 0x4 #define PRCMU_TIMER_MODE 0x8 -#define SCHED_CLOCK_MIN_WRAP 131072 /* 2^32 / 32768 */ - static void __iomem *clksrc_dbx500_timer_base; static u64 notrace clksrc_dbx500_prcmu_read(struct clocksource *cs) @@ -52,18 +49,6 @@ static struct clocksource clocksource_dbx500_prcmu = { .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, }; -#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK - -static u64 notrace dbx500_prcmu_sched_clock_read(void) -{ - if (unlikely(!clksrc_dbx500_timer_base)) - return 0; - - return clksrc_dbx500_prcmu_read(&clocksource_dbx500_prcmu); -} - -#endif - static int __init clksrc_dbx500_prcmu_init(struct device_node *node) { clksrc_dbx500_timer_base = of_iomap(node, 0); @@ -81,9 +66,6 @@ static int __init clksrc_dbx500_prcmu_init(struct device_node *node) writel(TIMER_DOWNCOUNT_VAL, clksrc_dbx500_timer_base + PRCMU_TIMER_REF); } -#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK - sched_clock_register(dbx500_prcmu_sched_clock_read, 32, RATE_32K); -#endif return clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K); } TIMER_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4", diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index 8e4ddb9420c6..19b336c9b417 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c @@ -69,7 +69,6 @@ static u32 clk_prescale; static u32 nmdk_cycle; /* write-once */ static struct delay_timer mtu_delay_timer; -#ifdef CONFIG_CLKSRC_NOMADIK_MTU_SCHED_CLOCK /* * Override the global weak sched_clock symbol with this * local implementation which uses the clocksource to get some @@ -82,7 +81,6 @@ static u64 notrace nomadik_read_sched_clock(void) return -readl(mtu_base + MTU_VAL(0)); } -#endif static unsigned long nmdk_timer_read_current_timer(void) { @@ -234,9 +232,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq, return ret; } -#ifdef CONFIG_CLKSRC_NOMADIK_MTU_SCHED_CLOCK sched_clock_register(nomadik_read_sched_clock, 32, rate); -#endif /* Timer 1 is used for events, register irq and clockevents */ setup_irq(irq, &nmdk_timer_irq);