From c3f1a13902c15f350d59335e99c8945e515a915c Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 15 Nov 2022 10:56:13 +0000 Subject: [PATCH] Retire broken GPROF support from the kernel The option is not even recognized and with that patched it does not compile. Even if it did work, it would be prohibitively expensive to use. Interested parties can use pmcstat or dtrace instead. --- sys/amd64/amd64/mp_machdep.c | 3 --- sys/arm/include/asm.h | 15 +++------------ sys/i386/i386/mp_machdep.c | 3 --- sys/kern/kern_clock.c | 22 ---------------------- sys/kern/link_elf.c | 11 ----------- sys/x86/x86/mp_x86.c | 3 --- 6 files changed, 3 insertions(+), 54 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 2ed3a57866a..f41e8dafcc8 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef GPROF -#include -#endif #include #include #include diff --git a/sys/arm/include/asm.h b/sys/arm/include/asm.h index b346f50ca21..72bf244c449 100644 --- a/sys/arm/include/asm.h +++ b/sys/arm/include/asm.h @@ -69,15 +69,6 @@ #define _ASM_TYPE_FUNCTION #function #define _ASM_TYPE_OBJECT #object -/* XXX Is this still the right prologue for profiling? */ -#ifdef GPROF -#define _PROF_PROLOGUE \ - mov ip, lr; \ - bl __mcount -#else -#define _PROF_PROLOGUE -#endif - /* * EENTRY()/EEND() mark "extra" entry/exit points from a function. * LEENTRY()/LEEND() are the same for local symbols. @@ -106,14 +97,14 @@ #define _ENTRY(x) .text; _ALIGN_TEXT; _EENTRY(x); _FNSTART #define _END(x) _LEND(x) -#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE +#define ENTRY(y) _ENTRY(_C_LABEL(y)); #define EENTRY(y) _EENTRY(_C_LABEL(y)); #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) #define EENTRY_NP(y) _EENTRY(_C_LABEL(y)) #define END(y) _END(_C_LABEL(y)) #define EEND(y) _EEND(_C_LABEL(y)) -#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE -#define ASLENTRY(y) _LENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE +#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); +#define ASLENTRY(y) _LENTRY(_ASM_LABEL(y)); #define ASEENTRY(y) _EENTRY(_ASM_LABEL(y)); #define ASLEENTRY(y) _LEENTRY(_ASM_LABEL(y)); #define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 98d71602706..9a8e82c5fc5 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -51,9 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include /* cngetc() */ #include -#ifdef GPROF -#include -#endif #include #include #include diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index f155d2da7e0..b8122b7d646 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -74,10 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef GPROF -#include -#endif - #ifdef HWPMC_HOOKS #include PMC_SOFT_DEFINE( , , clock, hard); @@ -775,10 +771,6 @@ void profclock(int cnt, int usermode, uintfptr_t pc) { struct thread *td; -#ifdef GPROF - struct gmonparam *g; - uintfptr_t i; -#endif td = curthread; if (usermode) { @@ -791,20 +783,6 @@ profclock(int cnt, int usermode, uintfptr_t pc) if (td->td_proc->p_flag & P_PROFIL) addupc_intr(td, pc, cnt); } -#ifdef GPROF - else { - /* - * Kernel statistics are just like addupc_intr, only easier. - */ - g = &_gmonparam; - if (g->state == GMON_PROF_ON && pc >= g->lowpc) { - i = PC_TO_I(g, pc); - if (i < g->textsize) { - KCOUNT(g, i) += cnt; - } - } - } -#endif #ifdef HWPMC_HOOKS if (td->td_intr_frame != NULL) PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame); diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 2c86c99452f..5f0649d7540 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef GPROF -#include -#endif #include #include #include @@ -1180,14 +1177,6 @@ link_elf_load_file(linker_class_t cls, const char* filename, segs[i]->p_memsz - segs[i]->p_filesz); } -#ifdef GPROF - /* Update profiling information with the new text segment. */ - mtx_lock(&Giant); - kmupetext((uintfptr_t)(mapbase + segs[0]->p_vaddr - base_vaddr + - segs[0]->p_memsz)); - mtx_unlock(&Giant); -#endif - ef->dynamic = (Elf_Dyn *) (mapbase + phdyn->p_vaddr - base_vaddr); lf->address = ef->address; diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 61b08dd1ee9..da5c7f52f95 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -47,9 +47,6 @@ __FBSDID("$FreeBSD$"); #include /* cngetc() */ #include #include -#ifdef GPROF -#include -#endif #include #include #include