Re: [PATCH 2/2] RAS: Introduce the FRU Memory Poison Manager

From: Borislav Petkov
Date: Wed Feb 14 2024 - 06:16:35 EST


On Tue, Feb 13, 2024 at 09:35:16PM -0600, Yazen Ghannam wrote:
> +static bool has_valid_entries(u64 valid_bits)
> +{
> + if (!(valid_bits & FMP_VALID_LIST_ENTRIES))
> + return false;
> +
> + if (!(valid_bits & FMP_VALID_LIST))
> + return false;
> +
> + return true;
> +}

Rename:

diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 090b60d269e7..3da3f40f1efe 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -221,7 +221,7 @@ static int update_record_on_storage(struct fru_rec *rec)
return ret;
}

-static bool has_valid_entries(struct fru_rec *rec)
+static bool rec_has_valid_entries(struct fru_rec *rec)
{
if (!(rec->fmp.validation_bits & FMP_VALID_LIST_ENTRIES))
return false;
@@ -286,7 +286,7 @@ static void update_fru_record(struct fru_rec *rec, struct mce *m)
fpd.addr = m->addr;

/* This is the first entry, so just save it. */
- if (!has_valid_entries(rec))
+ if (!rec_has_valid_entries(rec))
goto save_fpd;

/* Ignore already recorded errors. */
@@ -397,7 +397,7 @@ static void retire_mem_records(void)
for_each_fru(i, rec) {
fmp = &rec->fmp;

- if (!has_valid_entries(rec))
+ if (!rec_has_valid_entries(rec))
continue;

cpu = get_cpu_from_fru_id(fmp->fru_id);

---

and this one:

---

diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 3da3f40f1efe..813cc6a4f435 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -255,12 +255,12 @@ static bool same_fpd(struct cper_fru_poison_desc *old, struct cper_fru_poison_de
return true;
}

-static bool is_dup_fpd(struct fru_rec *rec, struct cper_fru_poison_desc *new)
+static bool rec_has_fpd(struct fru_rec *rec, struct cper_fru_poison_desc *fpd)
{
unsigned int i;

for (i = 0; i < rec->fmp.nr_entries; i++) {
- if (same_fpd(get_fpd(rec, i), new)) {
+ if (same_fpd(get_fpd(rec, i), fpd)) {
pr_debug("Found duplicate record");
return true;
}
@@ -290,7 +290,7 @@ static void update_fru_record(struct fru_rec *rec, struct mce *m)
goto save_fpd;

/* Ignore already recorded errors. */
- if (is_dup_fpd(rec, &fpd))
+ if (rec_has_fpd(rec, &fpd))
goto out_unlock;

if (rec->fmp.nr_entries >= max_nr_entries) {

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette