From 3acb568516269ead26f9916f0d01c9ae553c590c Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Sat, 21 May 2016 06:43:55 -0700 Subject: [PATCH] dtrace: ensure pdata is large enough With the sudden (large) increase of SDT probe points, the previously statically defined default size for the kernel pdata block was not sufficient. The code has been modified to calculate the required size for the pdata block at runtime. This primarily affects sparc where the pdata also covers the memory block used for SDT trampolines. It is now dependent on the actual number of SDT probes in the kernel. This does not affect modules because they were already allocating the needed memory block at load time based on the actual number of probes. Orabug: 23004534 Signed-off-by: Kris Van Hees Acked-by: Nick Alcock --- arch/sparc/include/asm/dtrace_arch.h | 6 +++++- arch/x86/include/asm/dtrace_arch.h | 4 ++++ kernel/dtrace/dtrace_os.c | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/sparc/include/asm/dtrace_arch.h b/arch/sparc/include/asm/dtrace_arch.h index 729ca60423e8..68cf5478a671 100644 --- a/arch/sparc/include/asm/dtrace_arch.h +++ b/arch/sparc/include/asm/dtrace_arch.h @@ -5,6 +5,10 @@ typedef uint32_t asm_instr_t; -#define SDT_TRAMP_SIZE 11 +#define SDT_TRAMP_SIZE 11 +#define DTRACE_PDATA_SIZE 64 +#define DTRACE_PDATA_EXTRA (dtrace_sdt_nprobes * SDT_TRAMP_SIZE * \ + sizeof(asm_instr_t)) +#define DTRACE_PDATA_MAXSIZE (DTRACE_PDATA_SIZE + DTRACE_PDATA_EXTRA) #endif /* _SPARC_DTRACE_ARCH_H */ diff --git a/arch/x86/include/asm/dtrace_arch.h b/arch/x86/include/asm/dtrace_arch.h index 4806af6188ad..12165fae33c3 100644 --- a/arch/x86/include/asm/dtrace_arch.h +++ b/arch/x86/include/asm/dtrace_arch.h @@ -5,4 +5,8 @@ typedef uint8_t asm_instr_t; +#define DTRACE_PDATA_SIZE 64 +#define DTRACE_PDATA_EXTRA 0 +#define DTRACE_PDATA_MAXSIZE (DTRACE_PDATA_SIZE + DTRACE_PDATA_EXTRA) + #endif /* _X86_DTRACE_ARCH_H */ diff --git a/kernel/dtrace/dtrace_os.c b/kernel/dtrace/dtrace_os.c index ff94fd9b4420..48947b6deebc 100644 --- a/kernel/dtrace/dtrace_os.c +++ b/kernel/dtrace/dtrace_os.c @@ -31,8 +31,6 @@ /*---------------------------------------------------------------------------*\ (* OS SPECIFIC DTRACE SETUP *) \*---------------------------------------------------------------------------*/ -#define DTRACE_PDATA_MAXSIZE 2048 - struct module *dtrace_kmod = NULL; EXPORT_SYMBOL(dtrace_kmod); -- 2.50.1