[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0f21198-5715-8858-8368-51e43092181e@canonical.com>
Date: Sat, 9 Mar 2019 16:37:33 +0800
From: Aaron Ma <aaron.ma@...onical.com>
To: Christopher Heiny <Cheiny@...aptics.com>,
"dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>,
"linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Duggan <aduggan@...aptics.com>,
"benjamin.tissoires@...hat.com" <benjamin.tissoires@...hat.com>
Subject: Re: [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs
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
Powered by blists - more mailing lists