Page MenuHomeFreeBSD

Return errors in bus_dmamap_load
AbandonedPublic

Authored by kjopek_gmail.com on Jan 20 2021, 10:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 2, 11:46 PM
Unknown Object (File)
Sun, Jul 27, 6:52 AM
Unknown Object (File)
Sat, Jul 26, 3:40 PM
Unknown Object (File)
Fri, Jul 25, 3:16 AM
Unknown Object (File)
Thu, Jul 24, 5:43 AM
Unknown Object (File)
Sat, Jul 19, 3:14 PM
Unknown Object (File)
Sat, Jul 19, 10:32 AM
Unknown Object (File)
Fri, Jul 18, 9:06 AM
Subscribers
None

Details

Reviewers
mmel
manu
kib
Summary

Function bus_dmamap_load returned only two different errors: EINPROGRESS and ENOMEM.
However, some implementations (arm64 notably) provide more errors here. Do not limit set of errors
bus_dmamap_load returns.

While here: hint compiler on fast path in the code.

Test Plan

Tested on RockPro64.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kjopek_gmail.com created this revision.

Kib, this error handling doesn't make sense to me, so I had to miss something important. Can you, please, explain me the context/reason for this strange kind of errors hiding? Moreover EBIG is also allowed in man page.

sys/kern/subr_bus_dma.c
405

Style. Assuming that this will be applied to all bus_dmamap_load<foo>() variants.

437

(error = 0)

In D28261#632241, @mmel wrote:

Kib, this error handling doesn't make sense to me, so I had to miss something important. Can you, please, explain me the context/reason for this strange kind of errors hiding? Moreover EBIG is also allowed in man page.

EBIG is an error shown to callback. That said, I am not the author of this code and if I blamed for it, perhaps because I moved it around, nothing more.

I am certain that the intent is that callback should consume the error and make required arrangements. Blindly leaking something different than ENOMEM/EINPROGRESS from bus_dmamap_load() potentially breaks callers, they all must be inspected before.