lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <629b6666-74b3-91f0-5c6c-e26d55ea62d8@foss.st.com>
Date:   Tue, 17 Aug 2021 11:43:13 +0200
From:   Raphael Gallais-Pou <raphael.gallais-pou@...s.st.com>
To:     Marek Vasut <marex@...x.de>
CC:     Yannick FERTRE <yannick.fertre@...com>,
        Philippe CORNU <philippe.cornu@...com>,
        Raphael GALLAIS-POU <raphael.gallais-pou@...com>,
        Yannick FERTRE - foss <yannick.fertre@...s.st.com>,
        Philippe CORNU - foss <philippe.cornu@...s.st.com>,
        Benjamin Gaignard <benjamin.gaignard@...aro.org>,
        David Airlie <airlied@...ux.ie>,
        "Daniel Vetter" <daniel@...ll.ch>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre TORGUE - foss <alexandre.torgue@...s.st.com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-stm32@...md-mailman.stormreply.com" 
        <linux-stm32@...md-mailman.stormreply.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Stephen Boyd <swboyd@...omium.org>
Subject: Re: [PATCH] drm/stm: ltdc: improve pm_runtime to stop clocks


On 7/2/21 8:07 PM, Marek Vasut wrote:
> On 7/2/21 11:23 AM, Raphael Gallais-Pou wrote:
>> Hello Marek,
>
> Hi,
>
>> Sorry for the late answer.
>
> No worries, take your time
>
>> On 6/30/21 2:35 AM, Marek Vasut wrote:
>>> On 6/29/21 1:58 PM, Raphael GALLAIS-POU - foss wrote:
>>>
>>> [...]
>>>
>>>> +++ b/drivers/gpu/drm/stm/ltdc.c
>>>> @@ -425,10 +425,17 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
>>>>   {
>>>>       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
>>>>       struct drm_device *ddev = crtc->dev;
>>>> +    int ret;
>>>>         DRM_DEBUG_DRIVER("\n");
>>>>   -    pm_runtime_get_sync(ddev->dev);
>>>> +    if (!pm_runtime_active(ddev->dev)) {
>>>> +        ret = pm_runtime_get_sync(ddev->dev);
>>>
>>> All these if (!pm_runtime_active()) then pm_runtime_get_sync() calls look like workaround for some larger issue. Shouldn't the pm_runtime do some refcounting on its own , so this shouldn't be needed ?
>>
>>
>> This problem purely comes from the driver internals, so I don't think it is a workaround.
>>
>> Because of the "ltdc_crtc_mode_set_nofb" function which does not have any "symmetrical" call, such as enable/disable functions, there was two calls to pm_runtime_get_sync against one call to pm_runtime_put_sync.
>>
>> This instability resulted in the LTDC clocks being always enabled, even when the peripheral was disabled. This could be seen in the clk_summary as explained in the patch summary among other things.
>>
>> By doing so, we first check if the clocks are not already activated, and in that case we call pm_runtime_get_sync.
>
> I just have to wonder, how come other drivers don't need these if (!pm_runtime_active()) pm_runtime_get_sync() conditions. I think they just get/put the runtime PM within a call itself, not across function calls. Maybe that could be the right fix here too ?


Hello Marek,


I've run a deeper analysis over this implementation.

If I may take rockchip's "rockchip_drm_vop.c" driver, there is an boolean "is_enabled" set to true when crtc_atomic_enable is called.

The above implementation could save us from adding such field in the ltdc_dev structure.

Another solution could be in order to simply call pm_runtime_get_sync() in ltdc_crtc_mode_set_nofb() and by removing this condition in ltdc_atomic_crtc_disable() the driver behaves just like the first version of this patch.

In this way, it avoids such conditions and seems more to get along with the current implementation.


Regards,

Raphaël

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ