From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73EA1C54E8E for ; Mon, 11 May 2020 00:34:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57BCB20736 for ; Mon, 11 May 2020 00:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729347AbgEKAey (ORCPT ); Sun, 10 May 2020 20:34:54 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:47740 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729255AbgEKAey (ORCPT ); Sun, 10 May 2020 20:34:54 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 83B488030807; Mon, 11 May 2020 00:34:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MfPFw58JDpyC; Mon, 11 May 2020 03:34:46 +0300 (MSK) Date: Mon, 11 May 2020 03:34:44 +0300 From: Serge Semin To: Thomas Bogendoerfer CC: Serge Semin , Alexey Malahov , Paul Burton , Ralf Baechle , Greg Kroah-Hartman , Arnd Bergmann , Rob Herring , , , afzal mohammed , , Subject: Re: [PATCH v2 19/20] mips: cevt-r4k: Update the r4k-clockevent frequency in sync with CPU Message-ID: <20200511003444.rcxp7e4elxdcgpyi@mobilestation> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> <20200506174238.15385-20-Sergey.Semin@baikalelectronics.ru> <20200508154045.GA22247@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200508154045.GA22247@alpha.franken.de> X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 05:40:46PM +0200, Thomas Bogendoerfer wrote: > On Wed, May 06, 2020 at 08:42:37PM +0300, Sergey.Semin@baikalelectronics.ru wrote: > > diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c > > index 17a9cbb8b3df..f5b72fb7d5ee 100644 > > --- a/arch/mips/kernel/cevt-r4k.c > > +++ b/arch/mips/kernel/cevt-r4k.c > > @@ -8,6 +8,7 @@ > > */ > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -250,6 +251,49 @@ unsigned int __weak get_c0_compare_int(void) > > return MIPS_CPU_IRQ_BASE + cp0_compare_irq; > > } > > > > +#ifdef CONFIG_CPU_FREQ > > + > > +static unsigned long mips_ref_freq; > > + > > +static int cpufreq_callback(struct notifier_block *nb, > > + unsigned long val, void *data) > > please prefix function names with r4k_ to make them different from > the other ones you implemented in kernel/time.c. I know they are > static, but keeping different names makes looking at crashes easier. Agreed. I'll fix it in v3. > > > + struct cpufreq_freqs *freq = data; > > + struct clock_event_device *cd; > > + unsigned long rate; > > + int cpu; > > + > > + if (!mips_ref_freq) > > + mips_ref_freq = freq->old; > > isn't this the same as mips_hpt_frequency ? No. Here I save the initial CPU frequency so use one then to scale the mips_hpt_frequency value in accordance with the CPU clock rate change. Yes, mips_hpt_frequency value may initially match the CPU frequency on some platforms but normally the r4k timer is clocked with half of it while some systems may have a complicated algorithm of the timer ref clock rate calculation. -Sergey > > Thomas. > > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ]