Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1454579ybk; Sun, 10 May 2020 17:38:39 -0700 (PDT) X-Google-Smtp-Source: APiQypLBEpnLm1WZS5zadymKMqg4fYbLo6uiIsMS2LiNlv0V7PAo23jjb1GIDuI1ICauXvr2y5K1 X-Received: by 2002:a17:906:8402:: with SMTP id n2mr3694779ejx.26.1589157518976; Sun, 10 May 2020 17:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589157518; cv=none; d=google.com; s=arc-20160816; b=aF0cNd8O+/jEpbELEXifluS87OloQSqq+MpVHEiornfl0oLx+YHD4hgV+m56eK1Lpu 8p9UdhL3Yp/TrZBTqgpyIOtVjkGKNHAdJtqq8VyOdmsDQdRNlbRDHGdnN+lXHQhrg8vV wC3DU3T0n2nMD1s6aihpc41b1CkgcZklNcBFQzmaSfevgwAfvQG8/FGbnE0/4UPIy9Mb W1c55GBYRlm8ffeJLB/M/6w3nMD6km1DPMJAE5hlMF6w1OFLSlZ0RUYPHdof7Emf1R0F qEGLf2BRg7EJ2naxM3z3fpgL7p0KLdeuQyz+YxA4D32mI3jK4u3Y9X6HxuwOzEyCtsyD 9gpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=+PAxeXDLCkQn/5ic/TXmGEEsnU7QTGc4UOuyN4Pt6iM=; b=MDLBuQsaVi8MUgYgelAq6GOCdb8PVfl8uIpHO4u1LTP+d/LWIV3CtVwo7a3r3pRZZd 4TAQMEmVWYCc0b7suBQQd2ASl+8+lCazdd9cdwrVzhJ0rTNBz92pUNr2Srf5cYmAOdyT D0dOs7PIqFM6G9UmIelqpyzRWdwRPEPZ751lBFtdDKm2ifaTGAlMnjp83mHTsPWgqjl9 EDs1O7r00yllbgMRv1qiXtHR7JQw913jB1CPuuJsK875kw9BbP+tN3vIjoGpUyRn3u74 mFfk+Amv9r/5EIjUVAvG3ljKXItq5QqnLIpVR9onlDmX9d1qr7zIphtpiT6kvzi3vNFp bejw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o32si5040412edb.380.2020.05.10.17.38.15; Sun, 10 May 2020 17:38:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729339AbgEKAey (ORCPT + 99 others); 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 ]