Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945AbdI0RLd (ORCPT ); Wed, 27 Sep 2017 13:11:33 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:35068 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbdI0RLc (ORCPT ); Wed, 27 Sep 2017 13:11:32 -0400 Subject: Re: [PATCH v6 1/4] sched/clock: interface to allow timestamps early in boot To: Russell King - ARM Linux Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, Peter Zijlstra , Dou Liyang References: <1504116205-355281-1-git-send-email-pasha.tatashin@oracle.com> <1504116205-355281-2-git-send-email-pasha.tatashin@oracle.com> <20170927144506.GU20805@n2100.armlinux.org.uk> From: Pasha Tatashin Message-ID: <28c575e4-daa1-a959-e9a5-20f05033a6f0@oracle.com> Date: Wed, 27 Sep 2017 13:10:35 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170927144506.GU20805@n2100.armlinux.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 990 Lines: 20 Hi Russell, This might be so for ARM, and in fact if you look at my SPARC implementation, I simply made source clock initialize early, so regular sched_clock() is used. As on SPARC, we use either %tick or %stick registers with frequency determined via OpenFrimware. But, on x86 there are dozen ways clock sources are setup, and some of them available quiet late in boot because of various dependencies. So, my early clock initialization for x86 (and expendable to other platforms with unstable clocks) is to make it available when TSC is available, which is determined by already existing kernel functionality in simple_udelay_calibration(). My goal was not to introduce any regressions to the already complex (in terms of number of branches and loads) sched_clock_cpu(), therefore I added a new function and avoided any extra branches through out the life of the system. I could mitigate some of that by using static branches, but imo the current approach is better. Pasha