public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* ACPI: EC: Clear GPE on interrupt handling only
@ 2023-05-16  0:02 Compostella, Jeremy
  2023-06-05 16:14 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Compostella, Jeremy @ 2023-05-16  0:02 UTC (permalink / raw)
  To: linux-acpi

On multiple devices I work on, we noticed that
/sys/firmware/acpi/interrupts/sci_not is non-zero and keeps increasing
over time.

It turns out that there is a race condition between servicing a GPE
interrupt and handling task driven transactions.

If a GPE interrupt is received at the same time ec_poll() is running,
the advance_transaction() clears the GPE flag and the interrupt is not
serviced as acpi_ev_detect_gpe() relies on the GPE flag to call the
handler. As a result, `sci_not' is increased.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
---
 drivers/acpi/ec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 928899ab9502..42af09732238 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -674,7 +674,7 @@ static void advance_transaction(struct acpi_ec *ec, bool interrupt)
 	 * 2. As long as software can ensure only clearing it when it is set,
 	 *    hardware won't set it in parallel.
 	 */
-	if (ec->gpe >= 0 && acpi_ec_gpe_status_set(ec))
+	if (interrupt && ec->gpe >= 0 && acpi_ec_gpe_status_set(ec))
 		acpi_clear_gpe(NULL, ec->gpe);
 
 	status = acpi_ec_read_status(ec);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-06 14:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16  0:02 ACPI: EC: Clear GPE on interrupt handling only Compostella, Jeremy
2023-06-05 16:14 ` Rafael J. Wysocki
2023-06-05 16:26   ` Rafael J. Wysocki
2023-06-05 22:26     ` Compostella, Jeremy
2023-06-06 14:24       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox