[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/11] slavio_timer: avoid structure holes spotted b
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole |
Date: |
Sun, 7 Aug 2011 20:57:15 +0000 |
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 <address@hidden>
---
hw/slavio_timer.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index 5511313..f18c8d7 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -48,16 +48,16 @@ typedef struct CPUTimerState {
qemu_irq irq;
ptimer_state *timer;
uint32_t count, counthigh, reached;
- uint64_t limit;
- // processor only
+ /* processor only */
uint32_t running;
+ uint64_t limit;
} CPUTimerState;
typedef struct SLAVIO_TIMERState {
SysBusDevice busdev;
uint32_t num_cpus;
- CPUTimerState cputimer[MAX_CPUS + 1];
uint32_t cputimer_mode;
+ CPUTimerState cputimer[MAX_CPUS + 1];
} SLAVIO_TIMERState;
typedef struct TimerContext {
--
1.6.2.4
0001-slavio_timer-avoid-structure-holes-spotted-by-pahole.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole,
Blue Swirl <=