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)
Jun 23 2024, 8:08 PM
Unknown Object (File)
May 25 2024, 10:08 PM
Unknown Object (File)
May 21 2024, 8:15 PM
Unknown Object (File)
May 21 2024, 7:42 PM
Unknown Object (File)
Apr 17 2024, 7:52 AM
Unknown Object (File)
Apr 17 2024, 7:51 AM
Unknown Object (File)
Mar 15 2024, 4:37 AM
Unknown Object (File)
Feb 26 2024, 7:59 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.