Skip to contentSkip to conversation

hw/mem/pc-dimm: Fix error message if no slots were defined some more

PATCH In review Markus Armbruster 2 participants 3 messages Feb 22, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/mem/pc-dimm: Fix error message if no slots were defined some more

The error message added in commit 3ff333effa "pc-dimm: fix error messages if no slots were defined" is misleading:

    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1: no slots where allocated, please specify the 'slots' option
    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slots=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slots=0: Property 'pc-dimm.slots' not found

The property it called 'slot', not 'slots'. With that fixed, we get another bad error message:

    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slot=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slot=0: invalid slot number 0, valid range is [0-18446744073709551615]

Left for another day.

Fixes 3ff333effa319df6178f138d9cf32e3937419790
---
 hw/mem/pc-dimm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mem/pc-dimm.c +1 -1
index 48b913aba6..28fec00575 100644
@@ -115,7 +115,7 @@ static int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp)
 
     if (max_slots <= 0) {
         error_setg(errp, "no slots where allocated, please specify "
-                   "the 'slots' option");
+                   "the 'slot' option");
         return slot;
     }
 
Signature · 1 line
2.35.1
#1 lore raw
Quoted 8 lines · Markus Armbruster

The error message added in commit 3ff333effa "pc-dimm: fix error messages if no slots were defined" is misleading:

    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1: no slots where allocated, please specify the 'slots' option
    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slots=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slots=0: Property 'pc-dimm.slots' not found
Quoted 8 lines

The property it called 'slot', not 'slots'. With that fixed, we get another bad error message:

    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slot=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slot=0: invalid slot number 0, valid range is [0-18446744073709551615]

Left for another day.

We're referring to the "-m 2g,maxmem=8g,slots=5" slots parameter. And I agree that we can make that clearer somehow :)

Quoted 19 lines
Fixes 3ff333effa319df6178f138d9cf32e3937419790
---
 hw/mem/pc-dimm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mem/pc-dimm.c +1 -1
index 48b913aba6..28fec00575 100644
@@ -115,7 +115,7 @@ static int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp)
 
     if (max_slots <= 0) {
         error_setg(errp, "no slots where allocated, please specify "
-                   "the 'slots' option");
+                   "the 'slot' option");
         return slot;
     }
 
Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 12 lines · David Hildenbrand
Quoted 11 lines · Markus Armbruster

The error message added in commit 3ff333effa "pc-dimm: fix error messages if no slots were defined" is misleading:

    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1: no slots where allocated, please specify the 'slots' option
    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slots=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slots=0: Property 'pc-dimm.slots' not found

The property it called 'slot', not 'slots'. With that fixed, we get another bad error message:

Quoted 8 lines
Quoted 5 lines
    $ qemu-system-x86_64 -object memory-backend-file,id=mem1,size=1M,mem-path=1G.img -device pc-dimm,id=dimm1,memdev=mem1,slot=0
    qemu-system-x86_64: -device pc-dimm,id=dimm1,memdev=mem1,slot=0: invalid slot number 0, valid range is [0-18446744073709551615]

Left for another day.

We're referring to the "-m 2g,maxmem=8g,slots=5" slots parameter. And I agree that we can make that clearer somehow :)

Aha!

So this patch actually moves us sideways rather than forward. Please ignore it.

A patch that moves us forward would be nice :)