[DTrace-devel] [PATCH 2/5] slight code refactoring to eliminate gratuitous differences between providers
Kris Van Hees
kris.van.hees at oracle.com
Fri Jun 12 18:03:57 PDT 2020
Comments below...
On Thu, Jun 11, 2020 at 05:29:38PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
> libdtrace/dt_prov_dtrace.c | 3 +--
> libdtrace/dt_prov_fbt.c | 2 +-
> libdtrace/dt_prov_sdt.c | 2 +-
> libdtrace/dt_prov_syscall.c | 26 +++++++++++++-------------
> 4 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
> index 4f3ad4eb..507aa60f 100644
> --- a/libdtrace/dt_prov_dtrace.c
> +++ b/libdtrace/dt_prov_dtrace.c
> @@ -36,7 +36,6 @@ static int populate(dtrace_hdl_t *dtp)
> dt_provider_t *prv;
> int n = 0;
>
> -
Thanks.
> prv = dt_provider_create(dtp, prvname, &dt_dtrace, &pattr);
> if (prv == NULL)
> return 0;
> @@ -60,7 +59,7 @@ static int populate(dtrace_hdl_t *dtp)
> * int dt_dtrace(dt_pt_regs *regs)
> *
> * The trampoline will populate a dt_bpf_context struct and then call the
> - * function that implements tha compiled D clause. It returns the value that
> + * function that implements the compiled D clause. It returns the value that
Thanks.
> * it gets back from that function.
> */
> static void trampoline(dt_pcb_t *pcb)
> diff --git a/libdtrace/dt_prov_fbt.c b/libdtrace/dt_prov_fbt.c
> index 0efed358..2296fb41 100644
> --- a/libdtrace/dt_prov_fbt.c
> +++ b/libdtrace/dt_prov_fbt.c
> @@ -156,7 +156,7 @@ static int populate(dtrace_hdl_t *dtp)
> * int dt_fbt(dt_pt_regs *regs)
> *
> * The trampoline will populate a dt_bpf_context struct and then call the
> - * function that implements tha compiled D clause. It returns the value that
> + * function that implements the compiled D clause. It returns the value that
Thanks.
> * it gets back from that function.
> */
> static void trampoline(dt_pcb_t *pcb)
> diff --git a/libdtrace/dt_prov_sdt.c b/libdtrace/dt_prov_sdt.c
> index 584291c8..380a1ef8 100644
> --- a/libdtrace/dt_prov_sdt.c
> +++ b/libdtrace/dt_prov_sdt.c
> @@ -307,7 +307,7 @@ static void trampoline(dt_pcb_t *pcb)
> dt_irlist_t *dlp = &pcb->pcb_ir;
> struct bpf_insn instr;
> uint_t lbl_exit = dt_irlist_label(dlp);
> - dt_ident_t *idp = dt_dlib_get_var(pcb->pcb_hdl, "EPID");
> + dt_ident_t *idp;
Thanks.
>
> #define DCTX_FP(off) (-(ushort_t)DCTX_SIZE + (ushort_t)(off))
>
> diff --git a/libdtrace/dt_prov_syscall.c b/libdtrace/dt_prov_syscall.c
> index 16b18aa2..8f671f38 100644
> --- a/libdtrace/dt_prov_syscall.c
> +++ b/libdtrace/dt_prov_syscall.c
> @@ -40,19 +40,6 @@ static const char modname[] = "vmlinux";
>
> #define SYSCALLSFS EVENTSFS "syscalls/"
>
> -/*
> - * We need to skip over an extra field: __syscall_nr.
> - */
> -#define SKIP_EXTRA_FIELDS 1
> -
> -static const dtrace_pattr_t pattr = {
> -{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> -{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> -};
> -
> struct syscall_data {
> dt_pt_regs *regs;
> long syscall_nr;
> @@ -67,6 +54,19 @@ struct syscall_data {
> #define ENTRY_PREFIX "sys_enter_"
> #define EXIT_PREFIX "sys_exit_"
>
> +/*
> + * We need to skip over an extra field: __syscall_nr.
> + */
> +#define SKIP_EXTRA_FIELDS 1
> +
> +static const dtrace_pattr_t pattr = {
> +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> +};
> +
> /* Scan the PROBE_LIST file and add probes for any syscalls events. */
> static int populate(dtrace_hdl_t *dtp)
> {
I do not understand the rationale for the change. I can think of some
re-ordering that could be done, but not what you propose here, Cam you
explain why you chose to to this?
More information about the DTrace-devel
mailing list