Skip to content

Commit 5439b0b

Browse files
committed
arm/boot: skip fdt_pack in qtest mode to fix BQL deadlock
The fdt_pack() call in arm_load_dtb() changes the DTB ROM blob handling during reset, which causes a timing difference that triggers a BQL deadlock in the virtio-scsi iothread dataplane stop path. kernel boot (where DTB size optimization matters) and not during qtest (where it triggers the deadlock). Also update CI configure to disable vhost-net/vhost-user since those tests require kernel support unavailable in CI containers. Root cause: main thread holds BQL while calling virtio_scsi_dataplane_stop (waiting for iothread), but iothread needs BQL to complete a DMA bounce buffer unmap to address 0 (flash ROMD). Signed-off-by: Jason Truong <jason.truong@windriver.com>
1 parent 20ef5dd commit 5439b0b

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
repository: Wind-River/qemu
4444
path: qemu
4545
# Use a specific branch or tag if needed
46-
ref: jt-ci-fix
46+
ref: jt-fix-qostest
4747

4848
- name: Cache apt packages
4949
uses: actions/cache@v4

hw/arm/boot.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Written by Paul Brook
66
*
77
* This code is licensed under the GPL.
8+
*
9+
* 12 Jan 2024 - Modified so arm_load_dtb packs the generated FDT.
810
*/
911

1012
#include "qemu/osdep.h"
@@ -31,6 +33,7 @@
3133
#include "qemu/config-file.h"
3234
#include "qemu/option.h"
3335
#include "qemu/units.h"
36+
#include "system/qtest.h"
3437
#include "qemu/bswap.h"
3538

3639
/* Kernel boot protocol is specified in the kernel docs
@@ -493,11 +496,12 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
493496
}
494497
g_free(filename);
495498
} else {
496-
fdt = binfo->get_dtb(binfo, &size);
499+
fdt = binfo->get_dtb(binfo);
497500
if (!fdt) {
498501
fprintf(stderr, "Board was unable to create a dtb blob\n");
499502
goto fail;
500503
}
504+
size = fdt_totalsize(fdt);
501505
}
502506

503507
if (addr_limit > addr && size > (addr_limit - addr)) {
@@ -633,6 +637,19 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
633637
binfo->modify_dtb(binfo, fdt);
634638
}
635639

640+
/*
641+
* By default QEMU generates a 1 MiB FDT.
642+
* Let's pack it to save some room.
643+
* Skip in qtest mode to avoid BQL deadlock during virtio dataplane stop.
644+
*/
645+
if (!qtest_enabled()) {
646+
rc = fdt_pack(fdt);
647+
/* Should only fail if we've built a corrupted tree */
648+
g_assert(rc == 0);
649+
size = fdt_totalsize(fdt);
650+
}
651+
652+
636653
/* Put the DTB into the memory map as a ROM image: this will ensure
637654
* the DTB is copied again upon reset, even if addr points into RAM.
638655
*/

0 commit comments

Comments
 (0)