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.
This commit is contained in:
Mateusz Guzik 2022-11-15 10:56:13 +00:00
parent a72edfea57
commit c3f1a13902
6 changed files with 3 additions and 54 deletions

View file

@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/cpuset.h>
#include <sys/domainset.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>

View file

@ -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))

View file

@ -51,9 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/cons.h> /* cngetc() */
#include <sys/cpuset.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>

View file

@ -74,10 +74,6 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/timetc.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
#ifdef HWPMC_HOOKS
#include <sys/pmckern.h>
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);

View file

@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@ -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;

View file

@ -47,9 +47,6 @@ __FBSDID("$FreeBSD$");
#include <sys/cons.h> /* cngetc() */
#include <sys/cpuset.h>
#include <sys/csan.h>
#ifdef GPROF
#include <sys/gmon.h>
#endif
#include <sys/interrupt.h>
#include <sys/kdb.h>
#include <sys/kernel.h>