Re: [PATCH 2/2] EDAC/amd64: Merge error injection sysfs facilities
From: Yazen Ghannam
Date: Tue Dec 15 2020 - 11:12:35 EST
On Tue, Dec 15, 2020 at 12:05:17PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Merge them into the main driver and put them inside an EDAC_DEBUG
> ifdeffery to simplify the driver and have all debugging/injection stuff
> behind a debug build-time switch.
>
> No functional changes.
>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> ---
> drivers/edac/Kconfig | 7 +-
> drivers/edac/Makefile | 6 +-
> drivers/edac/amd64_edac.c | 237 +++++++++++++++++++++++++++++++++-
> drivers/edac/amd64_edac.h | 8 --
> drivers/edac/amd64_edac_inj.c | 235 ---------------------------------
> 5 files changed, 236 insertions(+), 257 deletions(-)
> delete mode 100644 drivers/edac/amd64_edac_inj.c
>
> diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
> index 7a47680d6f07..9c2e719cb86a 100644
> --- a/drivers/edac/Kconfig
> +++ b/drivers/edac/Kconfig
> @@ -81,10 +81,9 @@ config EDAC_AMD64
> Support for error detection and correction of DRAM ECC errors on
> the AMD64 families (>= K8) of memory controllers.
>
> -config EDAC_AMD64_ERROR_INJECTION
> - bool "Sysfs HW Error injection facilities"
> - depends on EDAC_AMD64
> - help
> + When EDAC_DEBUG is enabled, hardware error injection facilities
> + through sysfs are available:
> +
> Recent Opterons (Family 10h and later) provide for Memory Error
Can we say "Opterons (Family 10h to Family 15h)"? It may also apply to
Family 16h, but I don't know if they were branded as Opterons.
The injection code in this module doesn't apply to Family 17h and later.
Also, Family 17h and later doesn't allow the OS direct access to the error
injection registers. They're locked down by security policy, etc.
> Injection into the ECC detection circuits. The amd64_edac module
> allows the operator/user to inject Uncorrectable and Correctable
...
> +
> +static umode_t inj_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
> +{
> + struct device *dev = kobj_to_dev(kobj);
> + struct mem_ctl_info *mci = container_of(dev, struct mem_ctl_info, dev);
> + struct amd64_pvt *pvt = mci->pvt_info;
> +
> + if (pvt->fam < 0x10)
Related to the comment above, can this be changed to the following?
if (pvt->fam < 0x10 || pvt->fam >= 0x17)
> + return 0;
> + return attr->mode;
> +}
> +
Everything else looks good to me.
Reviewed-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
Thanks,
Yazen