[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/11] pcnet: avoid structure holes spotted by pahol
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 08/11] pcnet: avoid structure holes spotted by pahole |
Date: |
Sun, 7 Aug 2011 21:00:21 +0000 |
Edited report from pahole on amd64 host:
struct PCNetState_st {
...
uint16_t bcr[32]; /* 340 64 */
/* XXX 4 bytes hole, try to pack */
...
int tx_busy; /* 4520 4 */
/* XXX 4 bytes hole, try to pack */
qemu_irq irq; /* 4528 8 */
void (*phys_mem_read)(void *,
target_phys_addr_t, uint8_t *, int, int); /* 4536 8 */
/* --- cacheline 71 boundary (4544 bytes) --- */
void (*phys_mem_write)(void *,
target_phys_addr_t, uint8_t *, int, int); /* 4544 8 */
void * dma_opaque; /* 4552 8 */
int looptest; /* 4560 4 */
/* size: 4568, cachelines: 72 */
/* sum members: 4556, holes: 2, sum holes: 8 */
/* padding: 4 */
/* last cacheline: 24 bytes */
}; /* definitions: 2 */
Fix by rearranging the structure to avoid padding.
Signed-off-by: Blue Swirl <address@hidden>
---
hw/pcnet.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/pcnet.h b/hw/pcnet.h
index 534bdf9..9a7b122 100644
--- a/hw/pcnet.h
+++ b/hw/pcnet.h
@@ -11,15 +11,15 @@ struct PCNetState_st {
NICState *nic;
NICConf conf;
QEMUTimer *poll_timer;
- int rap, isr, lnkst;
+ int rap, isr;
uint32_t rdra, tdra;
+ uint64_t timer;
uint8_t prom[16];
uint16_t csr[128];
uint16_t bcr[32];
- uint64_t timer;
int mmio_index, xmit_pos;
uint8_t buffer[4096];
- int tx_busy;
+ int tx_busy, lnkst;
qemu_irq irq;
void (*phys_mem_read)(void *dma_opaque, target_phys_addr_t addr,
uint8_t *buf, int len, int do_bswap);
--
1.6.2.4
0008-pcnet-void-structure-holes-spotted-by-pahole.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 08/11] pcnet: avoid structure holes spotted by pahole,
Blue Swirl <=