diff mbox series

[v4,08/12] tests/qtest/migration: Specify the geometry of the bootsector

Message ID 20231018192741.25885-9-farosas@suse.de
State New
Headers show
Series tests/migration-test: Allow testing older machine types | expand

Commit Message

Fabiano Rosas Oct. 18, 2023, 7:27 p.m. UTC
We're about to enable the x86_64 tests to run with the q35 machine,
but that machine does not work with the program we use to dirty the
memory for the tests.

The issue is that QEMU needs to guess the geometry of the "disk" we
give to it and the guessed geometry doesn't pass the sanity checks
done by SeaBIOS. This causes SeaBIOS to interpret the geometry as if
needing a translation from LBA to CHS and SeaBIOS ends up miscomputing
the number of cylinders and aborting due to that.

The reason things work with the "pc" machine is that is uses ATA
instead of AHCI like q35 and SeaBIOS has an exception for ATA that
ends up skipping the sanity checks and ignoring translation
altogether.

Workaround this situation by specifying a geometry in the command
line.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/migration-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Huth Oct. 19, 2023, 6:28 a.m. UTC | #1
On 18/10/2023 21.27, Fabiano Rosas wrote:
> We're about to enable the x86_64 tests to run with the q35 machine,
> but that machine does not work with the program we use to dirty the
> memory for the tests.
> 
> The issue is that QEMU needs to guess the geometry of the "disk" we
> give to it and the guessed geometry doesn't pass the sanity checks
> done by SeaBIOS. This causes SeaBIOS to interpret the geometry as if
> needing a translation from LBA to CHS and SeaBIOS ends up miscomputing
> the number of cylinders and aborting due to that.
> 
> The reason things work with the "pc" machine is that is uses ATA
> instead of AHCI like q35 and SeaBIOS has an exception for ATA that
> ends up skipping the sanity checks and ignoring translation
> altogether.
> 
> Workaround this situation by specifying a geometry in the command
> line.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/migration-test.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 43d0b83771..b45a389de8 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -757,7 +757,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>       if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
>           memory_size = "150M";
>           machine_alias = "pc";
> -        arch_opts = g_strdup_printf("-drive file=%s,format=raw", bootpath);
> +        arch_opts = g_strdup_printf(
> +            "-drive if=none,id=d0,file=%s,format=raw "
> +            "-device ide-hd,drive=d0,secs=1,cyls=1,heads=1", bootpath);
>           start_address = X86_TEST_MEM_START;
>           end_address = X86_TEST_MEM_END;
>       } else if (g_str_equal(arch, "s390x")) {

Acked-by: Thomas Huth <thuth@redhat.com>
Juan Quintela Oct. 19, 2023, 11:59 a.m. UTC | #2
Fabiano Rosas <farosas@suse.de> wrote:
> We're about to enable the x86_64 tests to run with the q35 machine,
> but that machine does not work with the program we use to dirty the
> memory for the tests.
>
> The issue is that QEMU needs to guess the geometry of the "disk" we
> give to it and the guessed geometry doesn't pass the sanity checks
> done by SeaBIOS. This causes SeaBIOS to interpret the geometry as if
> needing a translation from LBA to CHS and SeaBIOS ends up miscomputing
> the number of cylinders and aborting due to that.
>
> The reason things work with the "pc" machine is that is uses ATA
> instead of AHCI like q35 and SeaBIOS has an exception for ATA that
> ends up skipping the sanity checks and ignoring translation
> altogether.
>
> Workaround this situation by specifying a geometry in the command
> line.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>

Reviewed-by: Juan Quintela <quintela@redhat.com>
diff mbox series

Patch

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 43d0b83771..b45a389de8 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -757,7 +757,9 @@  static int test_migrate_start(QTestState **from, QTestState **to,
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         memory_size = "150M";
         machine_alias = "pc";
-        arch_opts = g_strdup_printf("-drive file=%s,format=raw", bootpath);
+        arch_opts = g_strdup_printf(
+            "-drive if=none,id=d0,file=%s,format=raw "
+            "-device ide-hd,drive=d0,secs=1,cyls=1,heads=1", bootpath);
         start_address = X86_TEST_MEM_START;
         end_address = X86_TEST_MEM_END;
     } else if (g_str_equal(arch, "s390x")) {