commit
b9ba5107ba
@ -0,0 +1 @@
|
|||||||
|
d6cdad06d5bbf06208a55097405d8a9906ba2440 SOURCES/ptdump-1.0.7.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
SOURCES/ptdump-1.0.7.tar.gz
|
@ -0,0 +1,34 @@
|
|||||||
|
From 374cde9c0aeb84da9e993641220c8b23adebab20 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
Date: Wed, 13 Jul 2022 17:23:05 +0800
|
||||||
|
Subject: [PATCH 1/3] Fix for the topa_entry issue
|
||||||
|
|
||||||
|
kernel commit 59388b9cbe20 ("[x86] perf/x86/intel/pt: Split ToPA metadata
|
||||||
|
and page layout") moved out the table of topa entry from struct topa, which
|
||||||
|
may cause the following failures:
|
||||||
|
[1] invalid kernel virtual address: 0 type: "struct topa_entry"
|
||||||
|
[2] current buffer not found
|
||||||
|
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
ptdump.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ptdump.c b/ptdump.c
|
||||||
|
index f5eb110fe1cd..736e1c8cddaf 100644
|
||||||
|
--- a/ptdump.c
|
||||||
|
+++ b/ptdump.c
|
||||||
|
@@ -183,6 +183,10 @@ int init_pt_info(int cpu)
|
||||||
|
&output_off))
|
||||||
|
goto out_error;
|
||||||
|
|
||||||
|
+ /* fixup the address of topa table */
|
||||||
|
+ if (STRUCT_EXISTS("topa_page") && topa_base)
|
||||||
|
+ topa_base -= MEMBER_SIZE("topa_page", "table");
|
||||||
|
+
|
||||||
|
dbgprintf(fp, "[%d] buf.cur=0x%016lx\n", cpu, topa_base);
|
||||||
|
dbgprintf(fp, "[%d] buf.cur_idx=0x%08x\n", cpu, topa_idx);
|
||||||
|
dbgprintf(fp, "[%d] buf.output_off=0x%016lx\n", cpu, output_off);
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From 86022cd76d9391f3c93553d1c76a444b2143a4e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
Date: Wed, 13 Jul 2022 22:27:33 +0800
|
||||||
|
Subject: [PATCH 2/3] Fix for the invalid ring_buffer issue
|
||||||
|
|
||||||
|
Kernel commit e028157062b9 ("[kernel] perf: Make struct ring_buffer
|
||||||
|
less ambiguous") renamed the struct ring_buffer to struct perf_buffer,
|
||||||
|
which cause the following failure:
|
||||||
|
|
||||||
|
[0] invalid ring_buffer
|
||||||
|
[1] invalid ring_buffer
|
||||||
|
[2] invalid ring_buffer
|
||||||
|
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
ptdump.c | 45 +++++++++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 31 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ptdump.c b/ptdump.c
|
||||||
|
index 736e1c8cddaf..54e4391739e3 100644
|
||||||
|
--- a/ptdump.c
|
||||||
|
+++ b/ptdump.c
|
||||||
|
@@ -114,25 +114,42 @@ int init_pt_info(int cpu)
|
||||||
|
struct_ring_buffer);
|
||||||
|
|
||||||
|
/* symbol access check */
|
||||||
|
- if (STRUCT_EXISTS("ring_buffer") &&
|
||||||
|
- !MEMBER_EXISTS("ring_buffer", "aux_pages")) {
|
||||||
|
- fprintf(fp, "[%d] invalid ring_buffer\n", cpu);
|
||||||
|
+ if ((STRUCT_EXISTS("ring_buffer") &&
|
||||||
|
+ !MEMBER_EXISTS("ring_buffer", "aux_pages")) ||
|
||||||
|
+ (STRUCT_EXISTS("perf_buffer") &&
|
||||||
|
+ !MEMBER_EXISTS("perf_buffer", "aux_pages"))) {
|
||||||
|
+ fprintf(fp, "[%d] invalid {ring|perf}_buffer\n", cpu);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* array of struct pages for pt buffer */
|
||||||
|
- if(!get_member(struct_ring_buffer, "ring_buffer", "aux_pages",
|
||||||
|
- &aux_pages))
|
||||||
|
- return FALSE;
|
||||||
|
+ if (STRUCT_EXISTS("ring_buffer")) {
|
||||||
|
+ /* array of struct pages for pt buffer */
|
||||||
|
+ if(!get_member(struct_ring_buffer, "ring_buffer", "aux_pages",
|
||||||
|
+ &aux_pages))
|
||||||
|
+ return FALSE;
|
||||||
|
|
||||||
|
- /* number of pages */
|
||||||
|
- if(!get_member(struct_ring_buffer, "ring_buffer", "aux_nr_pages",
|
||||||
|
- &aux_nr_pages))
|
||||||
|
- return FALSE;
|
||||||
|
+ /* number of pages */
|
||||||
|
+ if(!get_member(struct_ring_buffer, "ring_buffer", "aux_nr_pages",
|
||||||
|
+ &aux_nr_pages))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ /* private data (struct pt_buffer) */
|
||||||
|
+ if(!get_member(struct_ring_buffer, "ring_buffer", "aux_priv",
|
||||||
|
+ &aux_priv))
|
||||||
|
+ return FALSE;
|
||||||
|
+ } else if (STRUCT_EXISTS("perf_buffer")) {
|
||||||
|
+ if(!get_member(struct_ring_buffer, "perf_buffer", "aux_pages",
|
||||||
|
+ &aux_pages))
|
||||||
|
+ return FALSE;
|
||||||
|
|
||||||
|
- /* private data (struct pt_buffer) */
|
||||||
|
- if(!get_member(struct_ring_buffer, "ring_buffer", "aux_priv",
|
||||||
|
- &aux_priv))
|
||||||
|
+ if(!get_member(struct_ring_buffer, "perf_buffer", "aux_nr_pages",
|
||||||
|
+ &aux_nr_pages))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ if(!get_member(struct_ring_buffer, "perf_buffer", "aux_priv",
|
||||||
|
+ &aux_priv))
|
||||||
|
+ return FALSE;
|
||||||
|
+ } else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!aux_nr_pages) {
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 14fe81602c9dd2f64ab803ed9c83b243226a6b05 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
Date: Tue, 19 Jul 2022 13:31:02 +0800
|
||||||
|
Subject: [PATCH 3/3] Do not dump on the Single Range Output mode
|
||||||
|
|
||||||
|
Kernel commit 670638477aed ("perf/x86/intel/pt: Opportunistically use
|
||||||
|
single range output mode") may cause the following failure:
|
||||||
|
|
||||||
|
ptdump: page excluded: kernel virtual address: xxx type: "struct topa_entry"
|
||||||
|
Cannot read topa table
|
||||||
|
|
||||||
|
When working on the Single Range Output mode, not support to dump and
|
||||||
|
pint a warning.
|
||||||
|
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
ptdump.c | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ptdump.c b/ptdump.c
|
||||||
|
index 54e4391739e3..d48cd0126716 100644
|
||||||
|
--- a/ptdump.c
|
||||||
|
+++ b/ptdump.c
|
||||||
|
@@ -189,6 +189,17 @@ int init_pt_info(int cpu)
|
||||||
|
dbgprintf(fp, " %d: 0x%016lx\n", i, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (MEMBER_EXISTS("pt_buffer", "single")) {
|
||||||
|
+ uint single = 0;
|
||||||
|
+ if(!get_member(pt_info_ptr->pt_buffer, "pt_buffer", "single", &single)) {
|
||||||
|
+ fprintf(fp, "failed to read pt_buffer.");
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!!single)
|
||||||
|
+ error(FATAL, "Not support because of using Single Range Output instead of ToPA.\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Get pt registes saved on panic */
|
||||||
|
if(!get_member(pt_info_ptr->pt_buffer, "pt_buffer", "cur",
|
||||||
|
&topa_base))
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
--- ptdump-1.0.3/ptdump.mk.orig
|
||||||
|
+++ ptdump-1.0.3/ptdump.mk
|
||||||
|
@@ -43,7 +43,7 @@ ptdump.so: $(TARGET_CFILES) $(INCDIR)/de
|
||||||
|
ifeq ($(ARCH),UNSUPPORTED)
|
||||||
|
@echo "ptdump: architecture not supported"
|
||||||
|
else
|
||||||
|
- gcc $(RPM_OPT_FLAGS) $(CFLAGS) $(TARGET_CFLAGS) $(COMMON_CFLAGS) -nostartfiles -shared -rdynamic -o $@ $(TARGET_CFILES)
|
||||||
|
+ gcc $(RPM_OPT_FLAGS) $(CFLAGS) $(TARGET_CFLAGS) $(COMMON_CFLAGS) -nostartfiles -shared -rdynamic -o $@ $(TARGET_CFILES) -Wl,-z,now
|
||||||
|
endif
|
||||||
|
|
||||||
|
debug: COMMON_CFLAGS+=-DDEBUG
|
Loading…
Reference in new issue