RAS/CEC: Move non-debug attributes out of debugfs
Subsystems (4)
PATCH 1/1 RAS/CEC: Move non-debug attributes out of debugfs
From: Kyle Meyer <[email protected]>
When kernel lockdown is in effect, use of debugfs is not permitted. Move decay_interval and action_threshold out of debugfs, from debugfs/ras/cec to sysfs/system/devices/machinecheck/cec.
--- arch/x86/include/asm/mce.h | 1 + arch/x86/kernel/cpu/mce/core.c | 3 +- arch/x86/ras/Kconfig | 4 +- drivers/ras/cec.c | 141 ++++++++++++++++++++++----------- 4 files changed, 101 insertions(+), 48 deletions(-)
arch/x86/include/asm/mce.h +1 -0
@@ -206,6 +206,7 @@ static inline void enable_copy_mc_fragile(void)struct cper_ia_proc_ctx ;#ifdef CONFIG_X86_MCE +extern struct bus_type mce_subsys;int mcheck_init (void );void mcheck_cpu_init (struct cpuinfo_x86 *c);void mcheck_cpu_clear (struct cpuinfo_x86 *c);
arch/x86/kernel/cpu/mce/core.c +2 -1
@@ -2376,10 +2376,11 @@ static void mce_enable_ce(void *all)__mcheck_cpu_init_timer (); } -static struct bus_type mce_subsys = { +struct bus_type mce_subsys = { .name ="machinecheck" , .dev_name ="machinecheck" , }; +EXPORT_SYMBOL_GPL (mce_subsys); DEFINE_PER_CPU(struct device *, mce_device);
arch/x86/ras/Kconfig +2 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config RAS_CEC bool "Correctable Errors Collector" - depends on X86_MCE && MEMORY_FAILURE && DEBUG_FS + depends on X86_MCE && MEMORY_FAILURE help This is a small cache which collects correctable memory errors per 4K page PFN and counts their repeated occurrence. Once the counter for a
@@ -15,7 +15,7 @@ config RAS_CEC config RAS_CEC_DEBUG bool "CEC debugging machinery" default n - depends on RAS_CEC + depends on RAS_CEC && DEBUG_FS help Add extra files to (debugfs)/ras/cec to test the correctable error collector feature. "pfn" is a writable file that allows user to
drivers/ras/cec.c +96 -45
206 lines not on this page · raw message
Signature · 1 line
2.26.2
Quoted 5 lines · kyle-meyer
From: Kyle Meyer <[email protected]>
When kernel lockdown is in effect, use of debugfs is not permitted. Move
decay_intervalandaction_thresholdout of debugfs, from debugfs/ras/cec to sysfs/system/devices/machinecheck/cec.
You forgot to attach the patch that you wrote that updates Documentation/ABI/. ;)
Also, why *should* these be part of the stable sysfs ABI? What app is using them? Why does it need them? Why these two and only these two? What's left in debugfs?
Quoted 2 lines
You forgot to attach the patch that you wrote that updates
Documentation/ABI/. ;)
Thanks, I will include the documentation with a second version of the patch.
Quoted 2 lines
Also, why *should* these be part of the stable sysfs ABI? What app is using them? Why does it need them?
We have system scripts that adjust decay_interval and action_threshold. They can't access those attributes when lockdown is enabled. If there is a more appropriate place for those attributes, please let me know.
Quoted 1 line
Why these two and only these two? What's left in debugfs?
The other attributes (pfn and array) are used to test CEC. They are only created when RAS_CEC_DEBUG is enabled.
Thanks,
Kyle Meyer
Quoted 5 lines · Kyle
Quoted 2 lines
Also, why *should* these be part of the stable sysfs ABI? What app is using them? Why does it need them?
We have system scripts that adjust
decay_intervalandaction_threshold. They can't access those attributes when lockdown is enabled. If there is a more appropriate place for those attributes, please let me know.
Thanks for the info. That helps a bit. But, I'd also appreciate if you could expand on this a little more. What "system scripts" are these? Who is using them? What are they trying to accomplish?
We can try to find the best home for these attributes with that info in hand, if it's not sysfs.
Quoted 3 lines
Quoted 1 line
Why these two and only these two? What's left in debugfs?
The other attributes (pfn and array) are used to test CEC. They are only created when
RAS_CEC_DEBUGis enabled.
Oh, that's good info too. Can you please include that in some form in your new changelog?
Borislav Petkov
maintainerQuoted 5 lines · kyle-meyer
From: Kyle Meyer <[email protected]>
When kernel lockdown is in effect, use of debugfs is not permitted. Move
decay_intervalandaction_thresholdout of debugfs, from debugfs/ras/cec to sysfs/system/devices/machinecheck/cec.
All those knobs are in debugfs because we wanted to discuss the proper interface design first and only then cast them in stone. I guess that has not happened yet.
What you're doing is certainly not what we had in mind so just because some lockdown policy says so, is not good enough.
Quoted 5 lines
arch/x86/kernel/cpu/mce/core.c +0
-0
arch/x86/kernel/cpu/mce/core.c static void mce_enable_ce(void *all) · line 2383
Quoted 9 lines
arch/x86/kernel/cpu/mce/core.c +2
-1@@ -2376,10 +2376,11 @@ static void mce_enable_ce(void *all)__mcheck_cpu_init_timer (); } -static struct bus_type mce_subsys = { +struct bus_type mce_subsys = { .name ="machinecheck" , .dev_name ="machinecheck" , }; +EXPORT_SYMBOL_GPL (mce_subsys);
Nope, this is not going to happen.
Besides, that error collector is used on x86 but it is generic enough so that it can be used by other arches. So if anything, it should not be exposed in the x86's "machinecheck" hierarchy but somewhere generic.
And until that proper interface has been hammered out, you can just as well disable it in your lockdown configs.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteOn Fri, Mar 24, 2023 at 01:49:19AM +0100, Borislav Petkov wrote:
...
Quoted 5 lines
Besides, that error collector is used on x86 but it is generic enough so that it can be used by other arches. So if anything, it should not be exposed in the x86's "machinecheck" hierarchy but somewhere generic.
How about "/sys/ras" to collect global RAS interfaces? Maybe it can link to other directories like "/sys/devices/*" for hardware things like MCA, and "/sys/kernel/*" for kernel things like CEC.
Thanks,
Yazen
Borislav Petkov
maintainerQuoted 1 line · Yazen Ghannam
How about "
/sys/ras" to collect global RAS interfaces?
Looking a bit at
Documentation/admin-guide/sysfs-rules.rst
it does sound like /sys/<subsystem> could be a good place. Might wanna run it by Greg, though, first.
Quoted 2 lines
Maybe it can link to other directories like "
/sys/devices/*" for hardware things like MCA,
Those are at
/sys/devices/system/machinecheck/
Quoted 1 line
and "
/sys/kernel/*" for kernel things like CEC.
Or /sys/drivers
Remember there's also
/sys/devices/system/edac/
so a lot of RAS junk spread all over the place.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette