From ab259b19bd8105d779ec79a0cc00cf7f1feaf434 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 9 Apr 2025 10:35:56 +0300 Subject: [PATCH] amd64: also limit printings of EFIRT page faults PR: 285797 (cherry picked from commit 99332926f6fc6d1e4bb850a2b26744b948b14014) --- sys/amd64/amd64/trap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 692491ecfc5..1877aedee17 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -895,8 +895,13 @@ after_vmfault: if (td->td_intr_nesting_level == 0 && curpcb->pcb_onfault != NULL) { if ((td->td_pflags2 & TDP2_EFIRT) != 0) { - trap_diag(frame, eva); - printf("EFI RT page fault\n"); + u_long cnt = atomic_fetchadd_long(&cnt_efirt_faults, 1); + + if ((print_efirt_faults == 1 && cnt == 1) || + print_efirt_faults == 2) { + trap_diag(frame, eva); + printf("EFI RT page fault\n"); + } } frame->tf_rip = (long)curpcb->pcb_onfault; return (0);