All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Ma <aaron.ma@canonical.com>
To: Christopher Heiny <Cheiny@synaptics.com>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Duggan <aduggan@synaptics.com>,
	"benjamin.tissoires@redhat.com" <benjamin.tissoires@redhat.com>
Subject: Re: [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs
Date: Sat, 9 Mar 2019 16:37:33 +0800	[thread overview]
Message-ID: <a0f21198-5715-8858-8368-51e43092181e@canonical.com> (raw)
In-Reply-To: <17cd420ea32a9787c56ba25e36e7661541c2f65f.camel@synaptics.com>

Hi,

On 3/9/19 7:13 AM, Christopher Heiny wrote:
> I'm not sure this is a safe action, due to a race condition with the
> actual IRQ handler (rmi_process_interrupt_requests from rmi_driver.c). 
> Remember that reading the IRQ status register clears all the IRQ bits. 
> So you're faced with this possible scenario:
>     - ATTN asserted, indicating new data in IRQ status register
>     - rmi_driver_set_irq_bits called
>     - rmi_driver_set_irq_bits reads IRQ status, clearing bits
>     - rmi_process_interrupt_requests called
>     - rmi_process_interrupt_request reads IRQ status, sees no
>       bits set, nested IRQs are not handled
> This could lead to loss of data or inconsistent system state
> information.  For example, a button up or down event may be lost, with
> consequent weird behavior by the user interface.

rmi_driver_set_irq_bits is only called to config and enable specific
functions of RMI.
Reading IRQ status before set irqs is supposed to clear spam data/irq
status.
spam data make probe/detect touchpad/trackpoint fail.

rmi_smb_resume -> rmi_driver_reset_handler -> fn-config ->
clear_irq_bits -> set_irq_bits -> enable_irq -> irq_handler  ->
rmi_process_interrupt_requests

set_irq_bits will not be in interrupt context, it enables IRQ bits of RMI.

Regards,
Aaron

  reply	other threads:[~2019-03-09  8:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 16:41 [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs Aaron Ma
2019-02-20 16:42 ` [PATCH 2/2] Input: synaptics-rmi4 - export nosleep of f01 via sysfs Aaron Ma
2019-06-09 16:53   ` Dmitry Torokhov
2019-03-08 23:13 ` [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs Christopher Heiny
2019-03-09  8:37   ` Aaron Ma [this message]
2019-03-28  6:02     ` Aaron Ma
2019-04-02 16:16       ` Christopher Heiny
2019-04-03 13:58         ` Aaron Ma
2019-06-04  2:45           ` Aaron Ma
2019-06-04  5:19             ` Christopher Heiny
2019-06-07  7:48               ` Aaron Ma
2019-06-09 16:55 ` Dmitry Torokhov
2019-06-10 16:55   ` Aaron Ma
2019-06-11 17:35     ` Dmitry Torokhov
2019-06-14  4:26       ` Aaron Ma
2019-11-19  5:34         ` Kai-Heng Feng

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=a0f21198-5715-8858-8368-51e43092181e@canonical.com \
    --to=aaron.ma@canonical.com \
    --cc=Cheiny@synaptics.com \
    --cc=aduggan@synaptics.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.