diff mbox

[RFC,v0,1/5] spapr: Provide better error message when slots exceed max allowed

Message ID 1438580143-587-2-git-send-email-bharata@linux.vnet.ibm.com
State New
Headers show

Commit Message

Bharata B Rao Aug. 3, 2015, 5:35 a.m. UTC
Currently when user specifies more slots than allowed max of
SPAPR_MAX_RAM_SLOTS (32), we error out like this:

qemu-system-ppc64: unsupported amount of memory slots: 64

Let the user know about the max allowed slots like this:

qemu-system-ppc64: Specified number of memory slots 64 exceeds max supported 32

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Gibson Aug. 3, 2015, 6:43 a.m. UTC | #1
On Mon, Aug 03, 2015 at 11:05:39AM +0530, Bharata B Rao wrote:
> Currently when user specifies more slots than allowed max of
> SPAPR_MAX_RAM_SLOTS (32), we error out like this:
> 
> qemu-system-ppc64: unsupported amount of memory slots: 64
> 
> Let the user know about the max allowed slots like this:
> 
> qemu-system-ppc64: Specified number of memory slots 64 exceeds max supported 32
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

So, this is good as far as it goes.  There's another problem here
though.

At present even requesting 32 slots will not work properly, because
KVM only supports 32 slots and a couple of those are already used for
the non-hotplug RAM.  I think fixing this requires a kernel change to
advertise the available KVM memory slots.

> ---
>  hw/ppc/spapr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 6e24bf9..6d9cbd9 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1777,8 +1777,8 @@ static void ppc_spapr_init(MachineState *machine)
>          ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
>  
>          if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
> -            error_report("unsupported amount of memory slots: %"PRIu64,
> -                          machine->ram_slots);
> +            error_report("Specified number of memory slots %"PRIu64" exceeds max supported %d\n",
> +                         machine->ram_slots, SPAPR_MAX_RAM_SLOTS);
>              exit(EXIT_FAILURE);
>          }
>
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6e24bf9..6d9cbd9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1777,8 +1777,8 @@  static void ppc_spapr_init(MachineState *machine)
         ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
 
         if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
-            error_report("unsupported amount of memory slots: %"PRIu64,
-                          machine->ram_slots);
+            error_report("Specified number of memory slots %"PRIu64" exceeds max supported %d\n",
+                         machine->ram_slots, SPAPR_MAX_RAM_SLOTS);
             exit(EXIT_FAILURE);
         }