In a system with a single initiator node, and one or more memory-only
'target' nodes, the memory-only node(s) would fail to register their
initiator node correctly. i.e. in sysfs:
# ls /sys/devices/system/node/node0/access0/targets/
node0
Where as the correct behavior should be:
# ls /sys/devices/system/node/node0/access0/targets/
node0 node1
This happened because hmat_register_target_initiators() uses list_sort()
to sort the initiator list, but the sort comparision function
(initiator_cmp()) is overloaded to also set the node mask's bits.
In a system with a single initiator, the list is singular, and list_sort
elides the comparision helper call. Thus the node mask never gets set,
and the subsequent search for the best initiator comes up empty.
Add a new helper to sort the initiator list, and handle the singular
list corner case by setting the node mask for that explicitly.
Reported-by: Chris Piper <chris.d.piper(a)intel.com>
Cc: <stable(a)vger.kernel.org>
Cc: Rafael J. Wysocki <rafael(a)kernel.org>
Cc: Liu Shixin <liushixin2(a)huawei.com>
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
drivers/acpi/numa/hmat.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
index 144a84f429ed..cd20b0e9cdfa 100644
--- a/drivers/acpi/numa/hmat.c
+++ b/drivers/acpi/numa/hmat.c
@@ -573,6 +573,30 @@ static int initiator_cmp(void *priv, const struct list_head *a,
return ia->processor_pxm - ib->processor_pxm;
}
+static int initiators_to_nodemask(unsigned long *p_nodes)
+{
+ /*
+ * list_sort doesn't call @cmp (initiator_cmp) for 0 or 1 sized lists.
+ * For a single-initiator system with other memory-only nodes, this
+ * means an empty p_nodes mask, since that is set by initiator_cmp().
+ * Special case the singular list, and make sure the node mask gets set
+ * appropriately.
+ */
+ if (list_empty(&initiators))
+ return -ENXIO;
+
+ if (list_is_singular(&initiators)) {
+ struct memory_initiator *initiator = list_first_entry(
+ &initiators, struct memory_initiator, node);
+
+ set_bit(initiator->processor_pxm, p_nodes);
+ return 0;
+ }
+
+ list_sort(p_nodes, &initiators, initiator_cmp);
+ return 0;
+}
+
static void hmat_register_target_initiators(struct memory_target *target)
{
static DECLARE_BITMAP(p_nodes, MAX_NUMNODES);
@@ -609,7 +633,9 @@ static void hmat_register_target_initiators(struct memory_target *target)
* initiators.
*/
bitmap_zero(p_nodes, MAX_NUMNODES);
- list_sort(p_nodes, &initiators, initiator_cmp);
+ if (initiators_to_nodemask(p_nodes) < 0)
+ return;
+
if (!access0done) {
for (i = WRITE_LATENCY; i <= READ_BANDWIDTH; i++) {
loc = localities_types[i];
@@ -643,7 +669,9 @@ static void hmat_register_target_initiators(struct memory_target *target)
/* Access 1 ignores Generic Initiators */
bitmap_zero(p_nodes, MAX_NUMNODES);
- list_sort(p_nodes, &initiators, initiator_cmp);
+ if (initiators_to_nodemask(p_nodes) < 0)
+ return;
+
for (i = WRITE_LATENCY; i <= READ_BANDWIDTH; i++) {
loc = localities_types[i];
if (!loc)
--
2.38.1
Currently, ghes_edac_register() is called via ghes_init() from acpi_init()
at the subsys_initcall() level. However, edac_init() is also called from
the subsys_initcall(), leaving the ordering ambiguous.
If ghes_edac_register() is called first, then 'mc0' ends up at:
/sys/devices/mc0/, instead of the expected:
/sys/devices/system/edac/mc/mc0.
So while everything seems ok, other than the unexpected sysfs location, it
seems like 'edac_init()' should be called before any drivers start
registering. So have 'edac_init()' called earlier via arch_initcall().
However, this moves edac_pci_clear_parity_errors() up as well. Seems like
this wants to be called after pci bus scan, so keep
edac_pci_clear_parity_errors() at subsys_init(). That said, it seems like
pci bus scan happens at subsys_init() level, so really the parity clearing
should be moved later. But that can be left as a separate patch.
Fixes: dc4e8c07e9e2 ("ACPI: APEI: explicit init of HEST and GHES in apci_init()")
Signed-off-by: Jason Baron <jbaron(a)akamai.com>
Cc: Borislav Petkov <bp(a)alien8.de>
Cc: Mauro Carvalho Chehab <mchehab(a)kernel.org>
Cc: Tony Luck <tony.luck(a)intel.com>
Cc: James Morse <james.morse(a)arm.com>
Cc: Robert Richter <rric(a)kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki(a)intel.com>
Cc: Shuai Xue <xueshuai(a)linux.alibaba.com>
Cc: stable(a)vger.kernel.org
---
drivers/edac/edac_module.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 32a931d0cb71..407d4a5fce7a 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -109,15 +109,6 @@ static int __init edac_init(void)
if (err)
return err;
- /*
- * Harvest and clear any boot/initialization PCI parity errors
- *
- * FIXME: This only clears errors logged by devices present at time of
- * module initialization. We should also do an initial clear
- * of each newly hotplugged device.
- */
- edac_pci_clear_parity_errors();
-
err = edac_mc_sysfs_init();
if (err)
goto err_sysfs;
@@ -157,12 +148,34 @@ static void __exit edac_exit(void)
edac_subsys_exit();
}
+static void __init edac_init_clear_parity_errors(void)
+{
+ /*
+ * Harvest and clear any boot/initialization PCI parity errors
+ *
+ * FIXME: This only clears errors logged by devices present at time of
+ * module initialization. We should also do an initial clear
+ * of each newly hotplugged device.
+ */
+ edac_pci_clear_parity_errors();
+
+ return 0;
+}
+
/*
* Inform the kernel of our entry and exit points
+ *
+ * ghes_edac_register() is call via acpi_init() -> ghes_init()
+ * at the subsys_initcall level so edac_init() must come first
*/
-subsys_initcall(edac_init);
+arch_initcall(edac_init);
module_exit(edac_exit);
+/*
+ * Clear parity errors after PCI subsys is initialized
+ */
+subsys_initcall(edac_init_clear_parity_errors);
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Doug Thompson www.softwarebitmaker.com, et al");
MODULE_DESCRIPTION("Core library routines for EDAC reporting");
--
2.17.1
Urgent Notification/Confirmation/Awareness
The money has been successfully transferred to your bank account!
Have you confirmed money sent to your bank account? The fund is the support from the European Union Humanitarian Program in collaboration with the UNHCR Hong Kong 聯合國難民署 Aid Fund
Your e-mail was extracted from the email collective program for humanitarian support due to the current Climate change and economic problems. If you have not yet confirmed the money in your bank account, please confirm your payment with the European banking institution (Iccrea Banca S.p.A) in the amount of ($550,000.00 USD).
If this help doesn't suit you, kindly don't respond to us.
Email: ibspaicdc(a)gmail.com
Email : info(a)iccreabancn.org
Email : ibspaicdc(a)gmail.com
Guido Joseph
Tel. +39 03 8829911
Email: info(a)iccreabancn.org
Email: customercare(a)iccreabancn.org
Email: ibspaicdc(a)gmail.com
Legal form: Societa Per Azioni Con Socio
Type of azienda: Sede Centrale P. Iva: 04774801007
_____________________________________________________________
紧急通知/确认/意识
款项已成功转入您的银行账户!
您确认汇款到您的银行账户了吗? 该基金是欧盟人道主义计划与联合国难民署香港办事处合作资助的难民援助基金
由于当前的气候变化和经济问题,您的电子邮件是从用于人道主义支持的电子邮件集体计划中提取的。 如果您尚未确认银行账户中的款项,请向欧洲银行机构 (Iccrea Banca S.p.A) 确认您的付款金额 ($550,000.00 USD)。
如果此帮助不适合您,请不要回复我们。
电子邮件:ibspaicdc(a)gmail.com
邮箱:info(a)iccreabancn.org
电子邮件:ibspaicdc(a)gmail.com
吉多约瑟夫
电话。 +39 03 8829911
邮箱:info(a)iccreabancn.org
邮箱:customercare(a)iccreabancn.org
电子邮件:ibspaicdc(a)gmail.com
法律形式:Societa Per Azioni Con Socio
azienda 类型:Sede Centrale P. Iva:04774801007