slavio_timer: avoid structure holes spotted by pahole
commitf90074f49309de9dd65b978a95d10f089017960a
authorBlue Swirl <blauwirbel@gmail.com>
Sun, 7 Aug 2011 19:00:23 +0000 (7 19:00 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Sun, 21 Aug 2011 19:52:27 +0000 (21 19:52 +0000)
treec79c0d54ccd4e9c2a53b08e95ef9bb9410e3072a
parent94ac5cd20c6e441e0ed3aec5c98d6cbefb7f503f
slavio_timer: avoid structure holes spotted by pahole

Report from pahole on amd64 host:
struct SLAVIO_TIMERState {
SysBusDevice               busdev;               /*     0  5648 */
/* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */
uint32_t                   num_cpus;             /*  5648     4 */

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

CPUTimerState              cputimer[17];         /*  5656   816 */
/* --- cacheline 101 boundary (6464 bytes) was 8 bytes ago --- */
uint32_t                   cputimer_mode;        /*  6472     4 */

/* size: 6480, cachelines: 102 */
/* sum members: 6472, holes: 1, sum holes: 4 */
/* padding: 4 */
/* last cacheline: 16 bytes */
}; /* definitions: 1 */

struct CPUTimerState {
qemu_irq                   irq;                  /*     0     8 */
ptimer_state *             timer;                /*     8     8 */
uint32_t                   count;                /*    16     4 */
uint32_t                   counthigh;            /*    20     4 */
uint32_t                   reached;              /*    24     4 */

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

uint64_t                   limit;                /*    32     8 */
uint32_t                   running;              /*    40     4 */

/* size: 48, cachelines: 1 */
/* sum members: 40, holes: 1, sum holes: 4 */
/* padding: 4 */
/* last cacheline: 48 bytes */
}; /* definitions: 1 */

Fix by rearranging the structures to avoid padding.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/slavio_timer.c