From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Anand Moon <linux.amoon@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Linux PM list <linux-pm@vger.kernel.org>,
linux-samsung-soc@vger.kernel.org,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv2 1/6] thermal: exynos: Enable core tmu hardware clk flag on exynos platform
Date: Sat, 21 May 2022 16:15:53 +0200 [thread overview]
Message-ID: <6b35e16d-e08d-ebb1-9d3c-7e670e700bdf@linaro.org> (raw)
In-Reply-To: <CANAwSgT0Vmq4D9nRNc9h=xXxjmN_wXjbhwjj4btX+4SkXePkrw@mail.gmail.com>
On 21/05/2022 11:50, Anand Moon wrote:
> Hi Krzysztof,
>
> On Wed, 18 May 2022 at 12:55, Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 17/05/2022 20:42, Anand Moon wrote:
>>> Hi Krzysztof,
>>>
>>> On Sun, 15 May 2022 at 15:22, Krzysztof Kozlowski
>>> <krzysztof.kozlowski@linaro.org> wrote:
>>>>
>>>> On 15/05/2022 08:41, Anand Moon wrote:
>>>>> Use clk_prepare_enable api to enable tmu internal hardware clock
>>>>> flag on, use clk_disable_unprepare to disable the clock.
>>>>>
>>>>> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
>>>>
>>>> Here as well you ignored my first comment:
>>>> https://lore.kernel.org/lkml/CANAwSgS=08fVsqn95WHzSF71WTTyD2-=K2C6-BEz0tY0t6A1-g@mail.gmail.com/T/#mbfc57b40a7ed043dd4d4890bedb6bad8240058cd
>>>>
>>>> "This is not valid reason to do a change. What is clk_summary does not
>>>> really matter. Your change has negative impact on power consumption as
>>>> the clock stays enabled all the time. This is not what we want... so
>>>> please explain it more - why you need the clock to be enabled all the
>>>> time? What is broken (clk_summary is not broken in this case)?"
>>>>
>
> This was just to update my knowledge on what is missing in the driver.
>
>> I don't understand how all this is relevant to the Exynos TMU driver.
>> You paste some COMMON_CLK framework links, but this is just a framework.
>> It has nothing to do with Exynos TMU.
>>
>> Since we are making circles, let's make it clearer. Answer these simple
>> questions:
>> 1. Is Exynos TMU driver operating correctly or not correctly?
>
> Yes Exynos TMU clk is getting initialized, but not incorrect order.
> within the exynos tmu driver we call
> exynos_tmu_probe
> ---> clk_prepare
> exynos_tmu_initialize
> ---> clk_enable
> which is seem to work but it does not enable the clk in total.
Correct and this is done on purpose, to not have the clock enabled all
the time.
>
> But if we call *clk_prepare_enable* in exynos_tmu_probe we enable the
> clk correctly.
It was enabled correctly. clk_prepare followed by clk_enabled is correct
way.
>
> *Note:* This current patch is missing the clean-up in
> exynos_tmu_initialize function.
>
>>
>> 2. If incorrectly, how is the incorrectness visible?
>
> See before the change in Exynos 5422
> $ sudo cat /sys/kernel/debug/clk/clk_summary | grep tmu
> tmu_gpu 0 2 0 66600000
> 0 0 50000 N
> tmu 0 6 0 66600000
> 0 0 50000 N
>
> $ sudo cat /sys/kernel/debug/clk/clk_summary | grep tmu
> tmu_gpu 2 2 0 66600000
> 0 0 50000 Y
> tmu 6 6 0 66600000
> 0 0 50000 Y
>
> After the changes, the internal tmu clk internal hardware flag is set to 'Y'
> * hence I mention this in the commit message.*
>
> Before the patch
> # cat /sys/kernel/debug/clk/tmu/clk_enable_count
> 0
> # cat /sys/kernel/debug/clk/tmu_gpu/clk_enable_count
> 0
>
> After the patch
> # cat /sys/kernel/debug/clk/tmu/clk_enable_count
> 6
> # cat /sys/kernel/debug/clk/tmu_gpu/clk_enable_count
> 2
This proves your patch is incorrect, because you enabled clock for times
when it is not needed. Original code looks ok.
>
>> How can we trigger and see the issue?
>
> We can trigger or see the issue but enable clk trace feature,
> for example trace clk_enable, clk_prepare clk_enable_complete
>
> I don't know how to trace clk during clk initialization
> but I will try to find out more about this.
>
>>
>> 3. If it operates correctly, maybe it is operating in nonoptimal way?
>>
> Few new things we could set in this TMU driver which control the internal timing
>
> SAMPLING_INTERVAL - sample interval
> COUNTER_VALUE0 - Timing control of T_EN_TEMP_SEN on/off timing
> COUNTER_VALUE1 - Timing control of CLK_SENSE on/off timing
I don't understand this. Again, where is the non-optimal way?
>
>> 4. If it is not optimal, then what states are not optimal and when?
>
> We could drop the unnecessary clk_enable and clk_disable as we don't check
> the return value of the function and it just toggles the clock which
> does not look optimal.
No, you don't understand the clocks. Enabling and disabling the clock is
optimal.
>
> Since CLK_SENSE internally has a timer to on/off and control the PMU operations.
This could be better, what is this CLK_SENSE and which clocks are affected?
> Look at following functions we could drop this
> exynos_get_temp , exynos_tmu_control and exynos_tmu_set_emulation.
I don't understand this sentence. Why do you want to drop entire
functions? How is exynos_get_temp related to clocks?
Best regards,
Krzysztof
next prev parent reply other threads:[~2022-05-21 14:16 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-15 6:41 [PATCHv2 0/6] Exynos Thermal code inprovement Anand Moon
2022-05-15 6:41 ` [PATCHv2 1/6] thermal: exynos: Enable core tmu hardware clk flag on exynos platform Anand Moon
2022-05-15 9:39 ` Krzysztof Kozlowski
2022-05-15 9:52 ` Krzysztof Kozlowski
2022-05-17 18:42 ` Anand Moon
2022-05-18 7:25 ` Krzysztof Kozlowski
2022-05-21 9:50 ` Anand Moon
2022-05-21 14:15 ` Krzysztof Kozlowski [this message]
2022-05-15 6:41 ` [PATCHv2 2/6] thermal: exynos: Reorder the gpu clock initialization for exynos5420 SoC Anand Moon
2022-05-15 9:41 ` Krzysztof Kozlowski
2022-05-17 18:43 ` Anand Moon
2022-05-18 7:28 ` Krzysztof Kozlowski
2022-05-21 9:51 ` Anand Moon
2022-05-21 14:20 ` Krzysztof Kozlowski
2022-05-15 9:50 ` Krzysztof Kozlowski
2022-05-17 18:43 ` Anand Moon
2022-05-15 6:41 ` [PATCHv2 3/6] thermal: exynos: Check before clk_disable_unprepare() not needed Anand Moon
2022-05-15 9:43 ` Krzysztof Kozlowski
2022-05-17 18:44 ` Anand Moon
2022-05-15 6:41 ` [PATCHv2 4/6] thermal: exynos: fixed the efuse min/max value for exynos5422 Anand Moon
2022-05-15 9:45 ` Krzysztof Kozlowski
2022-05-16 10:42 ` kernel test robot
2022-05-16 10:44 ` Krzysztof Kozlowski
2022-05-17 18:44 ` Anand Moon
2022-05-15 6:41 ` [PATCHv2 5/6] thermal: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Anand Moon
2022-05-15 9:47 ` Krzysztof Kozlowski
2022-05-17 18:44 ` Anand Moon
2022-05-15 6:41 ` [PATCHv2 6/6] thermal: exynos: Add runtime power management for tmu Anand Moon
2022-05-15 9:48 ` Krzysztof Kozlowski
2022-05-17 18:45 ` Anand Moon
2022-05-18 7:19 ` Krzysztof Kozlowski
2022-05-21 9:52 ` Anand Moon
2022-05-21 14:11 ` Krzysztof Kozlowski
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=6b35e16d-e08d-ebb1-9d3c-7e670e700bdf@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=amitk@kernel.org \
--cc=bzolnier@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®