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: <CAEXTbpf+6n9KWRkQEbQVxsBjd65Rs0voH=JNHk5BaoE_55-yuw@mail.gmail.com>
Date:   Wed, 14 Dec 2022 11:30:30 +0800
From:   Pin-yen Lin <treapking@...omium.org>
To:     Andrzej Hajda <andrzej.hajda@...el.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Robert Foss <robert.foss@...aro.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        allen chen <allen.chen@....com.tw>
Subject: Re: [PATCH] drm/bridge: it6505: Guard bridge power in IRQ handler

Hi all,

Friendly ping on this patch.

Regards,
Pin-yen

On Wed, Nov 9, 2022 at 5:52 PM Pin-yen Lin <treapking@...omium.org> wrote:
>
> Add a pair of pm_runtime_get_if_in_use and pm_runtime_put_sync in the
> interrupt handler to make sure the bridge won't be powered off during
> the interrupt handlings. Also remove the irq_lock mutex because it's not
> guarding anything now.
>
> Fixes: ab28896f1a83 ("drm/bridge: it6505: Improve synchronization between extcon subsystem")
> Signed-off-by: Pin-yen Lin <treapking@...omium.org>
> ---
>
>  drivers/gpu/drm/bridge/ite-it6505.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 21a9b8422bda..e7f7d0ce1380 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -412,7 +412,6 @@ struct it6505 {
>          * Mutex protects extcon and interrupt functions from interfering
>          * each other.
>          */
> -       struct mutex irq_lock;
>         struct mutex extcon_lock;
>         struct mutex mode_lock; /* used to bridge_detect */
>         struct mutex aux_lock; /* used to aux data transfers */
> @@ -2494,10 +2493,8 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
>         };
>         int int_status[3], i;
>
> -       mutex_lock(&it6505->irq_lock);
> -
> -       if (it6505->enable_drv_hold || !it6505->powered)
> -               goto unlock;
> +       if (it6505->enable_drv_hold || pm_runtime_get_if_in_use(dev) <= 0)
> +               return IRQ_HANDLED;
>
>         int_status[0] = it6505_read(it6505, INT_STATUS_01);
>         int_status[1] = it6505_read(it6505, INT_STATUS_02);
> @@ -2515,16 +2512,14 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
>         if (it6505_test_bit(irq_vec[0].bit, (unsigned int *)int_status))
>                 irq_vec[0].handler(it6505);
>
> -       if (!it6505->hpd_state)
> -               goto unlock;
> -
> -       for (i = 1; i < ARRAY_SIZE(irq_vec); i++) {
> -               if (it6505_test_bit(irq_vec[i].bit, (unsigned int *)int_status))
> -                       irq_vec[i].handler(it6505);
> +       if (it6505->hpd_state) {
> +               for (i = 1; i < ARRAY_SIZE(irq_vec); i++) {
> +                       if (it6505_test_bit(irq_vec[i].bit, (unsigned int *)int_status))
> +                               irq_vec[i].handler(it6505);
> +               }
>         }
>
> -unlock:
> -       mutex_unlock(&it6505->irq_lock);
> +       pm_runtime_put_sync(dev);
>
>         return IRQ_HANDLED;
>  }
> @@ -3277,7 +3272,6 @@ static int it6505_i2c_probe(struct i2c_client *client,
>         if (!it6505)
>                 return -ENOMEM;
>
> -       mutex_init(&it6505->irq_lock);
>         mutex_init(&it6505->extcon_lock);
>         mutex_init(&it6505->mode_lock);
>         mutex_init(&it6505->aux_lock);
> --
> 2.38.1.431.g37b22c650d-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ