linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org, Daniel Ribeiro <drwyrm@gmail.com>,
	Ilya Petrov <ilya.muromec@gmail.com>,
	Antonio Ospite <ospite@studenti.unina.it>
Subject: Re: [PATCH] input: pcap2: avoid calling mutex_lock() in irq handler
Date: Sun, 6 Apr 2014 13:24:36 -0700	[thread overview]
Message-ID: <20140406202436.GA16739@core.coreip.homeip.net> (raw)
In-Reply-To: <1396731290-7062-1-git-send-email-khoroshilov@ispras.ru>

On Sun, Apr 06, 2014 at 12:54:50AM +0400, Alexey Khoroshilov wrote:
> pcap_keys_handler() calls ezx_pcap_read() that calls mutex_lock().
> pcap_keys_handler() is registered as nonthreaded irq handler,
> that means sleeping function is called in irq handler.
> 
> The patch makes a switch to threaded irq handling.
> Compile tested only.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/input/misc/pcap_keys.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c
> index cd230365166e..2a10f3a30969 100644
> --- a/drivers/input/misc/pcap_keys.c
> +++ b/drivers/input/misc/pcap_keys.c
> @@ -79,13 +79,15 @@ static int pcap_keys_probe(struct platform_device *pdev)
>  	if (err)
>  		goto fail_allocate;
>  
> -	err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF),
> -			pcap_keys_handler, 0, "Power key", pcap_keys);
> +	err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF),
> +				   NULL, pcap_keys_handler, 0,
> +				   "Power key", pcap_keys);
>  	if (err)
>  		goto fail_register;
>  
> -	err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC),
> -			pcap_keys_handler, 0, "Headphone button", pcap_keys);
> +	err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC),
> +				   NULL, pcap_keys_handler, 0,
> +				   "Headphone button", pcap_keys);

So I guess we do need threaded IRQ here, but I do not see the pcap's
irqchip specifying IRQCHIP_ONESHOT_SAFE so I do not think
request_threaded_irq() without IRQF_ONESHOT would succeed.

Can someone test the change to be sure?

Thanks!

-- 
Dmitry

  reply	other threads:[~2014-04-06 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-05 20:54 [PATCH] input: pcap2: avoid calling mutex_lock() in irq handler Alexey Khoroshilov
2014-04-06 20:24 ` Dmitry Torokhov [this message]
2014-04-06 21:37   ` Antonio Ospite
2014-05-13  2:14     ` Dmitry Torokhov
2014-05-13  8:13       ` Antonio Ospite
2014-05-21  9:17   ` Antonio Ospite

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=20140406202436.GA16739@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=drwyrm@gmail.com \
    --cc=ilya.muromec@gmail.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ospite@studenti.unina.it \
    /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).