[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180911120258.GC19234@hirez.programming.kicks-ass.net>
Date: Tue, 11 Sep 2018 14:02:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Dmitry Safonov <dima@...sta.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Daniel Axtens <dja@...ens.net>,
Dmitry Vyukov <dvyukov@...gle.com>,
Michael Neuling <mikey@...ling.org>,
Mikulas Patocka <mpatocka@...hat.com>,
Nathan March <nathan@...net>,
Pasi Kärkkäinen <pasik@....fi>,
Peter Hurley <peter@...leysoftware.com>,
"Rong, Chen" <rong.a.chen@...el.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Tan Xiaojun <tanxiaojun@...wei.com>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>
Subject: Re: [PATCHv3 6/6] tty/ldsem: Decrement wait_readers on timeouted
down_read()
On Tue, Sep 11, 2018 at 02:48:21AM +0100, Dmitry Safonov wrote:
> It seems like when ldsem_down_read() fails with timeout, it misses
> update for sem->wait_readers. By that reason, when writer finally
> releases write end of the semaphore __ldsem_wake_readers() does adjust
> sem->count with wrong value:
> sem->wait_readers * (LDSEM_ACTIVE_BIAS - LDSEM_WAIT_BIAS)
>
> I.e, if update comes with 1 missed wait_readers decrement, sem->count
> will be 0x100000001 which means that there is active reader and it'll
> make any further writer to fail in acquiring the semaphore.
>
> It looks like, this is a dead-code, because ldsem_down_read() is never
> called with timeout different than MAX_SCHEDULE_TIMEOUT, so it might be
> worth to delete timeout parameter and error path fall-back..
You might want to think about ditching that ldsem thing entirely, and
use a regular rwsem ?
Powered by blists - more mailing lists