import crash-ptdump-command-1.0.7-2.el8

This commit is contained in:
CentOS Sources 2022-11-08 01:48:25 -05:00 committed by Stepan Oksanichenko
parent 96d4806981
commit 6f63da69d6
4 changed files with 173 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@
Summary: ptdump extension module for the crash utility
Name: crash-ptdump-command
Version: 1.0.7
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Group: Development/Debuggers
Source: https://github.com/crash-utility/crash-extensions/blob/master/ptdump-%{version}.tar.gz
@ -15,6 +15,9 @@ Buildroot: %{_tmppath}/%{name}-root
BuildRequires: crash-devel >= 5.1.5
Requires: crash >= 5.1.5
Patch0: rhel8_build.patch
Patch1: 0001-Fix-for-the-topa_entry-issue.patch
Patch2: 0002-Fix-for-the-invalid-ring_buffer-issue.patch
Patch3: 0003-Do-not-dump-on-the-Single-Range-Output-mode.patch
%description
Retrieve and decode the log buffer generated by the Intel(R) Processor
@ -23,6 +26,9 @@ Trace facility
%prep
%setup -q -n ptdump-%{version}
%patch0 -p1 -b rhel8_build.patch
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
make -f ptdump.mk
@ -42,6 +48,12 @@ rm -Rf $RPM_BUILD_ROOT
%doc COPYING
%changelog
* Thu Jul 14 2022 Lianbo Jiang <lijiang@redhat.com> - 1.0.7-2
- Fix for "current buffer not found"
- Fix for "invalid kernel virtual address: 0 type: struct topa_entry"
- Fix for "invalid ring_buffer"
Resolves: rhbz#1838927
* Wed Jul 8 2020 Bhupesh Sharma <bhsharma@redhat.com> - 1.0.7-1
- ptdump: Rebase to upstream extension version ptdump-1.0.7 (github)
Resolves: rhbz#1851749