HomeFreeBSD

busdma: Always initialize bounce page STAILQ

Description

busdma: Always initialize bounce page STAILQ

Summary:

Always call STAILQ_INIT in bus_dmamap_create regardless of whether
BUS_DMA_COULD_BOUNCE is set. This avoids tripping the assertions added
by commit 34740937f7a4 when the queue is checked with STAILQ_EMPTY in
free_bounce_pages.

Test Plan:
Without this patch applied, booting fails as follows (pseries guest on Linux/ppc64le KVM host):

vtblk0: <VirtIO Block Adapter> numa-domain 0 on virtio_pci1
panic: Empty stailq 0x8ed4480->stqh_last is 0, not head's first field address
cpuid = 0
time = 1
KDB: stack backtrace:
0xc00800000000bcc0: at kdb_backtrace+0x60
0xc00800000000bdd0: at vpanic+0x1d4
0xc00800000000be80: at panic+0x44
0xc00800000000beb0: at bus_dmamap_unload+0x394
0xc00800000000bf60: at vtblk_poll_request+0x16c
0xc00800000000bff0: at vtblk_attach_completed+0x208
0xc00800000000c220: at vtpci_legacy_probe_and_attach_child+0x224
0xc00800000000c270: at vtpci_legacy_attach+0x2c0
0xc00800000000c320: at device_attach+0x568
0xc00800000000c400: at bus_attach_children+0x8c
0xc00800000000c440: at ofw_pcibus_attach+0x398
0xc00800000000c550: at device_attach+0x568
0xc00800000000c630: at bus_attach_children+0x8c
0xc00800000000c670: at ofw_pcib_attach+0x68
0xc00800000000c6a0: at rtaspci_attach+0x18c
0xc00800000000c6f0: at device_attach+0x568
0xc00800000000c7d0: at bus_generic_new_pass+0x198
0xc00800000000c820: at bus_generic_new_pass+0x10c
0xc00800000000c870: at bus_generic_new_pass+0x10c
0xc00800000000c8c0: at root_bus_configure+0x6c
0xc00800000000c910: at configure+0x1c
0xc00800000000c940: at mi_startup+0x298
0xc00800000000ca50: at __start+0xfc
KDB: enter: panic
[ thread pid 0 tid 100000 ]
Stopped at kdb_enter+0x70: ori r0, r0, 0x0

With the patch applied to properly initialize the STAILQ unconditionally, the assertion is no longer hit and the system boots as expected.

Reviewers: jhibbits, jhb, PowerPC, markj

Reviewed By: jhibbits, jhb, PowerPC, markj

Subscribers: imp, bdragon, luporl, alfredo, PowerPC

Tags: PowerPC

Differential Revision: https://reviews.freebsd.org/D48600

Details

Provenance
sanastasio_raptorengineering.comAuthored on Sun, Feb 9, 5:27 PM
jhibbitsCommitted on Sun, Feb 9, 5:29 PM
Reviewer
PowerPC
Differential Revision
D48600: busdma: Always initialize bounce page STAILQ
Parents
rG1951235537fb: sysctl: Harden sysctl_handle_string() against unterminated string
Branches
Unknown
Tags
Unknown