acpi: Fix hed module initialization order when it is built-in
PATCH 1/1 acpi: Fix hed module initialization order when it is built-in
When the module hed is built-in, the init order is determined by Makefile order. That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/acpi/Makefile +7 -1
@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #
@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o
Signature · 1 line
2.33.0
Rafael J. Wysocki
maintainerQuoted 3 lines · Xiaofei Tan
When the module hed is built-in, the init order is determined by
Makefileorder.
Are you sure?
Quoted 6 lines
That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
Well, the problem is real, but does the change really prevent it from happening or does it just increase the likelihood of success?
In the latter case, and generally speaking too, it would be better to add explicit synchronization between evged and hed.
Quoted 35 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-2@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o --2.33.0
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Xiaofei Tan
When the module hed is built-in, the init order is determined by
Makefileorder.Are you sure?
yes
Quoted 8 lines
Quoted 6 lines
That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
Well, the problem is real, but does the change really prevent it from happening or does it just increase the likelihood of success?
It can be completely solved if the driver used as built-in way. If build HED as a module, it not solved.
Quoted 40 lines
In the latter case, and generally speaking too, it would be better to add explicit synchronization between evged and hed.
Quoted 33 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-2@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o --Quoted 2 lines
2.33.0
.
Quoted 9 lines · On Mon, 23 Dec 2024 17:31:08 +0800 Xiaofei Tan <[email protected]> wrote:
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Xiaofei Tan
When the module hed is built-in, the init order is determined by
Makefileorder.Are you sure?
yes
We had a similar fix in CXL recently (which is why I suggested this approach internally when tanxiaofei mentioned the problem).
The related discussion for the CXL patch was the first time I'd come across solution to load order for built in cases.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
Quoted 5 lines
Quoted 2 lines
Well, the problem is real, but does the change really prevent it from happening or does it just increase the likelihood of success?
It can be completely solved if the driver used as built-in way. If build HED as a module, it not solved.
Can we enforce that condition not happening with appropriate Kconfig? It's annoying to restrict build options, but if needed to make it work then better than not working!
Jonathan
Quoted 41 lines
Quoted 41 lines
In the latter case, and generally speaking too, it would be better to add explicit synchronization between evged and hed.
Quoted 33 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-2@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o --Quoted 2 lines
2.33.0
.
Hi Jonathan,
Quoted 10 lines · Jonathan Cameron
Quoted 7 lines · On Mon, 23 Dec 2024 17:31:08 +0800 Xiaofei Tan <[email protected]> wrote:
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Xiaofei Tan
When the module hed is built-in, the init order is determined by
Makefileorder.Are you sure?
Quoted 9 lines
Quoted 1 line
yes
We had a similar fix in CXL recently (which is why I suggested this approach internally when tanxiaofei mentioned the problem).
The related discussion for the CXL patch was the first time I'd come across solution to load order for built in cases.
Yes :)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Well, the problem is real, but does the change really prevent it from happening or does it just increase the likelihood of success?
It can be completely solved if the driver used as built-in way. If build HED as a module, it not solved.
Can we enforce that condition not happening with appropriate
Kconfig? It's annoying to restrict build options, but if needed to make it work then better than not working!
Agree, i will change ACPI_HED from tristate to bool if there are no other comments, thanks.
Quoted 44 lines
Jonathan
Quoted 31 lines
Quoted 31 lines
In the latter case, and generally speaking too, it would be better to add explicit synchronization between evged and hed.
Quoted 28 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-0@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.oQuoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/acpi/Makefile +0
-2-obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o --2.33.0
.
.
Em Fri, 15 Nov 2024 11:50:14 +0800
Xiaofei Tan <[email protected]> escreveu:
Please always copy my @kernel.org address for upstream work.
Quoted 7 lines
When the module hed is built-in, the init order is determined by
Makefileorder. That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.
IMO, it is a lot better to use a late init call. Please see:
include/linux/init.h
This would be done by, for instance, using late_initcall().
Now, what we have is:
acpi-y += evged.o obj-$(CONFIG_ACPI_HED) += hed.o
Where ACPI_HED being a tri-state.
It sounds to me, that even, with your patch, if you build HED as a module, you'll still have a problem.
Shouldn't be ACPI_HED be changed from tristate to bool?
Regards,
Mauro
Quoted 33 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-1@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o
Hi Mauro,
Quoted 4 lines · Mauro Carvalho Chehab
Em Fri, 15 Nov 2024 11:50:14 +0800
Xiaofei Tan <[email protected]> escreveu:Please always copy my @kernel.org address for upstream work.
OK
Quoted 14 lines
Quoted 7 lines
When the module hed is built-in, the init order is determined by
Makefileorder. That order violates expectations. Because the module hed init is behind evged. RAS records can't be handled in the special time window that evged has initialized while hed not. If the number of such RAS records is more than the APEI HEST error source number, the HEST resources could be occupied all, and then could affect subsequent RAS error reporting.IMO, it is a lot better to use a late init call. Please see:
include/linux/init.hThis would be done by, for instance, using
late_initcall().Now, what we have is:
Quoted 7 lines
acpi-y += evged.o obj-$(CONFIG_ACPI_HED) += hed.oWhere
ACPI_HEDbeing a tri-state.It sounds to me, that even, with your patch, if you build HED as a module, you'll still have a problem.
Yes, and it is also affected by loading sequence of HED and GHES. Anyway, the risk remains.
Quoted 2 lines
Shouldn't be
ACPI_HEDbe changed from tristate to bool?
agree,
@Rafael
Hi Rafael, Please help check if we can do this change, thanks.
Quoted 37 lines
Regards,
MauroQuoted 25 lines
Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Xiaofei Tan <[email protected]>--- drivers/acpi/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/Makefile +7
-0@@ -15,6 +15,13 @@ endif obj-$(CONFIG_ACPI) += tables.o +# +# The hed.o needs to be in front of evged.o to avoid the problem that +# RAS errors cannot be handled in the special time window of startup +# phase that evged has initialized while hed not. +# +obj-$(CONFIG_ACPI_HED) += hed.o + # # ACPI Core Subsystem (Interpreter) #drivers/acpi/Makefile obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o · line 107
Quoted 7 lines
drivers/acpi/Makefile +0
-1@@ -95,7 +102,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o -obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o.