>-----Original Message----- >From: Borislav Petkov <bp@xxxxxxxxx> >Sent: 06 January 2025 15:58 >To: Shiju Jose <shiju.jose@xxxxxxxxxx> >Cc: linux-edac@xxxxxxxxxxxxxxx; linux-cxl@xxxxxxxxxxxxxxx; linux- >acpi@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; >tony.luck@xxxxxxxxx; rafael@xxxxxxxxxx; lenb@xxxxxxxxxx; >mchehab@xxxxxxxxxx; dan.j.williams@xxxxxxxxx; dave@xxxxxxxxxxxx; Jonathan >Cameron <jonathan.cameron@xxxxxxxxxx>; dave.jiang@xxxxxxxxx; >alison.schofield@xxxxxxxxx; vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx; >david@xxxxxxxxxx; Vilas.Sridharan@xxxxxxx; leo.duran@xxxxxxx; >Yazen.Ghannam@xxxxxxx; rientjes@xxxxxxxxxx; jiaqiyan@xxxxxxxxxx; >Jon.Grimm@xxxxxxx; dave.hansen@xxxxxxxxxxxxxxx; >naoya.horiguchi@xxxxxxx; james.morse@xxxxxxx; jthoughton@xxxxxxxxxx; >somasundaram.a@xxxxxxx; erdemaktas@xxxxxxxxxx; pgonda@xxxxxxxxxx; >duenwen@xxxxxxxxxx; gthelen@xxxxxxxxxx; >wschwartz@xxxxxxxxxxxxxxxxxxx; dferguson@xxxxxxxxxxxxxxxxxxx; >wbs@xxxxxxxxxxxxxxxxxxxxxx; nifan.cxl@xxxxxxxxx; tanxiaofei ><tanxiaofei@xxxxxxxxxx>; Zengtao (B) <prime.zeng@xxxxxxxxxxxxx>; Roberto >Sassu <roberto.sassu@xxxxxxxxxx>; kangkang.shen@xxxxxxxxxxxxx; >wanghuiqiang <wanghuiqiang@xxxxxxxxxx>; Linuxarm ><linuxarm@xxxxxxxxxx> >Subject: Re: [PATCH v18 02/19] EDAC: Add scrub control feature > >On Mon, Jan 06, 2025 at 12:09:58PM +0000, shiju.jose@xxxxxxxxxx wrote: >> diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index >> f9cf19d8d13d..a162726cc6b9 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 += scrub.o > >You're not being serious here - this scrub gunk is enabled by default on >*everything*? > >So the main user of this is going to be CXL, AFAICT, so the scrubbing gunk should >depend at least on it or so. Definitely not unconditionally enabled on every build. Thanks for the comment. My understanding is that you meant the following changes (diff to this patch), for scrub? (and similar for other features). Please let me know if you need any corrections. ======================================== diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index 6078f02e883b..7886097f998f 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -158,7 +158,7 @@ config CXL_RAS_FEATURES tristate "CXL: Memory RAS features" depends on CXL_PCI depends on CXL_MEM - depends on EDAC + select EDAC_FEAT_SCRUB help The CXL memory RAS feature control is optional and allows host to control the RAS features configurations of CXL Type 3 devices. diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index 06f7b43a6f78..709bd7ad8015 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig @@ -9,6 +9,14 @@ config EDAC_ATOMIC_SCRUB config EDAC_SUPPORT bool +config EDAC_FEAT_SCRUB + bool + help + The EDAC scrub feature is optional and is designed to control the + memory scrubbers in the system. The common sysfs scrub interface + abstracts the control of various arbitrary scrubbing functionalities + into a unified set of functions. + menuconfig EDAC tristate "EDAC (Error Detection And Correction) reporting" depends on HAS_IOMEM && EDAC_SUPPORT && RAS diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index 1de9fe66ac6b..71a522272215 100644 --- a/drivers/edac/Makefile +++ b/drivers/edac/Makefile @@ -10,7 +10,9 @@ 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 += scrub.o ecs.o mem_repair.o + +edac_core-$(CONFIG_EDAC_FEAT_SCRUB) += scrub.o edac_core-$(CONFIG_EDAC_DEBUG) += debugfs.o diff --git a/drivers/ras/Kconfig b/drivers/ras/Kconfig index b77790bdc73a..870f3466c2f7 100644 --- a/drivers/ras/Kconfig +++ b/drivers/ras/Kconfig @@ -49,7 +49,7 @@ config RAS_FMPM config MEM_ACPI_RAS2 tristate "Memory ACPI RAS2 driver" depends on ACPI_RAS2 - depends on EDAC + select EDAC_FEAT_SCRUB help The driver binds to the platform device added by the ACPI RAS2 table parser. Use a PCC channel subspace for communicating with diff --git a/include/linux/edac.h b/include/linux/edac.h index 5d07192bf1a7..0f6c7f3582c3 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -698,9 +698,16 @@ struct edac_scrub_ops { int (*set_cycle_duration)(struct device *dev, void *drv_data, u32 cycle); }; +#if IS_ENABLED(CONFIG_EDAC_FEAT_SCRUB) int edac_scrub_get_desc(struct device *scrub_dev, const struct attribute_group **attr_groups, u8 instance); +#else +static inline int edac_scrub_get_desc(struct device *scrub_dev, + const struct attribute_group **attr_groups, + u8 instance) +{ return -EOPNOTSUPP; } +#endif ... ============================================= > >-- >Regards/Gruss, > Boris. > >https://people.kernel.org/tglx/notes-about-netiquette > Thanks, Shiju