Skip to contentSkip to conversation

x86/mm: Fix log overwrite in CPA check_conflict()

PATCH In review Khalid Ali 2 participants 3 messages Jun 19, 2025 – Jun 20, 2025

Subsystems (2)
lore
Share & tools
lore

Khalid Ali

author
#0 lore raw

PATCH 1/1 x86/mm: Fix log overwrite in CPA check_conflict()

From: Khalid Ali <[email protected]>

On certain configurations (e.g. custom builds), check_conflict() may produce a large number of warnings, flooding the kernel log and overwriting earlier messages.

Observed warning:

CPA protect Rodata RO: 0xffff888022a75000 - 0xffff888022a75fff

        PFN 22a75 req 8000000000000023 prevent 0000000000000002

Rate-limit these messages by replacing pr_warn() with pr_warn_ratelimited().

---
 arch/x86/mm/pat/set_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/pat/set_memory.c +1 -1
index 8834c76f91c9..bc5b62988b40 100644
@@ -608,7 +608,7 @@ static inline void check_conflict(int warnlvl, pgprot_t prot, pgprotval_t val,
 	if (warnlvl > cpa_warn_level || !conflicts(prot, val))
 		return;
 
-	pr_warn("CPA %8s %10s: 0x%016lx - 0x%016lx PFN %lx req %016llx prevent %016llx\n",
+	pr_warn_ratelimited("CPA %8s %10s: 0x%016lx - 0x%016lx PFN %lx req %016llx prevent %016llx\n",
 		lvltxt[warnlvl], txt, start, end, pfn, (unsigned long long)pgprot_val(prot),
 		(unsigned long long)val);
 }
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 10 lines · Khalid Ali

From: Khalid Ali <[email protected]>

On certain configurations (e.g. custom builds), check_conflict() may produce a large number of warnings, flooding the kernel log and overwriting earlier messages.

Observed warning:

CPA protect Rodata RO: 0xffff888022a75000 - 0xffff888022a75fff

        PFN 22a75 req 8000000000000023 prevent 0000000000000002

That's not good. Your system is sick, limiting the warns isn't making that better.

author
#2 lore raw
Quoted 6 lines
Quoted 6 lines

From: Khalid Ali <[email protected]>

On certain configurations (e.g. custom builds), check_conflict() may produce a large number of warnings, flooding the kernel log and overwriting earlier messages.

Quoted 7 lines
Quoted 4 lines

Observed warning:

CPA protect Rodata RO: 0xffff888022a75000 - 0xffff888022a75fff

        PFN 22a75 req 8000000000000023 prevent 0000000000000002

That's not good. Your system is sick, limiting the warns isn't making that better.

There is nothing wrong. It is just misconfiguration, however i don't see why
it is neccessary this warning to spam the dmesg log. Maybe it is better idea
to limit printing warning instead of warning for every page in a section (i.e Rodata in my case) would make sense. So by limiting logs in anyways is good.

There is also overhead by logging if that happens.

Thanks
Khalid Ali