[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMo8BfKneeVQrQOLG_v1AGupfSiXx=C34pHjP-nFV38eUGUwDQ@mail.gmail.com>
Date: Thu, 7 Apr 2022 15:08:12 -0700
From: Max Filippov <jcmvbkbc@...il.com>
To: Duoming Zhou <duoming@....edu.cn>
Cc: LKML <linux-kernel@...r.kernel.org>,
"open list:TENSILICA XTENSA PORT (xtensa)"
<linux-xtensa@...ux-xtensa.org>, Jiri Slaby <jirislaby@...nel.org>,
alexander.deucher@....com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"David S. Miller" <davem@...emloft.net>,
Chris Zankel <chris@...kel.net>, s.shtylyov@....ru
Subject: Re: [PATCH V2 11/11] arch: xtensa: platforms: Fix deadlock in rs_close()
On Thu, Apr 7, 2022 at 8:44 AM Duoming Zhou <duoming@....edu.cn> wrote:
>
> There is a deadlock in rs_close(), which is shown
> below:
>
> (Thread 1) | (Thread 2)
> | rs_open()
> rs_close() | mod_timer()
> spin_lock_bh() //(1) | (wait a time)
> ... | rs_poll()
> del_timer_sync() | spin_lock() //(2)
> (wait timer to stop) | ...
>
> We hold timer_lock in position (1) of thread 1 and
> use del_timer_sync() to wait timer to stop, but timer handler
> also need timer_lock in position (2) of thread 2.
> As a result, rs_close() will block forever.
>
> This patch deletes the redundant timer_lock in order to
> prevent the deadlock. Because there is no race condition
> between rs_close, rs_open and rs_poll.
>
> Signed-off-by: Duoming Zhou <duoming@....edu.cn>
> ---
> Changes in V2:
> - Remove the timer_lock.
>
> arch/xtensa/platforms/iss/console.c | 8 --------
> 1 file changed, 8 deletions(-)
Thanks. Applied to my xtensa tree.
-- Max
Powered by blists - more mailing lists