Report from pahole on amd64 host:
struct IOMMUState {
        SysBusDevice               busdev;               /*     0  5648 */
        /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */
        uint32_t                   regs[4096];           /*  5648 16384 */
        /* --- cacheline 344 boundary (22016 bytes) was 16 bytes ago --- */
        target_phys_addr_t         iostart;              /* 22032     8 */
        uint32_t                   version;              /* 22040     4 */

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

        qemu_irq                   irq;                  /* 22048     8 */

        /* size: 22056, cachelines: 345 */
        /* sum members: 22052, holes: 1, sum holes: 4 */
        /* last cacheline: 40 bytes */
};      /* definitions: 1 */

Fix by rearranging the structure to avoid padding.

Signed-off-by: Blue Swirl <blauwir...@gmail.com>
---
 hw/sun4m_iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/sun4m_iommu.c b/hw/sun4m_iommu.c
index 7f5dad5..6eeadfa 100644
--- a/hw/sun4m_iommu.c
+++ b/hw/sun4m_iommu.c
@@ -130,8 +130,8 @@ typedef struct IOMMUState {
     SysBusDevice busdev;
     uint32_t regs[IOMMU_NREGS];
     target_phys_addr_t iostart;
-    uint32_t version;
     qemu_irq irq;
+    uint32_t version;
 } IOMMUState;

 static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
-- 
1.6.2.4
From 9e23cde2ab480b2e53af94acc6fa9572d17b5e5f Mon Sep 17 00:00:00 2001
Message-Id: <9e23cde2ab480b2e53af94acc6fa9572d17b5e5f.1312750600.git.blauwir...@gmail.com>
In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com>
References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com>
From: Blue Swirl <blauwir...@gmail.com>
Date: Sun, 7 Aug 2011 19:09:50 +0000
Subject: [PATCH 04/11] sun4m_iommu: avoid structure holes spotted by pahole

Report from pahole on amd64 host:
struct IOMMUState {
	SysBusDevice               busdev;               /*     0  5648 */
	/* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */
	uint32_t                   regs[4096];           /*  5648 16384 */
	/* --- cacheline 344 boundary (22016 bytes) was 16 bytes ago --- */
	target_phys_addr_t         iostart;              /* 22032     8 */
	uint32_t                   version;              /* 22040     4 */

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

	qemu_irq                   irq;                  /* 22048     8 */

	/* size: 22056, cachelines: 345 */
	/* sum members: 22052, holes: 1, sum holes: 4 */
	/* last cacheline: 40 bytes */
};	/* definitions: 1 */

Fix by rearranging structures to avoid padding.

Signed-off-by: Blue Swirl <blauwir...@gmail.com>
---
 hw/sun4m_iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/sun4m_iommu.c b/hw/sun4m_iommu.c
index 7f5dad5..6eeadfa 100644
--- a/hw/sun4m_iommu.c
+++ b/hw/sun4m_iommu.c
@@ -130,8 +130,8 @@ typedef struct IOMMUState {
     SysBusDevice busdev;
     uint32_t regs[IOMMU_NREGS];
     target_phys_addr_t iostart;
-    uint32_t version;
     qemu_irq irq;
+    uint32_t version;
 } IOMMUState;
 
 static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
-- 
1.7.2.5

Reply via email to