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)
Aug 13 2023, 11:13 AM
Unknown Object (File)
Jul 2 2023, 8:05 AM
Unknown Object (File)
May 24 2023, 7:46 PM
Unknown Object (File)
May 3 2023, 10:37 PM
Unknown Object (File)
Apr 15 2023, 10:55 AM
Unknown Object (File)
Mar 20 2023, 9:33 AM
Unknown Object (File)
Mar 11 2023, 5:39 AM
Unknown Object (File)
Mar 4 2023, 9:19 PM
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.