Page MenuHomeFreeBSD

Lock busdma operations and serialize detach with open/close
AcceptedPublic

Authored by marcel on Jun 24 2019, 3:52 AM.

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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 25121
Build 23819: arc lint + arc unit

Event Timeline

marcel created this revision.Jun 24 2019, 3:52 AM
markj added inline comments.Jun 24 2019, 6:36 AM
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.

markj accepted this revision.Jun 24 2019, 3:54 PM

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
marcel updated this revision to Diff 59196.Jun 29 2019, 3:31 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 marked 2 inline comments as done.Jun 29 2019, 3:32 PM
marcel added inline comments.
sys/dev/proto/proto_busdma.c
192

Good catch, thanks!

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