qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc/pnv: Warn when using -initrd and low ram
@ 2019-07-16  4:56 Joel Stanley
  2019-07-16  7:39 ` Cédric Le Goater
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2019-07-16  4:56 UTC (permalink / raw)
  To: Cédric Le Goater, David Gibson; +Cc: qemu-ppc, qemu-devel

When booting with the default amount of RAM the powernv machine will
load the initrd above the top of RAM and cause the Linux kernel to crash
when it attempts to access the initrd:

  Linux/PowerPC load:
  Finalizing device tree... flat tree at 0x202770c0
  [    0.070476] nvram: Failed to find or create lnx,oops-log partition, err -28
  [    0.073270] nvram: Failed to initialize oops partition!
  [    0.156302] BUG: Unable to handle kernel data access at 0xc000000060000000
  [    0.158009] Faulting instruction address: 0xc000000001002e5c
  cpu 0x0: Vector: 300 (Data Access) at [c00000003d1e3870]
      pc: c000000001002e5c: unpack_to_rootfs+0xdc/0x2f0
      lr: c000000001002df4: unpack_to_rootfs+0x74/0x2f0
      sp: c00000003d1e3b00
     msr: 9000000002009033
     dar: c000000060000000
   dsisr: 40000000
    current = 0xc00000003d1c0000
    paca    = 0xc000000001320000	 irqmask: 0x03	 irq_happened: 0x01
      pid   = 1, comm = swapper/0
  Linux version 5.2.0-10292-g040e2e618374 (joel@voyager) (gcc version 8.3.0 (Debian 8.3.0-2)) #1 SMP Tue Jul 16 13:50:32 ACST 2019
  enter ? for help
  [c00000003d1e3bb0] c000000001003c90 populate_rootfs+0x84/0x1dc
  [c00000003d1e3c40] c00000000000f494 do_one_initcall+0x88/0x1d0
  [c00000003d1e3d10] c000000001000fc4 kernel_init_freeable+0x24c/0x250
  [c00000003d1e3db0] c00000000000f7a0 kernel_init+0x1c/0x150
  [c00000003d1e3e20] c00000000000b8a4 ret_from_kernel_thread+0x5c/0x78

Provide a helpful message for users so they don't go reporting bugs to
kernel developers.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
We could solve this in other ways, such as warn when loading the initrd
outside of RAM, or load it within the known boundaries or RAM, but after
hitting this myself I wanted to start the discussion.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/ppc/pnv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index bd4531c82260..bbd596ab9eca 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -649,6 +649,13 @@ static void pnv_init(MachineState *machine)
 
     /* load initrd */
     if (machine->initrd_filename) {
+        if (machine->ram_size <= (1.5 * GiB)) {
+            /* INITRD_LOAD_ADDR is at 1.5GB, so we require at least that much RAM
+             * when specifying the initrd on the command line */
+            warn_report("initrd load requires > %ld MB of RAM",
+                    INITRD_LOAD_ADDR / MiB);
+        }
+
         pnv->initrd_base = INITRD_LOAD_ADDR;
         pnv->initrd_size = load_image_targphys(machine->initrd_filename,
                                   pnv->initrd_base, INITRD_MAX_SIZE);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-18  5:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-16  4:56 [Qemu-devel] [PATCH] ppc/pnv: Warn when using -initrd and low ram Joel Stanley
2019-07-16  7:39 ` Cédric Le Goater
2019-07-16  8:52   ` David Gibson
2019-07-18  5:09     ` Joel Stanley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).