tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] Re: Profiling broken on x86?



On Thu, Jul 07, 2022 at 12:53:33AM +0000, Emmanuel Dreyfus wrote:
> This is NetBSD 9.2_STABLE on amd64. If the kernel is built with
> profiling (either config -p, or makeoptions PROF="-pg" and options
> GPROF), it crashes at boot with this panic:
> 
> panic: patchfunc: sizes do not match (from=0xffffffff80f0d720)

Here is a workaround, but perhaps the concept of patching the 
binary is to be questioned. Is it just to save the performance
of a boolean test?

--- sys/arch/x86/x86/cpu.c      2 Aug 2020 07:33:38 -0000       1.171.2.3
+++ sys/arch/x86/x86/cpu.c      8 Jul 2022 09:08:04 -0000
@@ -68,8 +68,9 @@
 #include "opt_mpbios.h"                /* for MPDEBUG */
 #include "opt_mtrr.h"
 #include "opt_multiprocessor.h"
 #include "opt_svs.h"
+#include "opt_gprof.h"
 
 #include "lapic.h"
 #include "ioapic.h"
 
@@ -700,9 +701,9 @@
        struct cpu_info *ci;
        kcpuset_t *cpus;
        u_long i;
 
-#ifndef XEN
+#if !defined(XEN) && !defined(GPROF)
        /* Now that we know the number of CPUs, patch the text segment. */
        x86_patch(false);
 #endif
 


-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index