Re: [PATCH v10 01/11] EDAC: Add generic EDAC RAS control feature driver

From: Borislav Petkov
Date: Tue Jul 30 2024 - 09:17:22 EST


On Fri, Jul 26, 2024 at 05:05:45PM +0100, shiju.jose@xxxxxxxxxx wrote:
> From: Shiju Jose <shiju.jose@xxxxxxxxxx>
>
> Add generic EDAC driver supports registering RAS features supported
> in the system. The driver exposes feature's control attributes to the
> userspace in /sys/bus/edac/devices/<dev-name>/<ras-feature>/
>
> Co-developed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Signed-off-by: Shiju Jose <shiju.jose@xxxxxxxxxx>
> ---
> drivers/edac/Makefile | 1 +
> drivers/edac/edac_ras_feature.c | 181 +++++++++++++++++++++++++++++++
> include/linux/edac_ras_feature.h | 66 +++++++++++
> 3 files changed, 248 insertions(+)
> create mode 100755 drivers/edac/edac_ras_feature.c
> create mode 100755 include/linux/edac_ras_feature.h
>
> diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile
> index 9c09893695b7..c532b57a6d8a 100644
> --- a/drivers/edac/Makefile
> +++ b/drivers/edac/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_EDAC) := edac_core.o
>
> edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o
> edac_core-y += edac_module.o edac_device_sysfs.o wq.o
> +edac_core-y += edac_ras_feature.o

EDAC and RAS and feature?!

Oh boy.

EDAC == RAS.

"feature" is silly.

Looking at the code below, you're registering an EDAC device.
- edac_ras_dev_register().

So why isn't this thing in edac_device.c?

> diff --git a/include/linux/edac_ras_feature.h b/include/linux/edac_ras_feature.h
> new file mode 100755
> index 000000000000..8f0e0c47a617
> --- /dev/null
> +++ b/include/linux/edac_ras_feature.h
> @@ -0,0 +1,66 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * EDAC RAS control features.
> + *
> + * Copyright (c) 2024 HiSilicon Limited.
> + */
> +
> +#ifndef __EDAC_RAS_FEAT_H
> +#define __EDAC_RAS_FEAT_H
> +
> +#include <linux/types.h>
> +#include <linux/edac.h>
> +
> +#define EDAC_RAS_NAME_LEN 128
> +
> +enum edac_ras_feat {
> + RAS_FEAT_SCRUB,
> + RAS_FEAT_ECS,
> + RAS_FEAT_MAX
> +};
> +
> +struct edac_ecs_ex_info {
> + u16 num_media_frus;
> +};
> +
> +/*
> + * EDAC RAS feature information structure
> + */
> +struct edac_scrub_data {
> + const struct edac_scrub_ops *ops;
> + void *private;
> +};
> +
> +struct edac_ecs_data {
> + const struct edac_ecs_ops *ops;
> + void *private;
> +};

So each "feature" would require a separate struct type?

Why don't you define a *single* struct which accomodates any RAS
functionality?

Thx.

--
Regards/Gruss,
Boris.

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