linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: tsc2005: fix locking issue
Date: Tue, 22 Mar 2011 08:42:02 -0700	[thread overview]
Message-ID: <20110322154202.GA24772@core.coreip.homeip.net> (raw)
In-Reply-To: <alpine.DEB.1.10.1103221655370.2634@esdhcp041196.research.nokia.com>

On Tue, Mar 22, 2011 at 04:59:02PM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Mon, 21 Mar 2011, Dmitry Torokhov wrote:
> >On Mon, Mar 21, 2011 at 06:24:10PM +0200, Aaro Koskinen wrote:
> >>Commit 0b950d3 (Input: tsc2005 - add open/close) introduced a
> >>locking issue with the ESD watchdog: __tsc2005_disable() is calling
> >>cancel_delayed_work_sync() with mutex held, and the work also needs the
> >>same mutex.
> >>
> >>Fix the problem by using cancel_delayed_work() on disable. If
> >>the ESD work was running it will check if the device is closed
> >>or suspended, and in that case it will do nothing and skip
> >>re-arming. cancel_delayed_work_sync() is still needed when the module
> >>is removed.
> >
> >Hmm, indeed. However, instead of moving cancel_delayed_work_sync() to
> >remove maybe we should use mutex_trylock() in tsc2005_esd_work()?
> >If trylock fails that means that device is in the middle of open/close
> >transition. We should just reschedule the work and get out of there.
> 
> But I guess the reschedule should not happen if we are in the middle of
> close/disable? And without the mutex we cannot know that.

It should be OK to reschedule even as we enabling/disabling because
cancel_delayed_work_sync() handles re-arming works so even if ESD work
is being executed at the time we closing the device it will be killed
off completely.

Thanks.

-- 
Dmitry

  reply	other threads:[~2011-03-22 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21 16:24 [PATCH] input: tsc2005: fix locking issue Aaro Koskinen
2011-03-22  6:19 ` Dmitry Torokhov
2011-03-22 14:59   ` Aaro Koskinen
2011-03-22 15:42     ` Dmitry Torokhov [this message]
2011-03-23 13:05       ` Aaro Koskinen

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=20110322154202.GA24772@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=aaro.koskinen@nokia.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).