[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/34] pseries: Set hash table size based on RAM siz
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 26/34] pseries: Set hash table size based on RAM size |
Date: |
Thu, 4 Oct 2012 15:56:48 +0200 |
From: David Gibson <address@hidden>
Currently the pseries machine code always attempts to set the size of the
guests's hash page table to 16MB. However, because of the way the POWER
MMU works, a suitable hash page table size should really depend on memory
size. 16MB will be excessive for guests with <1GB and RAM, and may not be
enough for guests with >2GB of RAM (depending on guest page size and
other factors).
The usual given rule of thumb is that the hash table should be 1/64 of
the size of memory, but in fact the Linux guests we are aiming at don't
really need that much. This patch, therefore, changes the hash table
allocation code to aim for 1/128 of the size of RAM (rounding up). When
using KVM, this size may still be adjusted by the host kernel if it is
unable to allocate a suitable (contiguous) table.
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/spapr.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/spapr.c b/hw/spapr.c
index 1177efa..a8bd3c1 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -725,9 +725,16 @@ static void ppc_spapr_init(ram_addr_t ram_size,
spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE;
load_limit = spapr->fdt_addr - FW_OVERHEAD;
- /* For now, always aim for a 16MB hash table */
- /* FIXME: we should change this default based on RAM size */
- spapr->htab_shift = 24;
+ /* We aim for a hash table of size 1/128 the size of RAM. The
+ * normal rule of thumb is 1/64 the size of RAM, but that's much
+ * more than needed for the Linux guests we support. */
+ spapr->htab_shift = 18; /* Minimum architected size */
+ while (spapr->htab_shift <= 46) {
+ if ((1ULL << (spapr->htab_shift + 7)) >= ram_size) {
+ break;
+ }
+ spapr->htab_shift++;
+ }
/* init CPUs */
if (cpu_model == NULL) {
--
1.6.0.2
- [Qemu-devel] [PATCH 12/34] pseries: Use new method to correct reset sequence, (continued)
- [Qemu-devel] [PATCH 12/34] pseries: Use new method to correct reset sequence, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 10/34] ppc: Make kvm_arch_put_registers() put *all* the registers, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 18/34] pseries: Remove C bitfields from xics code, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 22/34] pseries: Fix semantics of RTAS int-on, int-off and set-xive functions, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 19/34] pseries: Remove XICS irq type enum type, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 21/34] pseries: Rework implementation of TCE bypass, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 13/34] pseries: Add support for new KVM hash table control call, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 20/34] pseries: Remove never used flags field from spapr vio devices, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 24/34] ppc405_uc: Fix buffer overflow, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 31/34] PPC: e500: increase DTC_LOAD_PAD, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 26/34] pseries: Set hash table size based on RAM size,
Alexander Graf <=
- [Qemu-devel] [PATCH 25/34] pseries: Remove unnecessary locking from PAPR hash table hcalls, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 27/34] target-ppc: Remove unused power_mode field from cpu state, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 23/34] target-ppc: KVM: Fix some kernel version edge cases for kvmppc_reset_htab(), Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 28/34] target-ppc: Extend FPU state for newer POWER CPUs, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 32/34] PPC: e500: calculate initrd_base like dt_base, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 34/34] ppc/pseries: Reset VPA registration on CPU reset, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 33/34] pseries: Don't test for MSR_PR for hypercalls under KVM, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 29/34] fdt: move dumpdtb interpretation code to device_tree.c, Alexander Graf, 2012/10/04
- [Qemu-devel] [PATCH 30/34] device tree: simplify dumpdtb code, Alexander Graf, 2012/10/04
- Re: [Qemu-devel] [PULL 00/34] ppc patch queue 2012-10-04, Aurelien Jarno, 2012/10/06