|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 4/8] lib/ukdebug: key-value static storage for tracing
This patch looks good.
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>
On 5/30/19 2:44 AM, Yuri Volchkov wrote:
> One more 'special' stripable section. Will contain strings in format
> key = value. Currently, only the tracebuffer format version is stored
> there.
>
> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
> ---
> lib/ukdebug/Makefile.uk | 2 +-
> lib/ukdebug/extra.ld | 3 +++
> lib/ukdebug/trace.c | 18 ++++++++++++++++++
> 3 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ukdebug/Makefile.uk b/lib/ukdebug/Makefile.uk
> index e2e6fd2a..663ac6de 100644
> --- a/lib/ukdebug/Makefile.uk
> +++ b/lib/ukdebug/Makefile.uk
> @@ -11,4 +11,4 @@ LIBUKDEBUG_SRCS-y += $(LIBUKDEBUG_BASE)/hexdump.c
> LIBUKDEBUG_SRCS-$(CONFIG_LIBUKDEBUG_TRACEPOINTS) +=
> $(LIBUKDEBUG_BASE)/trace.c
>
> EXTRA_LD_SCRIPT-$(CONFIG_LIBVFSCORE) += $(LIBUKDEBUG_BASE)/extra.ld
> -STRIP_SECTIONS_FLAGS-$(CONFIG_LIBUKDEBUG_TRACEPOINTS) += -R
> .uk_tracepoints_list
> +STRIP_SECTIONS_FLAGS-$(CONFIG_LIBUKDEBUG_TRACEPOINTS) += -R
> .uk_tracepoints_list -R .uk_trace_keyvals
> diff --git a/lib/ukdebug/extra.ld b/lib/ukdebug/extra.ld
> index 43154f9d..bb0b36b8 100644
> --- a/lib/ukdebug/extra.ld
> +++ b/lib/ukdebug/extra.ld
> @@ -5,6 +5,9 @@ SECTIONS
> KEEP (*(.uk_tracepoints_list));
> uk_tracepoints_end = .;
> }
> + .uk_trace_keyvals : {
> + KEEP (*(.uk_trace_keyvals));
> + }
> }
>
> /* We do not want these section to be in the final image, they are
> diff --git a/lib/ukdebug/trace.c b/lib/ukdebug/trace.c
> index f3318557..91cc2387 100644
> --- a/lib/ukdebug/trace.c
> +++ b/lib/ukdebug/trace.c
> @@ -43,3 +43,21 @@ char uk_trace_buffer[UK_TRACE_BUFFER_SIZE];
>
> size_t uk_trace_buffer_free = UK_TRACE_BUFFER_SIZE;
> char *uk_trace_buffer_writep = uk_trace_buffer;
> +
> +
> +/* Store a string in format "key = value" in the section
> + * .uk_trace_keyvals. This can be anything what you want trace.py
> + * script to know about, and what you do not want to consume any space
> + * in runtime memory.
> + *
> + * This section will be stripped at the final states of building, but
> + * the key-value data can be easily extracted by:
> + *
> + * $ readelf -p .uk_trace_keyvals <your_image.gdb>
> + */
> +#define TRACE_DEFINE_KEY(key, val) \
> + __attribute((__section__(".uk_trace_keyvals"))) \
> + static const char key[] __used = \
> + #key " = " #val
> +
> +TRACE_DEFINE_KEY(format_version, 1);
>
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |