Message ID | 20190325001425.29483-9-jniethe5@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | Improve usability of skiboot traces | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (b392d785eb49630b9f00fef8d17944ed82b2c1fe) |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot | success | Test snowpatch/job/snowpatch-skiboot on branch master |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco | fail | Signed-off-by missing |
On Mon, Mar 25, 2019 at 11:18 AM Jordan Niethe <jniethe5@gmail.com> wrote: > > Every property in the device tree under /ibm,opal/firmware/exports has a > sysfs node created in /firmware/opal/exports. Add properties with the > physical address and size for each trace buffer so they are exported. > --- > core/test/run-trace.c | 1 + > core/trace.c | 10 ++++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/core/test/run-trace.c b/core/test/run-trace.c > index 971b967a5719..6cb9a582078d 100644 > --- a/core/test/run-trace.c > +++ b/core/test/run-trace.c > @@ -269,6 +269,7 @@ int main(void) > unsigned int i, j; > > opal_node = dt_new_root("opal"); > + dt_new(dt_new(opal_node, "firmware"), "exports"); > for (i = 0; i < CPUS; i++) { > fake_cpus[i].server_no = i; > fake_cpus[i].is_secondary = (i & 0x1); > diff --git a/core/trace.c b/core/trace.c > index b33a5bcf2318..dfb5cfad045c 100644 > --- a/core/trace.c > +++ b/core/trace.c > @@ -19,6 +19,7 @@ > #include <lock.h> > #include <string.h> > #include <stdlib.h> > +#include <inttypes.h> > #include <cpu.h> > #include <device.h> > #include <libfdt.h> > @@ -163,12 +164,21 @@ static void trace_add_dt_props(void) > { > unsigned int i; > u64 *prop, tmask; > + struct dt_node *exports; > + char tname[256]; > > prop = malloc(sizeof(u64) * 2 * debug_descriptor.num_traces); > > + exports = dt_find_by_path(opal_node, "firmware/exports"); > for (i = 0; i < debug_descriptor.num_traces; i++) { > prop[i * 2] = cpu_to_fdt64(debug_descriptor.trace_phys[i]); > prop[i * 2 + 1] = cpu_to_fdt64(debug_descriptor.trace_size[i]); > + > + snprintf(tname, sizeof(tname), "trace-%x-%"PRIx64, > + debug_descriptor.trace_cpu[i], > + debug_descriptor.trace_phys[i]); > + dt_add_property_u64s(exports, tname, debug_descriptor.trace_phys[i], > + debug_descriptor.trace_size[i]); This is going to be a bit spammy especially on the bigger systems. A dual socket P9 can have up to 44 cores so we're going to have a fair amount of junk in there. It would be nice if we could have some kind of categorisation, (e.g. subnodes that turn into subdirectories of exports/), but that would require a kernel change. Maybe a nvram option to flatten the exports directory would do the trick? Stewart, what do you think? Code looks fine though. > } > > dt_add_property(opal_node, "ibm,opal-traces", > -- > 2.20.1 > > _______________________________________________ > Skiboot mailing list > Skiboot@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/skiboot
diff --git a/core/test/run-trace.c b/core/test/run-trace.c index 971b967a5719..6cb9a582078d 100644 --- a/core/test/run-trace.c +++ b/core/test/run-trace.c @@ -269,6 +269,7 @@ int main(void) unsigned int i, j; opal_node = dt_new_root("opal"); + dt_new(dt_new(opal_node, "firmware"), "exports"); for (i = 0; i < CPUS; i++) { fake_cpus[i].server_no = i; fake_cpus[i].is_secondary = (i & 0x1); diff --git a/core/trace.c b/core/trace.c index b33a5bcf2318..dfb5cfad045c 100644 --- a/core/trace.c +++ b/core/trace.c @@ -19,6 +19,7 @@ #include <lock.h> #include <string.h> #include <stdlib.h> +#include <inttypes.h> #include <cpu.h> #include <device.h> #include <libfdt.h> @@ -163,12 +164,21 @@ static void trace_add_dt_props(void) { unsigned int i; u64 *prop, tmask; + struct dt_node *exports; + char tname[256]; prop = malloc(sizeof(u64) * 2 * debug_descriptor.num_traces); + exports = dt_find_by_path(opal_node, "firmware/exports"); for (i = 0; i < debug_descriptor.num_traces; i++) { prop[i * 2] = cpu_to_fdt64(debug_descriptor.trace_phys[i]); prop[i * 2 + 1] = cpu_to_fdt64(debug_descriptor.trace_size[i]); + + snprintf(tname, sizeof(tname), "trace-%x-%"PRIx64, + debug_descriptor.trace_cpu[i], + debug_descriptor.trace_phys[i]); + dt_add_property_u64s(exports, tname, debug_descriptor.trace_phys[i], + debug_descriptor.trace_size[i]); } dt_add_property(opal_node, "ibm,opal-traces",