linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf doc: Update jitdump unwind info specification
@ 2024-01-10  0:54 Namhyung Kim
  2024-01-10  0:54 ` [PATCH 2/2] perf doc: Increase the jitdump version to 2 Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2024-01-10  0:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Stephane Eranian, Stefano Sanfilippo,
	Steve MacLean, Pablo Galindo

Currently the jitdump spec says the EH frame header is followed by the
actual EH frame data.  But in fact, it's the opposite way.

I've checked this with the v8 javascript engine which, I believe, is the
actual user of this feature.

  https://github.com/v8/v8/blob/04f51bc70a38fbea743588e41290bea40830a486/src/diagnostics/eh-frame.cc#L157

Also, the unwind_data_size field should have the size of both unwind
table and the header sections.  The jit_add_eh_frame_info() in genelf.c
calculates the table size by subtracting the header size from it.

Cc: Stephane Eranian <eranian@google.com>
Cc: Stefano Sanfilippo <ssanfilippo@chromium.org>
Cc: Steve MacLean <Steve.MacLean@Microsoft.com>
Reported-by: Pablo Galindo <pablogsal@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/jitdump-specification.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/jitdump-specification.txt b/tools/perf/Documentation/jitdump-specification.txt
index 79936355d819..5c3fbbbebf14 100644
--- a/tools/perf/Documentation/jitdump-specification.txt
+++ b/tools/perf/Documentation/jitdump-specification.txt
@@ -155,10 +155,10 @@ The record is used to describe the unwinding information for a jitted function.
 
 The record has the following fields following the fixed-size record header in order:
 
-uint64_t unwind_data_size   : the size in bytes of the unwinding data table at the end of the record
-uint64_t eh_frame_hdr_size  : the size in bytes of the DWARF EH Frame Header at the start of the unwinding data table at the end of the record
+uint64_t unwind_data_size   : the size in bytes of the unwinding data (EH Frame table and EH Frame Header) at the end of the record
+uint64_t eh_frame_hdr_size  : the size in bytes of the DWARF EH Frame Header at the end of the record
 uint64_t mapped_size        : the size of the unwinding data mapped in memory
-const char unwinding_data[n]: an array of unwinding data, consisting of the EH Frame Header, followed by the actual EH Frame
+const char unwinding_data[n]: an array of unwinding data, consisting of the actual EH Frame, followed by the EH Frame Header
 
 
 The EH Frame header follows the Linux Standard Base (LSB) specification as described in the document at https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
-- 
2.43.0.472.g3155946c3a-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] perf doc: Increase the jitdump version to 2
  2024-01-10  0:54 [PATCH 1/2] perf doc: Update jitdump unwind info specification Namhyung Kim
@ 2024-01-10  0:54 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2024-01-10  0:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Stephane Eranian, Steve MacLean, Pablo Galindo

The specification says it's in version 2.  Previously it changed to 1
due to the mismatch with the code.  But I think it's better to use the
version 2 to indicate it supports the unwind info.

The version check code in jitdump.c only checks if it's greater than the
current version so old data with version number 1 should work too.

Cc: Stephane Eranian <eranian@google.com>
Cc: Steve MacLean <Steve.MacLean@Microsoft.com>
Cc: Pablo Galindo <pablogsal@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/jitdump-specification.txt | 2 +-
 tools/perf/util/jitdump.h                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/jitdump-specification.txt b/tools/perf/Documentation/jitdump-specification.txt
index 5c3fbbbebf14..863b35d4ad4a 100644
--- a/tools/perf/Documentation/jitdump-specification.txt
+++ b/tools/perf/Documentation/jitdump-specification.txt
@@ -37,7 +37,7 @@ III/ Jitdump file header format
 
 
 * uint32_t magic     : a magic number tagging the file type. The value is 4-byte long and represents the string "JiTD" in ASCII form. It written is as 0x4A695444. The reader will detect an endian mismatch when it reads 0x4454694a.
-* uint32_t version   : a 4-byte value representing the format version. It is currently set to 1
+* uint32_t version   : a 4-byte value representing the format version. It is currently set to 2
 * uint32_t total_size: size in bytes of file header
 * uint32_t elf_mach  : ELF architecture encoding (ELF e_machine value as specified in /usr/include/elf.h)
 * uint32_t pad1      : padding. Reserved for future use
diff --git a/tools/perf/util/jitdump.h b/tools/perf/util/jitdump.h
index ab2842def83d..4e3f6702d919 100644
--- a/tools/perf/util/jitdump.h
+++ b/tools/perf/util/jitdump.h
@@ -22,7 +22,7 @@
 #define PADDING_8ALIGNED(x) ((((x) + 7) & 7) ^ 7)
 #define ALIGN_8(x) (((x) + 7) & (~7))
 
-#define JITHEADER_VERSION 1
+#define JITHEADER_VERSION 2
 
 enum jitdump_flags_bits {
 	JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT,
-- 
2.43.0.472.g3155946c3a-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-10  0:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10  0:54 [PATCH 1/2] perf doc: Update jitdump unwind info specification Namhyung Kim
2024-01-10  0:54 ` [PATCH 2/2] perf doc: Increase the jitdump version to 2 Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).