Dwarves debugging tools
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Clark Williams <williams@redhat.com>,
	dwarves@vger.kernel.org, bpf@vger.kernel.org,
	Andrii Nakryiko <andrii@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 31/31] btfdiff: Remove --flat_arrays now that pahole encodes multi dim arrays in  BTF
Date: Wed, 29 Jul 2026 16:07:31 -0300	[thread overview]
Message-ID: <20260729190733.72876-32-acme@kernel.org> (raw)
In-Reply-To: <20260729190733.72876-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

With it, i.e. flattening DWARF arrays we get:

acme@number:~/git/build/v7.2-rc3+$ btfdiff vmlinux
--- /tmp/btfdiff.dwarf.sXVla7	2026-07-16 18:53:09.744346444 -0300
+++ /tmp/btfdiff.btf.uzBSIz	2026-07-16 18:53:04.975270734 -0300
@@ -21905,7 +21905,7 @@ struct amd_iommu {

 	/* typedef u32 -> __u32 */ unsigned int               stored_addr_lo;            /*   336     4 */
 	/* typedef u32 -> __u32 */ unsigned int               stored_addr_hi;            /*   340     4 */
-	/* typedef u32 -> __u32 */ unsigned int               stored_l1[108];            /*   344   432 */
+	/* typedef u32 -> __u32 */ unsigned int               stored_l1[6][18];          /*   344   432 */
 	/* --- cacheline 12 boundary (768 bytes) was 8 bytes ago --- */
 	/* typedef u32 -> __u32 */ unsigned int               stored_l2[131];            /*   776   524 */
 	/* --- cacheline 20 boundary (1280 bytes) was 20 bytes ago --- */
@@ -22489,7 +22489,7 @@ struct amd_mdb_pcie {
 			/* --- cacheline 6 boundary (384 bytes) --- */
 			struct pci_eq_presets {
 				/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16]; /*   384    32 */
-				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[48]; /*   416    48 */
+				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[3][16]; /*   416    48 */
 			} presets; /*   384    80 */
 			/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
 			struct pci_config_window * cfg;                                  /*   464     8 */
@@ -29007,7 +29007,7 @@ struct audit_aux_data_pids {
 		} bpf; /*   296     4 */
 	} target_ref[16]; /*   272   512 */
 	/* --- cacheline 12 boundary (768 bytes) was 16 bytes ago --- */
-	char                       target_comm[256];                                     /*   784   256 */
+	char                       target_comm[16][16];                                  /*   784   256 */
 	/* --- cacheline 16 boundary (1024 bytes) was 16 bytes ago --- */
 	int                        pid_count;                                            /*  1040     4 */

@@ -30613,7 +30613,7 @@ struct automaton_nomiss {
 	char *                     event_names[7];                                       /*    40    56 */
 	/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
 	char *                     env_names[3];                                         /*    96    24 */
-	unsigned char              function[35];                                         /*   120    35 */
+	unsigned char              function[5][7];                                       /*   120    35 */
 	/* --- cacheline 2 boundary (128 bytes) was 27 bytes ago --- */
 	unsigned char              initial_state;                                        /*   155     1 */
 	/* typedef bool */ _Bool                      final_states[5];                   /*   156     5 */
@@ -30627,7 +30627,7 @@ struct automaton_stall {
 	char *                     event_names[4];                                       /*    24    32 */
 	char *                     env_names[1];                                         /*    56     8 */
 	/* --- cacheline 1 boundary (64 bytes) --- */
-	unsigned char              function[12];                                         /*    64    12 */
+	unsigned char              function[3][4];                                       /*    64    12 */
 	unsigned char              initial_state;                                        /*    76     1 */
 	/* typedef bool */ _Bool                      final_states[3];                   /*    77     3 */

@@ -30637,7 +30637,7 @@ struct automaton_stall {
 struct automaton_wip {
 	char *                     state_names[2];                                       /*     0    16 */
 	char *                     event_names[3];                                       /*    16    24 */
-	unsigned char              function[6];                                          /*    40     6 */
+	unsigned char              function[2][3];                                       /*    40     6 */
 	unsigned char              initial_state;                                        /*    46     1 */
 	/* typedef bool */ _Bool                      final_states[2];                   /*    47     2 */

@@ -30648,7 +30648,7 @@ struct automaton_wip {
 struct automaton_wwnr {
 	char *                     state_names[2];                                       /*     0    16 */
 	char *                     event_names[3];                                       /*    16    24 */
-	unsigned char              function[6];                                          /*    40     6 */
+	unsigned char              function[2][3];                                       /*    40     6 */
 	unsigned char              initial_state;                                        /*    46     1 */
 	/* typedef bool */ _Bool                      final_states[2];                   /*    47     2 */

@@ -136221,7 +136221,7 @@ struct dw_pcie {
 		/* --- cacheline 6 boundary (384 bytes) --- */
 		struct pci_eq_presets {
 			/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16]; /*   384    32 */
-			/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[48];      /*   416    48 */
+			/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[3][16];   /*   416    48 */
 		} presets; /*   384    80 */
 		/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
 		struct pci_config_window * cfg;                                          /*   464     8 */
@@ -136582,7 +136582,7 @@ struct dw_pcie_rp {
 	struct pci_eq_presets {
 		/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16];       /*   288    32 */
 		/* --- cacheline 5 boundary (320 bytes) --- */
-		/* typedef u8 -> __u8 */ unsigned char      eq_presets_Ngts[48];         /*   320    48 */
+		/* typedef u8 -> __u8 */ unsigned char      eq_presets_Ngts[3][16];      /*   320    48 */
 	} presets; /*   288    80 */
 	struct pci_config_window * cfg;                                                  /*   368     8 */
 	/* typedef bool */ _Bool                      ecam_enabled;                      /*   376     1 */
@@ -173280,7 +173280,7 @@ struct fu740_pcie {
 			/* --- cacheline 6 boundary (384 bytes) --- */
 			struct pci_eq_presets {
 				/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16]; /*   384    32 */
-				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[48]; /*   416    48 */
+				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[3][16]; /*   416    48 */
 			} presets; /*   384    80 */
 			/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
 			struct pci_config_window * cfg;                                  /*   464     8 */
@@ -191392,10 +191392,10 @@ struct hugetlb_cgroup {
 	/* --- cacheline 832 boundary (53248 bytes) --- */
 	/* typedef atomic_long_t -> atomic64_t */ struct {
 		/* typedef s64 -> __s64 */ long long int      counter;                   /* 53248     8 */
-	} events[2]; /* 53248    16 */
+	} events[2][1]; /* 53248    16 */
 	/* typedef atomic_long_t -> atomic64_t */ struct {
 		/* typedef s64 -> __s64 */ long long int      counter;                   /* 53264     8 */
-	} events_local[2]; /* 53264    16 */
+	} events_local[2][1]; /* 53264    16 */
 	struct cgroup_file {
 		struct kernfs_node * kn;                                                 /* 53280     8 */
 		long unsigned int  notified_at;                                          /* 53288     8 */
@@ -234492,7 +234492,7 @@ struct intel_pcie {
 			/* --- cacheline 6 boundary (384 bytes) --- */
 			struct pci_eq_presets {
 				/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16]; /*   384    32 */
-				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[48]; /*   416    48 */
+				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[3][16]; /*   416    48 */
 			} presets; /*   384    80 */
 			/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
 			struct pci_config_window * cfg;                                  /*   464     8 */
@@ -263257,7 +263257,7 @@ struct keembay_pcie {
 			/* --- cacheline 6 boundary (384 bytes) --- */
 			struct pci_eq_presets {
 				/* typedef u16 -> __u16 */ short unsigned int eq_presets_8gts[16]; /*   384    32 */
-				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[48]; /*   416    48 */
+				/* typedef u8 -> __u8 */ unsigned char eq_presets_Ngts[3][16]; /*   416    48 */
 			} presets; /*   384    80 */
 			/* --- cacheline 7 boundary (448 bytes) was 16 bytes ago --- */
 			struct pci_config_window * cfg;                                  /*   464     8 */
<Big SNIP>
@@ -617956,14 +617956,14 @@ struct xz_dec_microlzma {
 			struct lzma_len_dec {
 				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int choice; /*  2824     2 */
 				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int choice2; /*  2826     2 */
-				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int low[128]; /*  2828   256 */
+				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int low[16][8]; /*  2828   256 */
 				/* --- cacheline 48 boundary (3072 bytes) was 12 bytes ago --- */
-				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int mid[128]; /*  3084   256 */
+				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int mid[16][8]; /*  3084   256 */
 				/* --- cacheline 52 boundary (3328 bytes) was 12 bytes ago --- */
 				/* typedef uint16_t -> u16 -> __u16 */ short unsigned int high[256]; /*  3340   512 */
 			} rep_len_dec; /*  2824  1028 */
 			/* --- cacheline 60 boundary (3840 bytes) was 12 bytes ago --- */
-			/* typedef uint16_t -> u16 -> __u16 */ short unsigned int literal[12288]; /*  3852 24576 */
+			/* typedef uint16_t -> u16 -> __u16 */ short unsigned int literal[16][768]; /*  3852 24576 */
 		} lzma; /*   124 28304 */
 		/* --- cacheline 444 boundary (28416 bytes) was 12 bytes ago --- */
 		struct {

Now, removing --flat_arrays makes it clean, meaning both DWARF and BTF
loaders support multi dimensional arrays and so does the BTF encoder.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 btfdiff | 1 -
 1 file changed, 1 deletion(-)

diff --git a/btfdiff b/btfdiff
index 46348f46a08c50ab..18794dfd3e1562d4 100755
--- a/btfdiff
+++ b/btfdiff
@@ -24,7 +24,6 @@ dwarf_output=$(mktemp /tmp/btfdiff.dwarf.XXXXXX)
 pahole_bin=${PAHOLE-"pahole"}
 
 ${pahole_bin} -E -F dwarf \
-	      --flat_arrays \
 	      --sort \
 	      --jobs \
 	      --suppress_aligned_attribute \
-- 
2.55.0


      parent reply	other threads:[~2026-07-29 19:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 19:07 [PATCHES 00/31] pahole: Bug fixes and small improvements Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 01/31] cmake: Update minimum required version from 3.5 to 3.10 Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 02/31] Fix -Wsign-compare warnings across the codebase Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 03/31] btf_encoder: Fix interior pointer free and missing NULL check Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 04/31] dwarves: Fix missing list head initialization in type__clone_members Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 05/31] pahole: Fix instance memory leak on early returns in prototype__stdio_fprintf_value Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 06/31] ctf_loader, libctf: Fix error path resource leaks Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 07/31] dwarves: Don't search for holes before member byte sizes are cached Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 08/31] dwarf_loader: Allocate type_dcu via dwarf_cu__new to fix dangling stack pointer Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 09/31] dwarf_loader: Fix annotation failure leaks in variable and typedef creation Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 10/31] btf_encoder: Use btf_encoder__tag_type() for all type ID computations Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 11/31] pahole: Fix --errno typo that decrements instead of negating Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 12/31] dwarves: Fix heap buffer overflow in languages__parse realloc Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 13/31] btf_encoder: Fix early cleanup crashes in btf_encoder__new/delete Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 14/31] btf_encoder, libctf: Add elf_strptr NULL checks and fix kfunc bounds Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 15/31] dwarf_loader: Fix --fixup_silly_bitfields condition check Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 16/31] dwarf_loader: Skip libdw__lock when elfutils is built thread-safe Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 17/31] dwarf_loader: Fix data race in tag__init() decl_file string cache Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 18/31] pahole: Fix parse_btf_features("all") being a silent no-op Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 19/31] dwarves: Fix variable shadowing in __cus__find_struct_by_name() Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 20/31] dutil: Add exec_objcopy() shell-injection-safe helper Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 21/31] btf_encoder: Fall back to objcopy when llvm-objcopy is not available Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 22/31] dwarf_loader, btf_loader: Replace stale FIXME/XXX comments with explanations Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 23/31] pahole: Skip inline expansions during BTF encoding Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 24/31] pahole: Use fseek for seekable files in --prettify and --seek_bytes Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 25/31] pahole: Guard pipe_seek() against negative offsets Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 26/31] gobuffer: Remove 5 dead functions found via coverage analysis Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 27/31] dwarves: Remove 6 " Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 28/31] pfunct, dwarves_fprintf: Mark file-local functions as static Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 29/31] btf_encoder: Fix multi-dimensional array encoding Arnaldo Carvalho de Melo
2026-07-29 19:07 ` [PATCH 30/31] btf_loader: Fix multi-dimensional array loading Arnaldo Carvalho de Melo
2026-07-29 19:07 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260729190733.72876-32-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=jolsa@kernel.org \
    --cc=williams@redhat.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox