Page MenuHomeFreeBSD

busdma: Always initialize bounce page STAILQ
AcceptedPublic

Authored by sanastasio_raptorengineering.com on Wed, Jan 22, 11:50 PM.
Referenced Files
Unknown Object (File)
Tue, Jan 28, 7:26 AM
Unknown Object (File)
Mon, Jan 27, 11:28 PM
Unknown Object (File)
Mon, Jan 27, 12:39 PM
Unknown Object (File)
Sun, Jan 26, 4:59 PM
Unknown Object (File)
Thu, Jan 23, 7:16 AM
Unknown Object (File)
Thu, Jan 23, 12:03 AM
Unknown Object (File)
Thu, Jan 23, 12:02 AM
Unknown Object (File)
Thu, Jan 23, 12:01 AM

Details

Reviewers
jhibbits
jhb
markj
Group Reviewers
PowerPC
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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Thu, Jan 23, 1:48 PM

FYI, all other arches unconditionally STAILQ_INIT() the list in allocated maps. 32-bit arm initializes the list twice which is somewhat confusing.