From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viresh Kumar Subject: Re: about system time incorrect after changing cpu frequency Date: Tue, 1 Sep 2015 13:12:05 +0530 Message-ID: <20150901074205.GC1456@linux> References: <20150901060236.GB1456@linux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pa0-f45.google.com ([209.85.220.45]:33532 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755117AbbIAHmK (ORCPT ); Tue, 1 Sep 2015 03:42:10 -0400 Received: by paczk9 with SMTP id zk9so19987260pac.0 for ; Tue, 01 Sep 2015 00:42:09 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: vichy Cc: "cpufreq@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux PM list On 01-09-15, 15:21, vichy wrote: > and I add PLAT_gt_change_freq in arm_global_timer.c like below: > PLAT_gt_change_freq calling() { > gt_clk_rate = get_periph_clk(); > clockevents_update_freq(this_cpu_ptr(gt_evt), gt_clk_rate); In earlier versions of kernel, this had a problem that it works only for ONESHOT mode and simply returns in PERIODIC mode. I do see that your's mode is ONESHOT only, and so it should have worked. Anyway, few prints into that routine to see where we are reaching might help. > __clocksource_updatefreq_hz(>_clocksource, gt_clk_rate); AFAIR, there is a difference between how different mdelay/udelay are implemented. One of them is using the loops_per_jiffie variable to calculate the time, other uses clkevt device. I am not 100% sure about the theory, but that's what I remember. So, have a look from that perspective as well.. -- viresh From mboxrd@z Thu Jan 1 00:00:00 1970 From: viresh.kumar@linaro.org (Viresh Kumar) Date: Tue, 1 Sep 2015 13:12:05 +0530 Subject: about system time incorrect after changing cpu frequency In-Reply-To: References: <20150901060236.GB1456@linux> Message-ID: <20150901074205.GC1456@linux> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 01-09-15, 15:21, vichy wrote: > and I add PLAT_gt_change_freq in arm_global_timer.c like below: > PLAT_gt_change_freq calling() { > gt_clk_rate = get_periph_clk(); > clockevents_update_freq(this_cpu_ptr(gt_evt), gt_clk_rate); In earlier versions of kernel, this had a problem that it works only for ONESHOT mode and simply returns in PERIODIC mode. I do see that your's mode is ONESHOT only, and so it should have worked. Anyway, few prints into that routine to see where we are reaching might help. > __clocksource_updatefreq_hz(>_clocksource, gt_clk_rate); AFAIR, there is a difference between how different mdelay/udelay are implemented. One of them is using the loops_per_jiffie variable to calculate the time, other uses clkevt device. I am not 100% sure about the theory, but that's what I remember. So, have a look from that perspective as well.. -- viresh