Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6912112imu; Mon, 3 Dec 2018 05:00:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/VzqDfrNzZUm8rIL/NNCOT40kY9VnYhL3mkAXHkXgZjr3n1sFqURCIIvdIKMZWVi3ccbTWr X-Received: by 2002:a17:902:4324:: with SMTP id i33mr9333730pld.227.1543842004216; Mon, 03 Dec 2018 05:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543842004; cv=none; d=google.com; s=arc-20160816; b=qIdS5sYWJ1MgTZTWLfzZ5E9Nk9JNLZPHR9z9PRpoc8/29xVrqZVjtdfMQjeo79KbuM ri6y/pbvwm9qFwijn1SJvq9jZSklh+bQTBaEkJTqP2MKHuTgs5MhFquFQCmsHRj9M/GN YXM1ejWn/o9qYpspv43vfo0F6ghlbLRh1GDkmGVjt9mKkqQjypafdUqIYol9RsXY0y6J AMqnHM0m4g9m0QFYL7kAmRcDT2I6vxhcs++BsCWR6E9+kQc4YuooJkJawIS6j0R2mr/F z7QZEZQoT4qdXa2rCYuujEFnh72Q8Lzt4d/mXtYGZsZrLf3ZOO1/00QdYCBdb+kDtmmT 3Jvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=oznX/kWjvnBF6iJxy125LWHVTKyXkJdryOV7MUn29P8=; b=WBtWA06RVwvAMkQ1D7FFr72IEdK3D71hTQYnaDiGSFjLDjEV10a2lQhwDiGJESI38Z pQIyHYKlAH5KEFZ/oDOlRlvQbbcs1pHiZt08OaWtPwQP944bXdy/k8shCwma4TcIYsyy 7vqCAHGOkbaMfewh8e3QUJY+H2HLZEID81VtmnwiIxtj5h4n25Sty1wWlf12Qd42Ro4K c0wywrytt+tbhK+JWaKKrvVEZCYLiNLE+Tx6PLLhyKYdhyMuWFbdFUAEGm25e+A05rFn BsKNG6yEdVlviH9uDpJoyeb65Ba8L4PHKdklwJOBpAj4fm/iUEw6qS95iliUbxeP5aZD fPIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KxR7qqTe; 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 j191si12499360pgc.15.2018.12.03.04.59.48; Mon, 03 Dec 2018 05:00:04 -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=KxR7qqTe; 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 S1726519AbeLCNAK (ORCPT + 99 others); Mon, 3 Dec 2018 08:00:10 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37495 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbeLCNAK (ORCPT ); Mon, 3 Dec 2018 08:00:10 -0500 Received: by mail-wr1-f68.google.com with SMTP id j10so12054470wru.4 for ; Mon, 03 Dec 2018 04:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oznX/kWjvnBF6iJxy125LWHVTKyXkJdryOV7MUn29P8=; b=KxR7qqTeZb8jgfT6jR2QNWBlel4j69NR7E/WhwvcnDZNLJi5o9C3EUSgI2SVfDjcvv y+ulkX1Fh0NAoi/nADkn0A5pyuQ/Htezo1iuNHfPtYCrfHDXCLhEASHwBWxCGid1GoNO s1dPtyhLz2eNHM/SmvA+yS0akgyswe2PceLSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oznX/kWjvnBF6iJxy125LWHVTKyXkJdryOV7MUn29P8=; b=U6VM4Tf4TFCnYnQyGDKCtEIAZHLAIYXT/uCPw/LUCczt+IcJ7FkkzPa7ZAfGkTJz3S QdoZu1KBb2RrQSOC1FC5LBr3xpgwbtUebR3jY5Crs7w5xlf0STY3KIelfeBe4b/+AY1g lVdZn/nn4kQGSwRdk0BuB5qx1mmlVwLcVm1w689yGnpyhdvqjORvGkls7oV2iqwsBjuR Ju2cDbuB9wENdbUJRN8IFWOO2TZXXQhkiO74zn44Bri8Bomk79EnuOiYua5uysa37P4K ZmAVqRvVE58lk/UY4zqNXu1g65gv+fAJZtlLrpapQdQ8cUyk2IXExIo6UTV2dLUcTRtS l6ww== X-Gm-Message-State: AA+aEWbH6W2KAtdfqa8nlwrWVrcXXBuNAfsznfPVpLP8yUk+iXJTFeA5 lCGu2eR+MgDT31UYM1TRghVKgBtO9B8= X-Received: by 2002:adf:f785:: with SMTP id q5mr14892076wrp.9.1543841951065; Mon, 03 Dec 2018 04:59:11 -0800 (PST) Received: from [192.168.0.40] (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.googlemail.com with ESMTPSA id g67sm14717299wmd.38.2018.12.03.04.59.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 04:59:10 -0800 (PST) Subject: Re: [PATCH] clocksource: riscv_timer: Provide sched_clock To: Anup Patel , Thomas Gleixner , Palmer Dabbelt , Albert Ou Cc: Atish Patra , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20181203123524.11778-1-anup@brainfault.org> From: Daniel Lezcano Message-ID: Date: Mon, 3 Dec 2018 13:59:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181203123524.11778-1-anup@brainfault.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/2018 13:35, Anup Patel wrote: > Currently, we don't have a sched_clock registered for RISC-V systems. > This means Linux time keeping will use jiffies (running at HZ) as the > default sched_clock. > > To avoid this, we explicity provide sched_clock using RISC-V rdtime > instruction (similar to riscv_timer clocksource). > > Signed-off-by: Anup Patel Hi Anup, the GENERIC_SCHED_CLOCK dependency in the Kconfig is missing. Thanks > --- > drivers/clocksource/riscv_timer.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/clocksource/riscv_timer.c b/drivers/clocksource/riscv_timer.c > index 084e97dc10ed..431892200a08 100644 > --- a/drivers/clocksource/riscv_timer.c > +++ b/drivers/clocksource/riscv_timer.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -49,6 +50,11 @@ static unsigned long long riscv_clocksource_rdtime(struct clocksource *cs) > return get_cycles64(); > } > > +static u64 riscv_sched_clock(void) > +{ > + return get_cycles64(); > +} > + > static DEFINE_PER_CPU(struct clocksource, riscv_clocksource) = { > .name = "riscv_clocksource", > .rating = 300, > @@ -97,6 +103,9 @@ static int __init riscv_timer_init_dt(struct device_node *n) > cs = per_cpu_ptr(&riscv_clocksource, cpuid); > clocksource_register_hz(cs, riscv_timebase); > > + sched_clock_register(riscv_sched_clock, > + BITS_PER_LONG, riscv_timebase); > + > error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, > "clockevents/riscv/timer:starting", > riscv_timer_starting_cpu, riscv_timer_dying_cpu); > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog