qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 02/11] slavio_misc: avoid structure holes spotted by


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 02/11] slavio_misc: avoid structure holes spotted by pahole
Date: Sun, 7 Aug 2011 20:57:45 +0000

Report from pahole on amd64 host:
struct MiscState {
        SysBusDevice               busdev;               /*     0  5648 */
        /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */
        qemu_irq                   irq;                  /*  5648     8 */
        uint32_t                   dummy;                /*  5656     4 */
        uint8_t                    config;               /*  5660     1 */
        uint8_t                    aux1;                 /*  5661     1 */
        uint8_t                    aux2;                 /*  5662     1 */
        uint8_t                    diag;                 /*  5663     1 */
        uint8_t                    mctrl;                /*  5664     1 */
        uint8_t                    sysctrl;              /*  5665     1 */
        uint16_t                   leds;                 /*  5666     2 */

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

        qemu_irq                   fdc_tc;               /*  5672     8 */

        /* size: 5680, cachelines: 89 */
        /* sum members: 5676, holes: 1, sum holes: 4 */
        /* last cacheline: 48 bytes */
};      /* definitions: 1 */

Fix by rearranging the structure to avoid padding.

Signed-off-by: Blue Swirl <address@hidden>
---
 hw/slavio_misc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 198360d..1f5a2d7 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -37,13 +37,13 @@
 typedef struct MiscState {
     SysBusDevice busdev;
     qemu_irq irq;
+    qemu_irq fdc_tc;
     uint32_t dummy;
     uint8_t config;
     uint8_t aux1, aux2;
     uint8_t diag, mctrl;
     uint8_t sysctrl;
     uint16_t leds;
-    qemu_irq fdc_tc;
 } MiscState;

 typedef struct APCState {
-- 
1.6.2.4

Attachment: 0002-slavio_misc-avoid-structure-holes-spotted-by-pahole.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]