Skip to contentSkip to conversation

hw/arm/boot: fix direct kernel boot setup

PATCH In review Andrew Jones 3 participants 8 messages Jun 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/boot: fix direct kernel boot setup

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -1
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

?

(if you agree I can just fix up the commit message when I apply it.)

thanks
-- PMM

#2 lore raw
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

Quoted 41 lines
Quoted 18 lines
---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

?

(if you agree I can just fix up the commit message when I apply it.)

thanks
-- PMM

#3 lore raw
In reply to Peter Maydell
Quoted 29 lines · Peter Maydell
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

Quoted 4 lines

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to pass environment variables to the guest. All the tests started to report FAIL.

Quoted 7 lines

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

Actually I think we need another fix for this error too. We weren't actually refusing do direct boot the kernel, but we should have been. We're missing the 'exit(1)' after the error message.

Quoted 4 lines

?

(if you agree I can just fix up the commit message when I apply it.)

I agree with the improved commit message if we also add the 'exit(1)', otherwise "refusing to boot" isn't the right thing to say.

Thanks,
drew

Quoted 4 lines

thanks
-- PMM

#4 lore raw
Quoted 48 lines · Andrew Jones
Quoted 29 lines · Peter Maydell
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

Quoted 4 lines

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to pass environment variables to the guest. All the tests started to report FAIL.

Quoted 7 lines

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

Quoted 4 lines

Actually I think we need another fix for this error too. We weren't actually refusing do direct boot the kernel, but we should have been. We're missing the 'exit(1)' after the error message.

Hmm, so we are. Do you want to send a v2 then, which fixes that too and fixes up the commit message?

thanks
-- PMM

#5 lore raw
Quoted 49 lines · Peter Maydell
Quoted 48 lines · Andrew Jones
Quoted 29 lines · Peter Maydell
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

Quoted 4 lines

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to pass environment variables to the guest. All the tests started to report FAIL.

Quoted 7 lines

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

Quoted 7 lines
Quoted 4 lines

Actually I think we need another fix for this error too. We weren't actually refusing do direct boot the kernel, but we should have been. We're missing the 'exit(1)' after the error message.

Hmm, so we are. Do you want to send a v2 then, which fixes that too and fixes up the commit message?

On it's way.

Thanks,
drew

Quoted 3 lines

thanks
-- PMM

#6 lore raw
Quoted 55 lines · Andrew Jones
Quoted 54 lines · Peter Maydell
Quoted 52 lines · Andrew Jones
Quoted 29 lines · Peter Maydell
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

Quoted 4 lines

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to pass environment variables to the guest. All the tests started to report FAIL.

Quoted 7 lines

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

Actually I think we need another fix for this error too. We weren't actually refusing do direct boot the kernel, but we should have been. We're missing the 'exit(1)' after the error message.

Quoted 5 lines
Quoted 2 lines

Hmm, so we are. Do you want to send a v2 then, which fixes that too and fixes up the commit message?

On it's way.

Argh, just fired it off by forgot the '-v2' on my format-patch so the subject tag won't be right. Sorry about that.

drew

#7 lore raw
In reply to Andrew Jones
Quoted 53 lines · Andrew Jones
Quoted 29 lines · Peter Maydell
Quoted 24 lines · Andrew Jones

We need to check ram_end, not ram_size.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/boot.c +1 -2
index b2f93f6beff6..8a280ab3ed49 100644
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
--
Quoted 1 line

2.20.1

Quoted 4 lines

I think I missed this because my test case doesn't have an initrd -- direct kernel boot works fine if all you're passing to QEMU is the kernel... I think we could clarify the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to pass environment variables to the guest. All the tests started to report FAIL.

Quoted 7 lines

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; this meant we were spuriously refusing to do a direct boot of a kernel in some cases if an initrd was also passed on the command line.

Actually I think we need another fix for this error too. We weren't actually refusing do direct boot the kernel, but we should have been. We're missing the 'exit(1)' after the error message.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

?

(if you agree I can just fix up the commit message when I apply it.)

I agree with the improved commit message if we also add the 'exit(1)', otherwise "refusing to boot" isn't the right thing to say.

Indeed. So for this patch + Peter comment + exit():