From 0866c61c7f5fb7bc098b1894a868b29da4d29c8e Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 23 May 2016 22:27:40 +0100 Subject: [PATCH] dtrace: migrate pdata size assertion out of generic code Only arch-specific code cares about this invariant, and it may not exist on other future arches, so duplicate it on all arches that care. Signed-off-by: Nick Alcock Acked-by: Kris Van Hees --- dtrace/dtrace_dev.c | 6 ------ dtrace/include/x86_64/dtrace/mod_arch.h | 2 ++ dtrace/sdt_sparc64.c | 6 ++++++ dtrace/sdt_x86_64.c | 6 ++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dtrace/dtrace_dev.c b/dtrace/dtrace_dev.c index 8d79da22d46b..cce388c389e0 100644 --- a/dtrace/dtrace_dev.c +++ b/dtrace/dtrace_dev.c @@ -1385,12 +1385,6 @@ int dtrace_dev_init(void) int rc = 0; struct cred *cred; - /* - * Sanity check to ensure that the memory allocated by the kernel is - * sufficient for what PDATA needs. - */ - ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); - /* * Register the device for the DTrace core. */ diff --git a/dtrace/include/x86_64/dtrace/mod_arch.h b/dtrace/include/x86_64/dtrace/mod_arch.h index 5db59861d2b2..583baca0d65f 100644 --- a/dtrace/include/x86_64/dtrace/mod_arch.h +++ b/dtrace/include/x86_64/dtrace/mod_arch.h @@ -25,6 +25,8 @@ * Use is subject to license terms. */ +#include + /* * Structure to hold DTrace specific information about modules (including the * core kernel module). Note that each module (and the main kernel) already diff --git a/dtrace/sdt_sparc64.c b/dtrace/sdt_sparc64.c index 8fe02a0b08b6..a1f77431d4b6 100644 --- a/dtrace/sdt_sparc64.c +++ b/dtrace/sdt_sparc64.c @@ -178,6 +178,12 @@ void sdt_disable_arch(sdt_probe_t *sdp, dtrace_id_t id, void *arg) int sdt_dev_init_arch(void) { + /* + * Sanity check to ensure that the memory allocated by the kernel is + * sufficient for what PDATA needs. + */ + ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); + return 0; } diff --git a/dtrace/sdt_x86_64.c b/dtrace/sdt_x86_64.c index 1faac5b601da..ac0226c7079d 100644 --- a/dtrace/sdt_x86_64.c +++ b/dtrace/sdt_x86_64.c @@ -116,6 +116,12 @@ uint64_t sdt_getarg(void *arg, dtrace_id_t id, void *parg, int argno, int sdt_dev_init_arch(void) { + /* + * Sanity check to ensure that the memory allocated by the kernel is + * sufficient for what PDATA needs. + */ + ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); + return dtrace_invop_add(sdt_invop); } -- 2.50.1