linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Terry Lambert <tlambert@chromium.org>
Cc: Henrik Rydberg <rydberg@euromail.se>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: fixed EVIOCGRAB iterative grab/release.
Date: Fri, 11 Feb 2011 10:32:46 -0800	[thread overview]
Message-ID: <20110211183246.GA31385@core.coreip.homeip.net> (raw)
In-Reply-To: <AANLkTikM3G5+KYXGe4hBL7LHg1-W0-dgN7jOGA2fbLvZ@mail.gmail.com>

Hi Terry,

On Fri, Feb 11, 2011 at 09:55:53AM -0800, Terry Lambert wrote:
> Hi Henrik,
> 

First of all, please do not top-post.

> I'm in the middle of cutting down my failure case right now, so I
> should be able to provide a stand-alone test case shortly.  This is my
> top priority at work right now.
> 
> And you are correct about the race.  This is about back-to-back
> operations of a tool in a script, on a relatively slow machine with
> obstinate hardware, and a grabby Xorg driver (it's the closed source
> one, so I can't make it non-grabby).  So technically a stress test.
> 
> You noted the evdev->mutex; the idempotence of the call for the two
> pointer clears will be preserved by the mutex, so no one is going to
> get in under it while it's grabbed in the evdev_* layer, and not
> grabbed in the input_*_device layer, and get unhappy.
> 
> So at worst it's a no-op change that scratches my particularly weird itch here.

No, it is either a real problem that can happen with any hardware and
userspace or it is not, and it does not matter if userspace portion is
open or close source, it should work the same.

Before I can apply the patch I need to understand exactly:

1. How the problem is triggered (on the level "CPU1 enters particular
section of the code and then event A happens that causes CPU2 to do
something and then we are in trouble")

2. How the proposed change helps to avoid the sequence of events in 1.

> 
> PS: I supposed this use of the mutex is worthy of a comment in the
> code?  Any guidance?

If it helps people to understand the code - by all means. However you
need to realize that almost every operation within the kernel is
protected by some lock or mutex...

Thanks.

-- 
Dmitry

      reply	other threads:[~2011-02-11 18:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 23:42 [PATCH] Input: fixed EVIOCGRAB iterative grab/release tlambert
2011-02-10 23:54 ` Dmitry Torokhov
2011-02-11  0:41   ` Terry Lambert
2011-02-11  1:21     ` Dmitry Torokhov
2011-02-11 10:04 ` Henrik Rydberg
2011-02-11 17:55   ` Terry Lambert
2011-02-11 18:32     ` Dmitry Torokhov [this message]

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=20110211183246.GA31385@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rydberg@euromail.se \
    --cc=tlambert@chromium.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).