dwarves/man-pages
Arnaldo Carvalho de Melo 7eea706c14 pahole: Introduce --with_flexible_array option to show just types ending in a flexible array
The kernel has lotsa:

  $ pahole --sizes --with_flexible_array | wc -l
  1134
  $

  $ pahole --with_flexible_array | tail -18
  struct pci_setup_rom {
  	struct setup_data          data;                 /*     0    16 */
  	uint16_t                   vendor;               /*    16     2 */
  	uint16_t                   devid;                /*    18     2 */

  	/* XXX 4 bytes hole, try to pack */

  	uint64_t                   pcilen;               /*    24     8 */
  	long unsigned int          segment;              /*    32     8 */
  	long unsigned int          bus;                  /*    40     8 */
  	long unsigned int          device;               /*    48     8 */
  	long unsigned int          function;             /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	uint8_t                    romdata[];            /*    64     0 */

  	/* size: 64, cachelines: 1, members: 9 */
  	/* sum members: 60, holes: 1, sum holes: 4 */
  };
  $

Works together with other filters:

  $ pahole --contains setup_data --with_flexible_array
  pci_setup_rom
  $ pahole pci_setup_rom
  struct pci_setup_rom {
  	struct setup_data          data;                 /*     0    16 */
  	uint16_t                   vendor;               /*    16     2 */
  	uint16_t                   devid;                /*    18     2 */

  	/* XXX 4 bytes hole, try to pack */

  	uint64_t                   pcilen;               /*    24     8 */
  	long unsigned int          segment;              /*    32     8 */
  	long unsigned int          bus;                  /*    40     8 */
  	long unsigned int          device;               /*    48     8 */
  	long unsigned int          function;             /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	uint8_t                    romdata[];            /*    64     0 */

  	/* size: 64, cachelines: 1, members: 9 */
  	/* sum members: 60, holes: 1, sum holes: 4 */
  };
  $

  $ pahole --find_pointers_to net_device --with_flexible_array
  neighbour: dev
  pneigh_entry: dev
  xsk_buff_pool: netdev
  cfg80211_sched_scan_request: dev
  switchdev_deferred_item: dev
  $ pahole xsk_buff_pool
  struct xsk_buff_pool {
  	struct device *            dev;                  /*     0     8 */
  	struct net_device *        netdev;               /*     8     8 */
  	struct list_head           xsk_tx_list;          /*    16    16 */
  	spinlock_t                 xsk_tx_list_lock;     /*    32     4 */
  	refcount_t                 users;                /*    36     4 */
  	struct xdp_umem *          umem;                 /*    40     8 */
  	struct work_struct         work;                 /*    48    32 */
  	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
  	struct list_head           free_list;            /*    80    16 */
  	u32                        heads_cnt;            /*    96     4 */
  	u16                        queue_id;             /*   100     2 */

  	/* XXX 26 bytes hole, try to pack */

  	/* --- cacheline 2 boundary (128 bytes) --- */
  	struct xsk_queue *         fq;                   /*   128     8 */
  	struct xsk_queue *         cq;                   /*   136     8 */
  	dma_addr_t *               dma_pages;            /*   144     8 */
  	struct xdp_buff_xsk *      heads;                /*   152     8 */
  	u64                        chunk_mask;           /*   160     8 */
  	u64                        addrs_cnt;            /*   168     8 */
  	u32                        free_list_cnt;        /*   176     4 */
  	u32                        dma_pages_cnt;        /*   180     4 */
  	u32                        free_heads_cnt;       /*   184     4 */
  	u32                        headroom;             /*   188     4 */
  	/* --- cacheline 3 boundary (192 bytes) --- */
  	u32                        chunk_size;           /*   192     4 */
  	u32                        frame_len;            /*   196     4 */
  	u8                         cached_need_wakeup;   /*   200     1 */
  	bool                       uses_need_wakeup;     /*   201     1 */
  	bool                       dma_need_sync;        /*   202     1 */
  	bool                       unaligned;            /*   203     1 */

  	/* XXX 4 bytes hole, try to pack */

  	void *                     addrs;                /*   208     8 */
  	spinlock_t                 cq_lock;              /*   216     4 */

  	/* XXX 4 bytes hole, try to pack */

  	struct xdp_buff_xsk *      free_heads[];         /*   224     0 */

  	/* size: 256, cachelines: 4, members: 29 */
  	/* sum members: 190, holes: 3, sum holes: 34 */
  	/* padding: 32 */
  };
  $

Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-04-12 13:52:34 -03:00
..
pahole.1 pahole: Introduce --with_flexible_array option to show just types ending in a flexible array 2021-04-12 13:52:34 -03:00