Skip to contentSkip to conversation

COW: Speed up writes

PATCH In review Charlie Shepherd 1 participant 4 messages Nov 6, 2013

lore
Share & tools
lore
#0 lore raw

cover COW: Speed up writes

Following on from Paolo's commits 26ae980 and 276cbc7, this patchset implements some changes he recommended earlier which I didn't previously have time to do while on GSoC.

Patch 2 was written initially I was intending to use cow_co_is_allocated in Patch 3 and needed it to consider all sectors but in the end cow_find_streak was sufficient, so it may not strictly be necessary.

Andreas Färber (49):
mips_mipssim: Silence BIOS loading warning for qtest
puv3: Turn puv3_load_kernel() into a no-op for qtest without -kernel
mainstone: Don't enforce use of -pflash for qtest
gumstix: Don't enforce use of -pflash for qtest
z2: Don't enforce use of -pflash for qtest
palm: Don't enforce loading ROM or kernel for qtest
omap_sx1: Don't enforce use of kernel or flash for qtest
exynos4_boards: Silence lack of -smp 2 warning for qtest
armv7m: Don't enforce use of kernel for qtest
axis_dev88: Don't enforce use of kernel for qtest
mcf5208: Don't enforce use of kernel for qtest
an5206: Don't enforce use of kernel for qtest
milkymist: Suppress -kernel/-bios/-drive error for qtest
shix: Drop debug output
shix: Don't require firmware presence for qtest
leon3: Don't enforce use of -bios with qtest
qtest: Prepare QOM machine tests
a9mpcore: Split off instance_init
arm_gic: Extract headers hw/intc/arm_gic{,_common}.h
a9mpcore: Embed GICState
a9scu: QOM cleanups
a9mpcore: Embed A9SCUState
arm_mptimer: Convert to QOM realize
a9mpcore: Embed ARMMPTimerState
a9mpcore: Convert to QOM realize
a9mpcore: Prepare for QOM embedding
a15mpcore: Split off instance_init
a15mpcore: Embed GICState
a15mpcore: Convert to QOM realize
a15mpcore: Prepare for QOM embedding
a9scu: Build only once
arm11mpcore: Fix typo in MemoryRegion name
arm11mpcore: Drop unused fields
arm11mpcore: Create container MemoryRegion in instance_init
arm11mpcore: Split off SCU device
arm11mpcore: Convert ARM11MPCorePriveState to QOM realize
realview_gic: Convert to QOM realize
realview_gic: Prepare for QOM embedding
arm11mpcore: Convert mpcore_rirq_state to QOM realize
arm11mpcore: Prepare for QOM embedding
arm11mpcore: Split off RealView MPCore
qdev-monitor: Clean up qdev_device_add() variable naming
qdev-monitor: Avoid qdev as variable name
qdev-monitor: Inline qdev_init() for device_add
pxa: Fix typo "dettach"
pcmcia: QOM'ify PCMCIACardState and MicroDriveState
microdrive: Coding Style cleanups
ide: Drop ide_init2_with_non_qdev_drives()
pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState

Anthony Liguori (1):
ossaudio: do not enable by default

Antony Pavlov (1):
milkymist-uart: Use Device::realize instead of SysBusDevice::init

Charlie Shepherd (3):
COW: Speed up writes
COW: Extend checking allocated bits to beyond one sector
COW: Skip setting already set bits

Gerd Hoffmann (3):
pc: add etc/e820 fw_cfg file
pc: register e820 entries for ram
qxl: replace pipe signaling with bottom half

Igor Mammedov (1):
qdev-monitor: Fix crash when device_add is called with abstract driver

Jan Kiszka (1):
rtc: remove dead SQW IRQ code

Marc-André Lureau (1):
vga: fix invalid read after free

Michael S. Tsirkin (3):
pc: disable acpi info for isapc and old pc machine
exec: limit system memory size
qom: Fix pointer to int property helpers' documentation

Mike Frysinger (1):
configure: detect endian via compile test

Paolo Bonzini (1):
vl: allow "cont" from panicked state

Peter Maydell (10):
bswap.h: Remove cpu_to_le16wu()
bswap.h: Remove cpu_to_le32wu()
bswap.h: Remove le16_to_cpupu()
bswap.h: Remove le32_to_cpupu()
bswap.h: Remove be32_to_cpupu()
bswap.h: Remove cpu_to_be16wu()
bswap.h: Remove cpu_to_be32wu()
bswap.h: Remove cpu_to_be64wu()
bswap.h: Remove cpu_to_32wu()
docs/memory.txt: Clarify and expand priority/overlap documentation

Stefan Hajnoczi (3):
qdev-monitor: Unref device when device_add fails
qdev: Drop misleading qdev_free() function
tests: fix 64-bit int literals for 32-bit hosts

Wenchao Xia (2):
qapi: fix memleak by adding implict struct functions in dealloc
visitor
tests: fix memleak in error path test for input visitor

#1 lore raw

PATCH 1/80 pc: add etc/e820 fw_cfg file

From: Gerd Hoffmann <[email protected]>

Unlike the existing FW_CFG_E820_TABLE entry which carries reservations only the new etc/e820 file also has entries for RAM.

Format is simliar to the FW_CFG_E820_TABLE, it is a simple list of e820_entry structs. Unlike FW_CFG_E820_TABLE it has no count though as the number of entries can be figured from the file size.

---
 hw/i386/pc.c | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)
hw/i386/pc.c +28 -11
index dee409d..a653ae4 100644
@@ -90,7 +90,9 @@ struct e820_table {
     struct e820_entry entry[E820_NR_ENTRIES];
 } QEMU_PACKED __attribute((__aligned__(4)));
 
-static struct e820_table e820_table;
+static struct e820_table e820_reserve;
+static struct e820_entry *e820_table;
+static unsigned e820_entries;
 struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
 
 void gsi_handler(void *opaque, int n, int level)
@@ -577,19 +579,32 @@ static void handle_a20_line_change(void *opaque, int irq, int level)
 
 int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
 {
-    int index = le32_to_cpu(e820_table.count);
+    int index = le32_to_cpu(e820_reserve.count);
     struct e820_entry *entry;
 
-    if (index >= E820_NR_ENTRIES)
-        return -EBUSY;
-    entry = &e820_table.entry[index++];
+    if (type != E820_RAM) {
+        /* old FW_CFG_E820_TABLE entry -- reservations only */
+        if (index >= E820_NR_ENTRIES) {
+            return -EBUSY;
+        }
+        entry = &e820_reserve.entry[index++];
+
+        entry->address = cpu_to_le64(address);
+        entry->length = cpu_to_le64(length);
+        entry->type = cpu_to_le32(type);
+
+        e820_reserve.count = cpu_to_le32(index);
+    }
 
-    entry->address = cpu_to_le64(address);
-    entry->length = cpu_to_le64(length);
-    entry->type = cpu_to_le32(type);
+    /* new "etc/e820" file -- include ram too */
+    e820_table = g_realloc(e820_table,
+                           sizeof(struct e820_entry) * (e820_entries+1));
+    e820_table[e820_entries].address = cpu_to_le64(address);
+    e820_table[e820_entries].length = cpu_to_le64(length);
+    e820_table[e820_entries].type = cpu_to_le32(type);
+    e820_entries++;
 
-    e820_table.count = cpu_to_le32(index);
-    return index;
+    return e820_entries;
 }
 
 /* Calculates the limit to CPU APIC ID values
@@ -640,7 +655,9 @@ static FWCfgState *bochs_bios_init(void)
         fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
                          smbios_table, smbios_len);
     fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
-                     &e820_table, sizeof(e820_table));
+                     &e820_reserve, sizeof(e820_reserve));
+    fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
+                    sizeof(struct e820_entry) * e820_entries);
 
     fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg));
     /* allocate memory for the NUMA channel: one (64bit) word for the number
Signature · 1 line
1.8.4.rc3
#2 lore raw

Re: [Qemu-devel] [PATCH 01/80] pc: add etc/e820 fw_cfg file

Sorry all, some confusion using git-publish, apologies for the spam.

Charlie

#3 lore raw

PATCH 2/80 pc: register e820 entries for ram

In reply to Charlie Shepherd

From: Gerd Hoffmann <[email protected]>

So RAM shows up in the new etc/e820 fw_cfg file.

---
 hw/i386/pc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
hw/i386/pc.c +1 -7
index a653ae4..12c436e 100644
@@ -1174,13 +1174,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
     memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,
                              0, below_4g_mem_size);
     memory_region_add_subregion(system_memory, 0, ram_below_4g);
-    if (0) {
-        /*
-         * Ideally we should do that too, but that would ruin the e820
-         * reservations added by seabios before initializing fw_cfg.
-         */
-        e820_add_entry(0, below_4g_mem_size, E820_RAM);
-    }
+    e820_add_entry(0, below_4g_mem_size, E820_RAM);
     if (above_4g_mem_size > 0) {
         ram_above_4g = g_malloc(sizeof(*ram_above_4g));
         memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram,
Signature · 1 line
1.8.4.rc3