|
|
085f43 |
From 1d4357ba0e0e1ec8267c32855aec5fe5abbcfec8 Mon Sep 17 00:00:00 2001
|
|
|
085f43 |
From: Valentin Schneider <valentin.schneider@arm.com>
|
|
|
085f43 |
Date: Thu, 3 Sep 2020 21:28:47 +0100
|
|
|
085f43 |
Subject: [PATCH 3/3] extensions/trace: Rename ring_buffer to trace_buffer
|
|
|
085f43 |
|
|
|
085f43 |
This renaming is present from Linux v5.6 upwards, and was introduced by
|
|
|
085f43 |
commit:
|
|
|
085f43 |
|
|
|
085f43 |
13292494379f ("tracing: Make struct ring_buffer less ambiguous")
|
|
|
085f43 |
|
|
|
085f43 |
Rename the internal references from ring_buffer to trace_buffer. Backwards
|
|
|
085f43 |
compatibility with older kernels is provided by checking whether struct
|
|
|
085f43 |
trace_buffer has a buffer field of type struct ring buffer - should that
|
|
|
085f43 |
not be the case, the newer naming scheme is used instead.
|
|
|
085f43 |
|
|
|
085f43 |
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
|
|
|
085f43 |
---
|
|
|
085f43 |
trace.c | 50 +++++++++++++++++++++++++++++---------------------
|
|
|
085f43 |
1 file changed, 29 insertions(+), 21 deletions(-)
|
|
|
085f43 |
|
|
|
085f43 |
diff --git a/trace.c b/trace.c
|
|
|
085f43 |
index 2cea5b2d650a..c33907f98b00 100644
|
|
|
085f43 |
--- a/trace.c
|
|
|
085f43 |
+++ b/trace.c
|
|
|
085f43 |
@@ -57,10 +57,10 @@ static int koffset(array_buffer, buffer);
|
|
|
085f43 |
static int koffset(trace_array, buffer);
|
|
|
085f43 |
static int koffset(tracer, name);
|
|
|
085f43 |
|
|
|
085f43 |
-static int koffset(ring_buffer, pages);
|
|
|
085f43 |
-static int koffset(ring_buffer, flags);
|
|
|
085f43 |
-static int koffset(ring_buffer, cpus);
|
|
|
085f43 |
-static int koffset(ring_buffer, buffers);
|
|
|
085f43 |
+static int koffset(trace_buffer, pages);
|
|
|
085f43 |
+static int koffset(trace_buffer, flags);
|
|
|
085f43 |
+static int koffset(trace_buffer, cpus);
|
|
|
085f43 |
+static int koffset(trace_buffer, buffers);
|
|
|
085f43 |
|
|
|
085f43 |
static int koffset(ring_buffer_per_cpu, cpu);
|
|
|
085f43 |
static int koffset(ring_buffer_per_cpu, pages);
|
|
|
085f43 |
@@ -119,7 +119,7 @@ struct trace_instance {
|
|
|
085f43 |
char name[NAME_MAX + 1];
|
|
|
085f43 |
ulong array_buffer;
|
|
|
085f43 |
ulong max_buffer;
|
|
|
085f43 |
- ulong ring_buffer;
|
|
|
085f43 |
+ ulong trace_buffer;
|
|
|
085f43 |
unsigned pages;
|
|
|
085f43 |
struct ring_buffer_per_cpu *buffers;
|
|
|
085f43 |
|
|
|
085f43 |
@@ -225,11 +225,19 @@ static int init_offsets(void)
|
|
|
085f43 |
else if (kernel_symbol_exists("ring_buffer_read"))
|
|
|
085f43 |
gdb_set_crash_scope(symbol_value("ring_buffer_read"), "ring_buffer_read");
|
|
|
085f43 |
|
|
|
085f43 |
- if (!per_cpu_buffer_sizes)
|
|
|
085f43 |
- init_offset(ring_buffer, pages);
|
|
|
085f43 |
- init_offset(ring_buffer, flags);
|
|
|
085f43 |
- init_offset(ring_buffer, cpus);
|
|
|
085f43 |
- init_offset(ring_buffer, buffers);
|
|
|
085f43 |
+ if (STREQ(MEMBER_TYPE_NAME("trace_buffer", "buffer"), "ring_buffer")) {
|
|
|
085f43 |
+ if (!per_cpu_buffer_sizes)
|
|
|
085f43 |
+ init_offset_alternative(trace_buffer, pages, ring_buffer, pages);
|
|
|
085f43 |
+ init_offset_alternative(trace_buffer, flags, ring_buffer, flags);
|
|
|
085f43 |
+ init_offset_alternative(trace_buffer, cpus, ring_buffer, cpus);
|
|
|
085f43 |
+ init_offset_alternative(trace_buffer, buffers, ring_buffer, buffers);
|
|
|
085f43 |
+ } else {
|
|
|
085f43 |
+ if (!per_cpu_buffer_sizes)
|
|
|
085f43 |
+ init_offset(trace_buffer, pages);
|
|
|
085f43 |
+ init_offset(trace_buffer, flags);
|
|
|
085f43 |
+ init_offset(trace_buffer, cpus);
|
|
|
085f43 |
+ init_offset(trace_buffer, buffers);
|
|
|
085f43 |
+ }
|
|
|
085f43 |
|
|
|
085f43 |
if (MEMBER_SIZE("ring_buffer_per_cpu", "pages") == sizeof(ulong)) {
|
|
|
085f43 |
lockless_ring_buffer = 1;
|
|
|
085f43 |
@@ -287,10 +295,10 @@ static void print_offsets(void)
|
|
|
085f43 |
print_offset(trace_array, buffer);
|
|
|
085f43 |
print_offset(tracer, name);
|
|
|
085f43 |
|
|
|
085f43 |
- print_offset(ring_buffer, pages);
|
|
|
085f43 |
- print_offset(ring_buffer, flags);
|
|
|
085f43 |
- print_offset(ring_buffer, cpus);
|
|
|
085f43 |
- print_offset(ring_buffer, buffers);
|
|
|
085f43 |
+ print_offset(trace_buffer, pages);
|
|
|
085f43 |
+ print_offset(trace_buffer, flags);
|
|
|
085f43 |
+ print_offset(trace_buffer, cpus);
|
|
|
085f43 |
+ print_offset(trace_buffer, buffers);
|
|
|
085f43 |
|
|
|
085f43 |
print_offset(ring_buffer_per_cpu, cpu);
|
|
|
085f43 |
print_offset(ring_buffer_per_cpu, pages);
|
|
|
085f43 |
@@ -445,12 +453,12 @@ static void ftrace_destroy_buffers(struct ring_buffer_per_cpu *buffers)
|
|
|
085f43 |
}
|
|
|
085f43 |
|
|
|
085f43 |
static int ftrace_init_buffers(struct ring_buffer_per_cpu *buffers,
|
|
|
085f43 |
- ulong ring_buffer, unsigned pages)
|
|
|
085f43 |
+ ulong trace_buffer, unsigned pages)
|
|
|
085f43 |
{
|
|
|
085f43 |
int i;
|
|
|
085f43 |
ulong buffers_array;
|
|
|
085f43 |
|
|
|
085f43 |
- read_value(buffers_array, ring_buffer, ring_buffer, buffers);
|
|
|
085f43 |
+ read_value(buffers_array, trace_buffer, trace_buffer, buffers);
|
|
|
085f43 |
|
|
|
085f43 |
for (i = 0; i < nr_cpu_ids; i++) {
|
|
|
085f43 |
if (!readmem(buffers_array + sizeof(ulong) * i, KVADDR,
|
|
|
085f43 |
@@ -505,7 +513,7 @@ static int ftrace_init_trace(struct trace_instance *ti, ulong instance_addr)
|
|
|
085f43 |
if (array_buffer_available) {
|
|
|
085f43 |
ti->array_buffer = instance_addr +
|
|
|
085f43 |
koffset(trace_array, array_buffer);
|
|
|
085f43 |
- read_value(ti->ring_buffer, ti->array_buffer,
|
|
|
085f43 |
+ read_value(ti->trace_buffer, ti->array_buffer,
|
|
|
085f43 |
array_buffer, buffer);
|
|
|
085f43 |
|
|
|
085f43 |
if (max_buffer_available) {
|
|
|
085f43 |
@@ -515,19 +523,19 @@ static int ftrace_init_trace(struct trace_instance *ti, ulong instance_addr)
|
|
|
085f43 |
array_buffer, buffer);
|
|
|
085f43 |
}
|
|
|
085f43 |
} else {
|
|
|
085f43 |
- read_value(ti->ring_buffer, instance_addr, trace_array, buffer);
|
|
|
085f43 |
- read_value(ti->pages, ti->ring_buffer, ring_buffer, pages);
|
|
|
085f43 |
+ read_value(ti->trace_buffer, instance_addr, trace_array, buffer);
|
|
|
085f43 |
+ read_value(ti->pages, ti->trace_buffer, trace_buffer, pages);
|
|
|
085f43 |
|
|
|
085f43 |
read_value(ti->max_tr_ring_buffer, max_tr_trace, trace_array, buffer);
|
|
|
085f43 |
if (ti->max_tr_ring_buffer)
|
|
|
085f43 |
- read_value(ti->max_tr_pages, ti->max_tr_ring_buffer, ring_buffer, pages);
|
|
|
085f43 |
+ read_value(ti->max_tr_pages, ti->max_tr_ring_buffer, trace_buffer, pages);
|
|
|
085f43 |
}
|
|
|
085f43 |
|
|
|
085f43 |
ti->buffers = calloc(sizeof(*ti->buffers), nr_cpu_ids);
|
|
|
085f43 |
if (ti->buffers == NULL)
|
|
|
085f43 |
goto out_fail;
|
|
|
085f43 |
|
|
|
085f43 |
- if (ftrace_init_buffers(ti->buffers, ti->ring_buffer,
|
|
|
085f43 |
+ if (ftrace_init_buffers(ti->buffers, ti->trace_buffer,
|
|
|
085f43 |
ti->pages) < 0)
|
|
|
085f43 |
goto out_fail;
|
|
|
085f43 |
|
|
|
085f43 |
--
|
|
|
085f43 |
2.17.1
|
|
|
085f43 |
|