Page MenuHomeFreeBSD

Lock busdma operations and serialize detach with open/close
ClosedPublic

Authored by marcel on Jun 24 2019, 3:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 1:08 PM
Unknown Object (File)
Thu, Mar 28, 4:50 PM
Unknown Object (File)
Jan 17 2024, 11:43 AM
Unknown Object (File)
Dec 23 2023, 5:44 PM
Unknown Object (File)
Dec 20 2023, 2:53 AM
Unknown Object (File)
Nov 1 2023, 6:42 AM
Unknown Object (File)
Jul 29 2023, 6:44 AM
Unknown Object (File)
Jul 14 2023, 11:28 AM
Subscribers
None

Details

Reviewers
remko
emaste
gordon
markj
Group Reviewers
secteam
Summary

admbugs: 782

Test Plan

% sudo python2 /usr/src/tools/bus_space/examples/am79c900_diag.py
DEBUG:root:pcicfg=0 (pci0:2:1:0)
DEBUG:root:io=0 (pci0:2:1:0)
INFO:root:ethernet address = 00:0c:29:d9:ef:0d
DEBUG:root:DMA memory: size = 0x8000 (TX buffers: 4, RX buffers: 16)
DEBUG:root:DMA memory: CPU address: 0x8013cc000, device address: 0x133f6000
DEBUG:root:Waiting for initialization to complete
INFO:root:DHCP discovery packet sent
DEBUG:root:Waiting 2 seconds for an offer to be received
DEBUG:root:RX #0: broadcast packet: length 66
DEBUG:root:RX #1: broadcast packet: length 64
DEBUG:root:RX 2: packet from 00:50:56:e8:00:8e!
INFO:root:Our IP address = 172.16.188.134
DEBUG:root:RX #3: broadcast packet: length 64
DEBUG:root:RX #4: broadcast packet: length 64

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25121
Build 23819: arc lint + arc unit

Event Timeline

sys/dev/proto/proto.h
40

The two values of a signed 1-bit bitfield are 0 and -1. I don't think that causes any problems in this diff, but it's probably better to use unsigned fields just in case.

This looks ok to me modulo the one lingering WAITOK allocation under the busdma mutex. I don't see any reason not to use an sx lock for that though, in which case you could avoid the refactoring needed to do preallocation.

sys/dev/proto/proto_busdma.c
192

This is a WAITOK allocation unless you explicitly specify BUS_DMA_NOWAIT.

This revision is now accepted and ready to land.Jun 24 2019, 3:54 PM

Use sx instead of mtx to allow M_WAITOK allocations

This revision now requires review to proceed.Jun 29 2019, 3:31 PM
marcel added inline comments.
sys/dev/proto/proto_busdma.c
192

Good catch, thanks!

This revision is now accepted and ready to land.Jul 2 2019, 2:04 PM