[Skiboot] [PATCH 07/15] core/trace: Add cpu number to debug descriptor

Oliver oohall at gmail.com
Mon Mar 25 12:28:51 AEDT 2019


On Mon, Mar 25, 2019 at 11:17 AM Jordan Niethe <jniethe5 at gmail.com> wrote:
>
> The names given to the trace buffers when exported to sysfs should give
> an indication of what cpu they are associated with. Add the cpu number
> to the debug descriptor to make it easy to access.

Is this actually making it easier to access or is it to give it a unique name?

Reviewed-by: Oliver O'Halloran <oohall at gmail.com>

> ---
>  core/test/run-trace.c      | 2 +-
>  core/trace.c               | 7 ++++---
>  include/debug_descriptor.h | 1 +
>  3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/core/test/run-trace.c b/core/test/run-trace.c
> index 1455394da0e6..971b967a5719 100644
> --- a/core/test/run-trace.c
> +++ b/core/test/run-trace.c
> @@ -274,8 +274,8 @@ int main(void)
>                 fake_cpus[i].is_secondary = (i & 0x1);
>                 fake_cpus[i].primary = &fake_cpus[i & ~0x1];
>         }
> -       init_trace_buffers();
>         my_fake_cpu = &fake_cpus[0];
> +       init_trace_buffers();
>
>         for (i = 0; i < CPUS; i++) {
>                 assert(trace_empty(&fake_cpus[i].trace->tb));
> diff --git a/core/trace.c b/core/trace.c
> index 5580eb13a8bd..b33a5bcf2318 100644
> --- a/core/trace.c
> +++ b/core/trace.c
> @@ -179,7 +179,7 @@ static void trace_add_dt_props(void)
>         dt_add_property_u64(opal_node, "ibm,opal-trace-mask", tmask);
>  }
>
> -static void trace_add_desc(struct trace_info *t, uint64_t size)
> +static void trace_add_desc(struct trace_info *t, uint64_t size, uint16_t cpu)
>  {
>         unsigned int i = debug_descriptor.num_traces;
>
> @@ -192,6 +192,7 @@ static void trace_add_desc(struct trace_info *t, uint64_t size)
>         debug_descriptor.trace_phys[i] = (uint64_t)t;
>         debug_descriptor.trace_tce[i] = 0; /* populated later */
>         debug_descriptor.trace_size[i] = size;
> +       debug_descriptor.trace_cpu[i] = cpu;

It might be a good idea to continue using the 'pir' naming convention
rather than 'cpu' for the sake of consistency. I'm not fussed though.

Reviewed-by: Oliver O'Halloran <oohall at gmail.com>

>  }
>
>  /* Allocate trace buffers once we know memory topology */
> @@ -202,7 +203,7 @@ void init_trace_buffers(void)
>         uint64_t size;
>
>         /* Boot the boot trace in the debug descriptor */
> -       trace_add_desc(any, sizeof(boot_tracebuf));
> +       trace_add_desc(any, sizeof(boot_tracebuf), this_cpu()->pir);
>
>         /* Allocate a trace buffer for each primary cpu. */
>         for_each_cpu(t) {
> @@ -217,7 +218,7 @@ void init_trace_buffers(void)
>                         memset(t->trace, 0, size);
>                         init_lock(&t->trace->lock);
>                         t->trace->tb.max_size = cpu_to_be32(MAX_SIZE);
> -                       trace_add_desc(any, size);
> +                       trace_add_desc(any, size, t->pir);
>                 } else
>                         prerror("TRACE: cpu 0x%x allocation failed\n", t->pir);
>         }
> diff --git a/include/debug_descriptor.h b/include/debug_descriptor.h
> index 619f49374385..162408e0ce9b 100644
> --- a/include/debug_descriptor.h
> +++ b/include/debug_descriptor.h
> @@ -44,6 +44,7 @@ struct debug_descriptor {
>         u64     trace_phys[DEBUG_DESC_MAX_TRACES];
>         u32     trace_size[DEBUG_DESC_MAX_TRACES];
>         u32     trace_tce[DEBUG_DESC_MAX_TRACES];
> +       u16     trace_cpu[DEBUG_DESC_MAX_TRACES];
>  };
>  extern struct debug_descriptor debug_descriptor;
>
> --
> 2.20.1
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list