[DTrace-devel] [PATCH] Pass dctx as a const struct to BPF functions.

Eugene Loh eugene.loh at oracle.com
Thu Jan 27 20:49:54 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 1/26/22 11:26 AM, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   bpf/get_bvar.c    | 4 ++--
>   bpf/probe_error.c | 6 +++---
>   bpf/probe_error.h | 4 ++--
>   bpf/speculation.c | 4 ++--
>   4 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/bpf/get_bvar.c b/bpf/get_bvar.c
> index 7c98e166..67346014 100644
> --- a/bpf/get_bvar.c
> +++ b/bpf/get_bvar.c
> @@ -1,6 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /*
> - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
>    */
>   #include <linux/bpf.h>
>   #include <stddef.h>
> @@ -33,7 +33,7 @@ extern uint64_t BOOTTM;
>   		-1; \
>   	})
>   
> -noinline uint64_t dt_get_bvar(dt_dctx_t *dctx, uint32_t id)
> +noinline uint64_t dt_get_bvar(const dt_dctx_t *dctx, uint32_t id)
>   {
>   	dt_mstate_t	*mst = dctx->mst;
>   
> diff --git a/bpf/probe_error.c b/bpf/probe_error.c
> index 138ce79c..5f54533d 100644
> --- a/bpf/probe_error.c
> +++ b/bpf/probe_error.c
> @@ -1,6 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /*
> - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
>    */
>   #include <linux/bpf.h>
>   #include <stdint.h>
> @@ -11,7 +11,7 @@
>   # define noinline	__attribute__((noinline))
>   #endif
>   
> -extern int64_t dt_error(dt_dctx_t *dctx);
> +extern int64_t dt_error(const dt_dctx_t *dctx);
>   
>   /*
>    * DTrace ERROR probes provide 6 arguments:
> @@ -22,7 +22,7 @@ extern int64_t dt_error(dt_dctx_t *dctx);
>    *	arg4 = fault type
>    *	arg5 = fault-specific value (usually address being accessed or 0)
>    */
> -noinline void dt_probe_error(dt_dctx_t *dctx, uint64_t pc, uint64_t fault,
> +noinline void dt_probe_error(const dt_dctx_t *dctx, uint64_t pc, uint64_t fault,
>   			     uint64_t illval)
>   {
>   	dt_mstate_t	*mst = dctx->mst;
> diff --git a/bpf/probe_error.h b/bpf/probe_error.h
> index d9e5e985..3dda932e 100644
> --- a/bpf/probe_error.h
> +++ b/bpf/probe_error.h
> @@ -1,6 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /*
> - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
>    */
>   #ifndef BPF_PROBE_ERRROR_H
>   #define BPF_PROBE_ERRROR_H
> @@ -8,7 +8,7 @@
>   #include <stdint.h>
>   #include <dt_dctx.h>
>   
> -extern void dt_probe_error(dt_dctx_t *dctx, uint64_t pc, uint64_t fault,
> +extern void dt_probe_error(const dt_dctx_t *dctx, uint64_t pc, uint64_t fault,
>   			   uint64_t illval);
>   
>   #endif /* BPF_PROBE_ERRROR_H */
> diff --git a/bpf/speculation.c b/bpf/speculation.c
> index a5134988..90433753 100644
> --- a/bpf/speculation.c
> +++ b/bpf/speculation.c
> @@ -1,6 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /*
> - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
>    */
>   #include <linux/bpf.h>
>   #include <stdint.h>
> @@ -111,7 +111,7 @@ dt_speculation_speculate(uint32_t id)
>    */
>   
>   noinline int32_t
> -dt_speculation_set_drainable(dt_dctx_t *dctx, uint32_t id)
> +dt_speculation_set_drainable(const dt_dctx_t *dctx, uint32_t id)
>   {
>   	dt_bpf_specs_t *spec;
>   



More information about the DTrace-devel mailing list