All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	ulf.hansson@linaro.org, "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>, Nishanth Menon <nm@ti.com>,
	nks@flawful.org, georgi.djakov@linaro.org,
	Stephan Gerhold <stephan@gerhold.net>,
	linux-kernel@vger.kernel.org,
	'Linux Samsung SOC' <linux-samsung-soc@vger.kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH V2 2/2] cpufreq: dt: Refactor initialization to handle probe deferral properly
Date: Tue, 1 Sep 2020 10:57:09 +0200	[thread overview]
Message-ID: <00a87bad-f750-b08c-4ccb-545b90dd87fc@samsung.com> (raw)
In-Reply-To: <f75c61f193f396608d592ae2a9938264d582c038.1598260050.git.viresh.kumar@linaro.org>

Hi Viresh

On 24.08.2020 11:09, Viresh Kumar wrote:
> From: Stephan Gerhold <stephan@gerhold.net>
>
> cpufreq-dt is currently unable to handle -EPROBE_DEFER properly
> because the error code is not propagated for the cpufreq_driver->init()
> callback. Instead, it attempts to avoid the situation by temporarily
> requesting all resources within resources_available() and releasing them
> again immediately after. This has several disadvantages:
>
>    - Whenever we add something like interconnect handling to the OPP core
>      we need to patch cpufreq-dt to request these resources early.
>
>    - resources_available() is only run for CPU0, but other clusters may
>      eventually depend on other resources that are not available yet.
>      (See FIXME comment removed by this commit...)
>
>    - All resources need to be looked up several times.
>
> Now that the OPP core can propagate -EPROBE_DEFER during initialization,
> it would be nice to avoid all that trouble and just propagate its error
> code when necessary.
>
> This commit refactors the cpufreq-dt driver to initialize private_data
> before registering the cpufreq driver. We do this by iterating over
> all possible CPUs and ensure that all resources are initialized:
>
>    1. dev_pm_opp_get_opp_table() ensures the OPP table is allocated
>       and initialized with clock and interconnects.
>
>    2. dev_pm_opp_set_regulators() requests the regulators and assigns
>       them to the OPP table.
>
>    3. We call dev_pm_opp_of_get_sharing_cpus() early so that we only
>       initialize the OPP table once for each shared policy.
>
> With these changes, we actually end up saving a few lines of code,
> the resources are no longer looked up multiple times and everything
> should be much more robust.
>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> [ Viresh: Use list_head structure for maintaining the list and minor
> 	  changes ]
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

This patch landed in linux-next about a week ago. It introduces a 
following warning on Samsung Exnyos3250 SoC:

cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
1000000000, volt: 1150000, enabled: 1. New: freq: 1000000000, volt: 
1150000, enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
900000000, volt: 1112500, enabled: 1. New: freq: 900000000, volt: 
1112500, enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
800000000, volt: 1075000, enabled: 1. New: freq: 800000000, volt: 
1075000, enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
700000000, volt: 1037500, enabled: 1. New: freq: 700000000, volt: 
1037500, enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
600000000, volt: 1000000, enabled: 1. New: freq: 600000000, volt: 
1000000, enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
500000000, volt: 962500, enabled: 1. New: freq: 500000000, volt: 962500, 
enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
400000000, volt: 925000, enabled: 1. New: freq: 400000000, volt: 925000, 
enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
300000000, volt: 887500, enabled: 1. New: freq: 300000000, volt: 887500, 
enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
200000000, volt: 850000, enabled: 1. New: freq: 200000000, volt: 850000, 
enabled: 1
cpu cpu1: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 
100000000, volt: 850000, enabled: 1. New: freq: 100000000, volt: 850000, 
enabled: 1

I've checked a bit and this is related to the fact that Exynos3250 SoC 
use OPP-v1 table. Is this intentional? It is not a problem to convert it 
to OPP-v2 and mark OPP table as shared, but this is a kind of a regression.

> ...

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  parent reply	other threads:[~2020-09-01  8:57 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  9:09 [PATCH V2 1/2] opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER Viresh Kumar
2020-08-24  9:09 ` Viresh Kumar
2020-08-24  9:09 ` [PATCH V2 2/2] cpufreq: dt: Refactor initialization to handle probe deferral properly Viresh Kumar
2020-08-24 14:25   ` kernel test robot
2020-08-24 14:25   ` [PATCH] cpufreq: dt: fix semicolon.cocci warnings kernel test robot
2020-08-25  4:29     ` Viresh Kumar
     [not found]   ` <CGME20200901085708eucas1p231ccacd7b41685ece92ee21e3b726f28@eucas1p2.samsung.com>
2020-09-01  8:57     ` Marek Szyprowski [this message]
2020-09-01  9:45       ` [PATCH V2 2/2] cpufreq: dt: Refactor initialization to handle probe deferral properly Viresh Kumar
2020-09-01 10:05         ` Marek Szyprowski
2020-09-01 10:12           ` Viresh Kumar
2020-10-13  9:47   ` Geert Uytterhoeven
2020-10-13  9:56     ` Viresh Kumar
2020-10-14 16:40       ` Geert Uytterhoeven
2020-10-16  5:03         ` Viresh Kumar
2020-10-16  6:44           ` Geert Uytterhoeven
2020-10-16  8:07             ` Viresh Kumar
2020-10-27 16:29               ` Geert Uytterhoeven
2020-10-28  5:48                 ` Viresh Kumar
2020-10-28  9:49                   ` Geert Uytterhoeven
2020-10-28  9:52                     ` Viresh Kumar
2020-08-24  9:17 ` [PATCH V2 1/2] opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER Krzysztof Kozlowski
2020-08-24  9:17   ` Krzysztof Kozlowski
2020-08-24 11:08 ` Ulf Hansson
2020-08-24 11:08   ` Ulf Hansson
2020-08-24 11:39 ` Stephan Gerhold
2020-08-24 11:39   ` Stephan Gerhold
2020-10-15 18:05 ` Sudeep Holla
2020-10-15 18:05   ` Sudeep Holla
2020-10-16  4:24   ` Viresh Kumar
2020-10-16  4:24     ` Viresh Kumar
2020-10-16  6:00     ` Sudeep Holla
2020-10-16  6:00       ` Sudeep Holla
2020-10-16 11:12       ` Sudeep Holla
2020-10-16 11:12         ` Sudeep Holla
2020-10-16 15:28         ` Stephan Gerhold
2020-10-16 15:28           ` Stephan Gerhold
2020-10-19  4:58         ` Viresh Kumar
2020-10-19  4:58           ` Viresh Kumar
2020-10-19  9:17           ` Sudeep Holla
2020-10-19  9:17             ` Sudeep Holla
2020-10-19  9:24             ` Viresh Kumar
2020-10-19  9:24               ` Viresh Kumar
2020-10-19 10:12               ` Sudeep Holla
2020-10-19 10:12                 ` Sudeep Holla
2020-10-19 10:35                 ` Viresh Kumar
2020-10-19 10:35                   ` Viresh Kumar
2020-10-19 14:10                   ` Sudeep Holla
2020-10-19 14:10                     ` Sudeep Holla
2020-10-20  5:05                     ` Viresh Kumar
2020-10-20  5:05                       ` Viresh Kumar
2020-10-20  5:54                       ` Viresh Kumar
2020-10-20  5:54                         ` Viresh Kumar
2020-10-20  9:37                         ` Sudeep Holla
2020-10-20  9:37                           ` Sudeep Holla
2020-10-20  9:41                           ` Viresh Kumar
2020-10-20  9:41                             ` Viresh Kumar
2020-10-20  9:52                             ` Sudeep Holla
2020-10-20  9:52                               ` Sudeep Holla
2020-10-20  9:59                               ` Viresh Kumar
2020-10-20  9:59                                 ` Viresh Kumar
2020-10-27 22:24 ` Guenter Roeck
2020-10-27 22:24   ` Guenter Roeck
2020-10-28  4:06   ` Viresh Kumar
2020-10-28  4:06     ` Viresh Kumar
2020-10-28 17:29     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00a87bad-f750-b08c-4ccb-545b90dd87fc@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=broonie@kernel.org \
    --cc=georgi.djakov@linaro.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=nks@flawful.org \
    --cc=nm@ti.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.org \
    --cc=stephan@gerhold.net \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.