[PATCH RFC] Why does cpu_cache_invalidate_memregion() return 0 if there are no handlers?
From: Bence Csokas
Date: Tue Sep 22 2026 - 03:38:39 EST
I noticed cpu_cache_invalidate_memregion() returns 0 if there are no
registered `cache_coherency_ops_inst`s, which I find counter-intuitive.
Is this intended?
>From what I've seen, there are no in-tree users who do not check
cpu_cache_has_invalidate_memregion(). However, IMO the better solution
would be if the function would perform this check, and not the callee.
Furthermore, arch/x86/mm/pat/set_memory.c also implements this function,
but actually does the feature check, and WARNs and returns -ENXIO if it
fails that check.
As part of this RFC, I'll attach a patch that provides a low-overhead fix.
Signed-off-by: Bence Csokas <bence.csokas@xxxxxxx>
---
Bence Csokas (1):
cache: Make cpu_cache_invalidate_memregion() error out if there are no handlers
lib/cache_maint.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-cci_enxio-f3d31d9acec7
Best regards,
--
Bence Csokas <bence.csokas@xxxxxxx>