Attention is currently required from: Arthur Heymans, Christian Walter, Johnny Lin, Lean Sheng Tan, Shuo Liu, Tim Chu.

Patrick Rudolph has uploaded this change for review.

View Change

soc/intel/xeon_sp/spr: Don't leak memory

Only call fill_pds() once to prevent leaking memory. Previously it was
called for every active stack on every socket.

Only call dump_pds() once to prevent spamming the console with the same
information.

Drop the return value since it's always returning success.

Change-Id: Ifa9609e9da086dc9731556014ea9b320b270d776
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
M src/soc/intel/xeon_sp/include/soc/numa.h
M src/soc/intel/xeon_sp/spr/numa.c
M src/soc/intel/xeon_sp/uncore.c
3 files changed, 10 insertions(+), 10 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/80547/1
diff --git a/src/soc/intel/xeon_sp/include/soc/numa.h b/src/soc/intel/xeon_sp/include/soc/numa.h
index 6aaf172..aba3f09 100644
--- a/src/soc/intel/xeon_sp/include/soc/numa.h
+++ b/src/soc/intel/xeon_sp/include/soc/numa.h
@@ -54,7 +54,7 @@
extern struct proximity_domains pds;

void dump_pds(void);
-enum cb_err fill_pds(void);
+void fill_pds(void);

/*
* Return the total size of memory regions in generic initiator affinity
diff --git a/src/soc/intel/xeon_sp/spr/numa.c b/src/soc/intel/xeon_sp/spr/numa.c
index 169f4f8..23f52c6 100644
--- a/src/soc/intel/xeon_sp/spr/numa.c
+++ b/src/soc/intel/xeon_sp/spr/numa.c
@@ -25,7 +25,7 @@
}
}

-enum cb_err fill_pds(void)
+void fill_pds(void)
{
uint8_t num_sockets = soc_get_num_cpus();
uint8_t num_cxlnodes = get_cxl_node_count();
@@ -72,7 +72,7 @@

/* If there are no CXL nodes, we are done */
if (num_cxlnodes == 0)
- return CB_SUCCESS;
+ return;

/* There are CXL nodes, fill in generic initiator domain after the processors pds */
uint8_t skt_id, cxl_id;
@@ -98,8 +98,6 @@
}
}
}
-
- return CB_SUCCESS;
}

/*
diff --git a/src/soc/intel/xeon_sp/uncore.c b/src/soc/intel/xeon_sp/uncore.c
index de2d175..96855ed 100644
--- a/src/soc/intel/xeon_sp/uncore.c
+++ b/src/soc/intel/xeon_sp/uncore.c
@@ -329,11 +329,13 @@
int index = 0;

if (CONFIG(SOC_INTEL_HAS_CXL)) {
- /* Construct NUMA data structure. This is needed for CXL. */
- if (fill_pds() != CB_SUCCESS)
- pds.num_pds = 0;
-
- dump_pds();
+ static bool once;
+ if (!once) {
+ /* Construct NUMA data structure. This is needed for CXL. */
+ fill_pds();
+ dump_pds();
+ once = true;
+ }
}

/* Read standard PCI resources. */

To view, visit change 80547. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Ifa9609e9da086dc9731556014ea9b320b270d776
Gerrit-Change-Number: 80547
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Shuo Liu <shuo.liu@intel.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Attention: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Attention: Christian Walter <christian.walter@9elements.com>
Gerrit-Attention: Shuo Liu <shuo.liu@intel.com>
Gerrit-Attention: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Attention: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Attention: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-MessageType: newchange