Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1203406ybt; Sat, 11 Jul 2020 03:02:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpqQFjIgR3rP4yGOEvPHm/WcsDrQWIZlC7qyWuDuCX5LezqbTO9BtRk8smHXMd+doq5x6x X-Received: by 2002:a17:906:e0c7:: with SMTP id gl7mr61051103ejb.264.1594461777228; Sat, 11 Jul 2020 03:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594461777; cv=none; d=google.com; s=arc-20160816; b=WaLhVkMFy0eWrYWfrh1SlrJWTB5UXmNivcG0E7fHl4lHPuIMeVZzQmbSEG1XCEucjW 2/v8pSytFldBQrAP7EbX2JYAurER70K+ah2108oFDaYaFmhvtfBalcRQn8rf2UJt/wFz lfHEA8/WqKKVLuS3JGJVSuspWb3xDTnP50IM3l45yd6UvxLTxT2rxvycgP/3GNl+36W1 70l9VvCBDf22MC235DTB8uX0gv21hB7ZqQeVzVc2PlVaFGyp1Ai6iOY7XWVGVjthQb7r kHVNit/tqjX9dy75tc1AQC3QfzQ/g4AyY1r7gfzTdbn5KQWs22VaUum8Bla8lOY+KB1F ifiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=Brj2Uur/vWw8fobBoxnPCAHoheyz+8lGCkL8KGgE4kk=; b=Sjq6fDtZrChgmHeDRjC3kyXeCCVGFEh5YrC6y8X5kWqyUqlHLwcDPKXz3XlRQCumRX v4U9ijqREi1U2GrRXy6iULAx6h5Q+94ibwBnKThfLPjoeXnr5imuGUhjVgSsBTgFPmwC Nl3iuJdWmjRBOJNU+QEMKZeA4GyLMPfMXlWnP8Ahe+OZqXiEWG8b+5dRt9SsTcy7rHDu IrRsfwROU2PD+fVmL85ou8+1UbpBrQ1puKP887lOrewt4d6/1e50uLG6XSIBcMMhS3tl ZD31hHMgZDLMx13EMLjfGEQddlE43yT54KhCXbu4STmer92fem+CZXSC+arYt67G56OJ /8Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aurel32.net header.s=202004.hall header.b=T3rF3OsC; 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 v4si5181923ejx.555.2020.07.11.03.02.33; Sat, 11 Jul 2020 03:02:57 -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; dkim=pass header.i=@aurel32.net header.s=202004.hall header.b=T3rF3OsC; 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 S1728089AbgGKKCC (ORCPT + 99 others); Sat, 11 Jul 2020 06:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbgGKKCB (ORCPT ); Sat, 11 Jul 2020 06:02:01 -0400 Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBA2C08C5DD for ; Sat, 11 Jul 2020 03:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=Brj2Uur/vWw8fobBoxnPCAHoheyz+8lGCkL8KGgE4kk=; b=T3rF3OsCphU2NAQsomSG79Gt7G toOUn6F5KjoMhxsr7qwX0TqKajhOBb5Yiwwk7CK6VeFp8KlTLYtmadtvGpULqvEEUVGwymznvessY 5skk9TM12Wf3h47kZUDIbTMD+cCSJKHfCtijxevGHedRQlD857qWYp3owOp3DlgxEyGEfxGy4830G gnkd1pPeUZxEgirqLUdI96a9Rw8nnJCgofAUmv0QwIE1RbxsMZ1HBL1dUTMt182DuKbQuKqqducmU BmSvsX7hSsF8s3RJnoBcSCU0ZChdIhHvDUwQDF85JjEsXYUhEK2eAq0gPt7+eFVxbqotky0YlLYOj IDry8pzw==; Received: from [2a01:e35:2fdd:a4e1:fe91:fc89:bc43:b814] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juCKN-0005Xf-Iz; Sat, 11 Jul 2020 12:01:51 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.94) (envelope-from ) id 1juCKL-00A3er-Fn; Sat, 11 Jul 2020 12:01:49 +0200 Date: Sat, 11 Jul 2020 12:01:49 +0200 From: Aurelien Jarno To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Serge Semin , Alexey Malahov , Jiaxun Yang , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [PATCH AUTOSEL 4.19 080/106] mips: Add udelay lpj numbers adjustment Message-ID: <20200711100149.GA2397222@aurel32.net> Mail-Followup-To: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Serge Semin , Alexey Malahov , Jiaxun Yang , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , devicetree@vger.kernel.org, linux-mips@vger.kernel.org References: <20200608232238.3368589-1-sashal@kernel.org> <20200608232238.3368589-80-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608232238.3368589-80-sashal@kernel.org> User-Agent: Mutt/1.14.0 (2020-05-02) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-08 19:22, Sasha Levin wrote: > From: Serge Semin > > [ Upstream commit ed26aacfb5f71eecb20a51c4467da440cb719d66 ] > > Loops-per-jiffies is a special number which represents a number of > noop-loop cycles per CPU-scheduler quantum - jiffies. As you > understand aside from CPU-specific implementation it depends on > the CPU frequency. So when a platform has the CPU frequency fixed, > we have no problem and the current udelay interface will work > just fine. But as soon as CPU-freq driver is enabled and the cores > frequency changes, we'll end up with distorted udelay's. In order > to fix this we have to accordinly adjust the per-CPU udelay_val > (the same as the global loops_per_jiffy) number. This can be done > in the CPU-freq transition event handler. We subscribe to that event > in the MIPS arch time-inititalization method. > > Co-developed-by: Alexey Malahov > Signed-off-by: Alexey Malahov > Signed-off-by: Serge Semin > Reviewed-by: Jiaxun Yang > Cc: Thomas Bogendoerfer > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Arnd Bergmann > Cc: Rob Herring > Cc: devicetree@vger.kernel.org > Signed-off-by: Thomas Bogendoerfer > Signed-off-by: Sasha Levin > --- > arch/mips/kernel/time.c | 70 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 70 insertions(+) > > diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c > index bfe02ded25d1..1e631a484ddf 100644 > --- a/arch/mips/kernel/time.c > +++ b/arch/mips/kernel/time.c > @@ -22,12 +22,82 @@ > #include > #include > #include > +#include > +#include > > #include > #include > #include > #include > > +#ifdef CONFIG_CPU_FREQ > + > +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); > +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); > +static unsigned long glb_lpj_ref; > +static unsigned long glb_lpj_ref_freq; > + > +static int cpufreq_callback(struct notifier_block *nb, > + unsigned long val, void *data) > +{ > + struct cpufreq_freqs *freq = data; > + struct cpumask *cpus = freq->policy->cpus; ^^^^^^ The policy member has been added in kernel 5.2, so kernel 4.19.129 and later do not build anymore when CONFIG_CPU_FREQ=y. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net