Skip to contentSkip to conversation

Regression between rc2 and rc6: ACPI EC problems

RFC PATCH Superseded Wolfram Sang 3 participants 13 messages Jul 6, 2016 – Jul 8, 2016 ACPI

lore
Share & tools
lore
#0 lore raw

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between the boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62
ACPI : EC: EC started

The only config changes between the kernels were enabling MMC block devices and DM_CRYPT. Not likely to cause the above, I'd think.

Does that ring a bell for someone? This little machine has only an SSD without TRIM, so bisecting is not really an option. I can provide more info and test patches, though.

Thanks,

Wolfram

#1 lore raw
Quoted 16 lines · Wolfram Sang

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between the boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62
ACPI : EC: EC started

Quoted 6 lines

The only config changes between the kernels were enabling MMC block devices and DM_CRYPT. Not likely to cause the above, I'd think.

Does that ring a bell for someone? This little machine has only an SSD without TRIM, so bisecting is not really an option. I can provide more info and test patches, though.

There is one commit related directly to EC between -rc2 and -rc6:

dcf15cbded65 ACPI / EC: Fix a boot EC regresion by restoring boot EC support for the DSDT EC

There also are two ACPICA commits in that frame that may be related to it

2f38b1b16d92 ACPICA: Namespace: Fix deadlock triggered by MLC support in dynamic table loading da4e792550a8 Revert "ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support for acpi_hw_write()"

but one of them is a revert, so can you please check dcf15cbded65 and 2f38b1b16d92?

Thanks,
Rafael

#2 lore raw

Hi, Rafael

Quoted 17 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, July 7, 2016 5:29 AM
Subject: Re: Regression between rc2 and rc6: ACPI EC problems

Quoted 4 lines · Wolfram Sang

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between

the

Quoted 4 lines

boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 10 lines
Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 2 lines

ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62 ACPI : EC: EC started

[Lv Zheng]
This is a known order issue that ACPICA executes _REG(DISCONENCT) after removing the opregion handler. But this issue is not a function failure, it only generates error garbage in the kernel log. So we didn't fix it in a hurry.

There is another order issue detected in the same Bugzilla entry that:
_REG(CONNECT/DISCONNECT) shouldn't be invoked for SystemMemory/SystemIo and PCI_Config that under a PCI root bus containing _BBN method. Which is also proven by the Windows behavior and spec definitions.

I was planning to fix the both issues in the ACPICA upstream. The bug is here for your reference:
https://bugzilla.kernel.org/show_bug.cgi?id=102421

For now, since this is just a non-function-failure error report, we can ignore it.
Because sometimes, when there are several problems related, we have to make a choice to fix one of them first.

Thanks and best regards
-Lv

Quoted 25 lines
Quoted 7 lines

The only config changes between the kernels were enabling MMC block devices and DM_CRYPT. Not likely to cause the above, I'd think.

Does that ring a bell for someone? This little machine has only an SSD without TRIM, so bisecting is not really an option. I can provide more info and test patches, though.

There is one commit related directly to EC between -rc2 and -rc6:

dcf15cbded65 ACPI / EC: Fix a boot EC regresion by restoring boot EC support for the DSDT EC

There also are two ACPICA commits in that frame that may be related to it

2f38b1b16d92 ACPICA: Namespace: Fix deadlock triggered by MLC support in dynamic table loading
da4e792550a8 Revert "ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support for acpi_hw_write()"

but one of them is a revert, so can you please check dcf15cbded65 and 2f38b1b16d92?

Thanks,
Rafael

#5 lore raw
In reply to Wolfram Sang

Hi, Wolfram

Quoted 26 lines

From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Wolfram Sang
Subject: Regression between rc2 and rc6: ACPI EC problems

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between the boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62 ACPI : EC: EC started

Quoted 6 lines

The only config changes between the kernels were enabling MMC block devices and DM_CRYPT. Not likely to cause the above, I'd think.

Does that ring a bell for someone? This little machine has only an SSD without TRIM, so bisecting is not really an option. I can provide more info and test patches, though.

[Lv Zheng]
Please just ignore this for several release cycles. We need strategy to fix the ACPI initialization order issues. This is already a noted non-function-failure issue. We just need to fix the functional ones prior than this.

Thanks and best regards
-Lv

#6 lore raw
In reply to Wolfram Sang

Hi, Walfram

You can register onto the kernel Bugzilla and monitor this bug for further updates:
https://bugzilla.kernel.org/show_bug.cgi?id=102421

Thanks and best regards
-Lv

Quoted 36 lines

From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Wolfram Sang
Subject: Regression between rc2 and rc6: ACPI EC problems

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between the boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20160422/evregion-300)
ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG] (Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542) ACPI Exception: AE_BAD_PARAMETER, from region _REG, [EmbeddedControl] (20160422/evregion-397)
ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62 ACPI : EC: EC started

The only config changes between the kernels were enabling MMC block devices and DM_CRYPT. Not likely to cause the above, I'd think.

Does that ring a bell for someone? This little machine has only an SSD without TRIM, so bisecting is not really an option. I can provide more info and test patches, though.

Thanks,

Wolfram

#3 lore raw
In reply to Zheng, Lv
Quoted 38 lines · Lv

Hi, Rafael

Quoted 17 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, July 7, 2016 5:29 AM
Subject: Re: Regression between rc2 and rc6: ACPI EC problems

Quoted 4 lines · Wolfram Sang

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change between

the

Quoted 4 lines

boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 10 lines
Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 2 lines

ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62 ACPI : EC: EC started

[Lv Zheng]
This is a known order issue that ACPICA executes _REG(DISCONENCT) after removing the opregion handler. But this issue is not a function failure, it only generates error garbage in the kernel log. So we didn't fix it in a hurry.

There is another order issue detected in the same Bugzilla entry that:
_REG(CONNECT/DISCONNECT) shouldn't be invoked for SystemMemory/SystemIo and PCI_Config that under a PCI root bus containing _BBN method. Which is also proven by the Windows behavior and spec definitions.

Quoted 6 lines

I was planning to fix the both issues in the ACPICA upstream. The bug is here for your reference:
https://bugzilla.kernel.org/show_bug.cgi?id=102421

For now, since this is just a non-function-failure error report, we can ignore it.
Because sometimes, when there are several problems related, we have to make a choice to fix one of them first.

Well, please look at the report again. It says:

"when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus".

So, it very much *is* a functional issue and I'm not going to ignore it.

Thanks,
Rafael

#4 lore raw

Hi, Rafael

Quoted 55 lines

From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Rafael J. Wysocki
Subject: Re: Regression between rc2 and rc6: ACPI EC problems

Quoted 11 lines · Lv

Hi, Rafael

Quoted 9 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, July 7, 2016 5:29 AM
Subject: Re: Regression between rc2 and rc6: ACPI EC problems

Quoted 4 lines · Wolfram Sang

Hi,

when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus. Here is the major change

between

Quoted 12 lines
Quoted 12 lines

the

Quoted 4 lines

boot logs:

ACPI : EC: EC stopped
ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, Returned by Handler for

[EmbeddedControl] (20160422/evregion-300)

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.EC0._REG]

(Node f5d09870), AE_BAD_PARAMETER (20160422/psparse-542)

Quoted 1 line

ACPI Exception: AE_BAD_PARAMETER, from region _REG,

[EmbeddedControl] (20160422/evregion-397)

Quoted 2 lines

ACPI : EC: GPE = 0x19, I/O: command/status = 0x66, data = 0x62 ACPI : EC: EC started

[Lv Zheng]
This is a known order issue that ACPICA executes _REG(DISCONENCT)

after removing the opregion handler.

Quoted 1 line

But this issue is not a function failure, it only generates error garbage in

the kernel log.

Quoted 4 lines

So we didn't fix it in a hurry.

There is another order issue detected in the same Bugzilla entry that:
_REG(CONNECT/DISCONNECT) shouldn't be invoked for

SystemMemory/SystemIo and PCI_Config that under a PCI root bus containing _BBN method.

Quoted 7 lines

Which is also proven by the Windows behavior and spec definitions.

I was planning to fix the both issues in the ACPICA upstream. The bug is here for your reference:
https://bugzilla.kernel.org/show_bug.cgi?id=102421

For now, since this is just a non-function-failure error report, we can

ignore it.

Quoted 1 line

Because sometimes, when there are several problems related, we have

Quoted 8 lines

to make a choice to fix one of them first.

Well, please look at the report again. It says:

"when upgrading from v4.7-rc2 to rc6 on my Dell Mini 9, battery and temperature status info got bogus".

So, it very much *is* a functional issue and I'm not going to ignore it.

[Lv Zheng]
What does the bogus mean here?
Anyway, I'll post a fix for this first.
I'll do this right now.

Thanks and best regards
-Lv

#7 lore raw

RFC PATCH 1/1 ACPI / EC: Fix an order issue in ec_remove_handlers()

In reply to Wolfram Sang

There is an order issue in ec_remove_handlers() that the functions invoked in it are not invoked in the reversed order of their appearance in ec_install_handlers(). This existing issue has been triggered by the following commit:
Commit: dcf15cbded656a12335bc4151f3f75f10080a375
Subject: ACPI / EC: Fix a boot EC regresion by restoring boot EC
The commit invokes ec_remove_handlers() during runtime, thus uncovers this issue. This patch fixes this regression.

Fixes dcf15cbded65 ("ACPI / EC: Fix a boot EC regresion by restoring boot EC")
Cc Wolfram Sang <[email protected]>
Cc Nicholas <[email protected]>
---
 drivers/acpi/ec.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/acpi/ec.c +7 -7
index b1050a0..9ff3d4b 100644
@@ -1331,7 +1331,12 @@ static int ec_install_handlers(struct acpi_ec *ec)
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
-	acpi_ec_stop(ec, false);
+	if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
+		if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
+					&acpi_ec_gpe_handler)))
+			pr_err("failed to remove gpe handler\n");
+		clear_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags);
+	}
 
 	if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
@@ -1340,12 +1345,7 @@ static void ec_remove_handlers(struct acpi_ec *ec)
 		clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
 	}
 
-	if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
-		if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
-					&acpi_ec_gpe_handler)))
-			pr_err("failed to remove gpe handler\n");
-		clear_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags);
-	}
+	acpi_ec_stop(ec, false);
 }
 
 static struct acpi_ec *acpi_ec_alloc(void)
Signature · 1 line
1.7.10
#9 lore raw

RFC PATCH v2 1/1 ACPI / EC: Fix an order issue in ec_remove_handlers()

In reply to Wolfram Sang

(Updated to add v2 indicator)

There is an order issue in ec_remove_handlers() that the functions invoked in it are not invoked in the reversed order of their appearance in ec_install_handlers(). This existing issue has been triggered by the following commit:
Commit: dcf15cbded656a12335bc4151f3f75f10080a375
Subject: ACPI / EC: Fix a boot EC regresion by restoring boot EC
The commit invokes ec_remove_handlers() during runtime, thus uncovers this issue. This patch fixes this regression.

Fixes dcf15cbded65 ("ACPI / EC: Fix a boot EC regresion by restoring boot EC")
Cc Wolfram Sang <[email protected]>
Cc Nicholas <[email protected]>
---
 drivers/acpi/ec.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/acpi/ec.c +11 -2
index b1050a0..d513208 100644
@@ -1331,8 +1331,6 @@ static int ec_install_handlers(struct acpi_ec *ec)
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
-	acpi_ec_stop(ec, false);
-
 	if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
 					ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
@@ -1340,6 +1338,17 @@ static void ec_remove_handlers(struct acpi_ec *ec)
 		clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
 	}
 
+	/*
+	 * Disabling EC (transactions) after removing the operation region
+	 * handler. This order is required because _REG(DISCONNECT) may
+	 * access the EmbeddedControl operation regions.
+	 *
+	 * Flushing transactions before removing the GPE handler. This is
+	 * required by the current ACPICA GPE design. ACPICA GPE will block
+	 * a GPE if there is no way to handle it.
+	 */
+	acpi_ec_stop(ec, false);
+
 	if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
 					&acpi_ec_gpe_handler)))
Signature · 1 line
1.7.10
#8 lore raw

RE: [RFC PATCH] ACPI / EC: Fix an order issue in ec_remove_handlers()

In reply to Lv Zheng

This one and the previous one contain problems. A patch marked as [UPDATE RFC v2] is the correct fix. Sorry for the noise.

Thanks and best regards
-Lv

Quoted 60 lines

From: Zheng, Lv
Subject: [RFC PATCH] ACPI / EC: Fix an order issue in ec_remove_handlers()

There is an order issue in ec_remove_handlers() that the functions invoked in it are not invoked in the reversed order of their appearance in ec_install_handlers(). This existing issue has been triggered by the following commit:
Commit: dcf15cbded656a12335bc4151f3f75f10080a375
Subject: ACPI / EC: Fix a boot EC regresion by restoring boot EC
The commit invokes ec_remove_handlers() during runtime, thus uncovers this
issue. This patch fixes this regression.

Fixes dcf15cbded65 ("ACPI / EC: Fix a boot EC regresion by restoring boot

EC")

---
 drivers/acpi/ec.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: linux-acpica/drivers/acpi/ec.c
==========================================================
=========

drivers/acpi/ec.c +0 -2
@@ -1331,8 +1331,6 @@ static int ec_install_handlers(struct ac
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
-	acpi_ec_stop(ec, false);
-
 	if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_address_space_handler(ec-
 >handle,

ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler)))

drivers/acpi/ec.c +7 -0
@@ -1340,6 +1338,17 @@ static void ec_remove_handlers(struct ac
 		clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
 	}
 
+	/*
+	 * Disabling EC (transactions) after removing the operation region
+	 * handler. This order is required because _REG(DISCONNECT) may
+	 * access the EmbeddedControl operation regions.
+	 *
+	 * Flushing transactions before removing the GPE handler. This is
+	 * required by the current ACPICA GPE design. ACPICA GPE will

block

drivers/acpi/ec.c +4 -0
+	 * a GPE if there is no way to handle it.
+	 */
+	acpi_ec_stop(ec, false);
+
 	if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
 					&acpi_ec_gpe_handler)))
author Tested-by on v2 1/1
#10 lore raw

Re: [UPDATE RFC PATCH v2] ACPI / EC: Fix an order issue in ec_remove_handlers()

In reply to Lv Zheng
Quoted 11 lines · Lv Zheng

(Updated to add v2 indicator)

There is an order issue in ec_remove_handlers() that the functions invoked in it are not invoked in the reversed order of their appearance in ec_install_handlers(). This existing issue has been triggered by the following commit:
Commit: dcf15cbded656a12335bc4151f3f75f10080a375
Subject: ACPI / EC: Fix a boot EC regresion by restoring boot EC
The commit invokes ec_remove_handlers() during runtime, thus uncovers this issue. This patch fixes this regression.

Quoted 7 lines
Fixes dcf15cbded65 ("ACPI / EC: Fix a boot EC regresion by restoring boot EC")
Cc Wolfram Sang <[email protected]>
Cc Nicholas <[email protected]>

The status infos are back to normal and the EC error reports are gone from the log. Looks good! Thanks for the quick fix.

Wolfram

#11 lore raw

RE: [UPDATE RFC PATCH v2] ACPI / EC: Fix an order issue in ec_remove_handlers()

Hi,

Quoted 27 lines

From: Wolfram Sang [mailto:[email protected]]
Subject: Re: [UPDATE RFC PATCH v2] ACPI / EC: Fix an order issue in ec_remove_handlers()

Quoted 3 lines · Lv Zheng

(Updated to add v2 indicator)

There is an order issue in ec_remove_handlers() that the functions

invoked

Quoted 6 lines

in it are not invoked in the reversed order of their appearance in ec_install_handlers(). This existing issue has been triggered by the following commit:
Commit: dcf15cbded656a12335bc4151f3f75f10080a375
Subject: ACPI / EC: Fix a boot EC regresion by restoring boot EC
The commit invokes ec_remove_handlers() during runtime, thus

uncovers this

Quoted 3 lines

issue. This patch fixes this regression.

Fixes dcf15cbded65 ("ACPI / EC: Fix a boot EC regresion by restoring

boot EC")

Quoted 6 lines
Quoted 4 lines

The status infos are back to normal and the EC error reports are gone from the log. Looks good! Thanks for the quick fix.

[Lv Zheng]
Thanks for the test, I'll refresh the patch with your tested-by added and RFC removed.

Best regards
-Lv

#12 lore raw

PATCH v3 1/1 ACPI / EC: Fix an order issue in ec_remove_handlers()

In reply to Wolfram Sang

There is an order issue in ec_remove_handlers() that the functions invoked in it are not able to handle the current restrictions (see comments below). If ec_remove_handlers() is invoked during runtime after _REG(CONNECT) is invoked, this issue will be uncovered.

---
 drivers/acpi/ec.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/ec.c +13 -2
index b1050a0..84073a6 100644
@@ -1331,8 +1331,6 @@ static int ec_install_handlers(struct acpi_ec *ec)
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
-	acpi_ec_stop(ec, false);
-
 	if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
 					ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
@@ -1340,6 +1338,19 @@ static void ec_remove_handlers(struct acpi_ec *ec)
 		clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
 	}
 
+	/*
+	 * Stops handling the EC transactions after removing the operation
+	 * region handler. This is required because _REG(DISCONNECT)
+	 * invoked during the removal can result in new EC transactions.
+	 *
+	 * Flushes the EC requests and thus disables the GPE before
+	 * removing the GPE handler. This is required by the current ACPICA
+	 * GPE core. ACPICA GPE core will automatically disable a GPE when
+	 * it is indicated but there is no way to handle it. So the drivers
+	 * must disable the GPEs prior than removing the GPE handlers.
+	 */
+	acpi_ec_stop(ec, false);
+
 	if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
 		if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
 					&acpi_ec_gpe_handler)))
Signature · 1 line
1.7.10