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
F78044150: D28261.diff
Mon, Feb 26, 7:59 PM
Unknown Object (File)
Jan 19 2024, 2:23 AM
Unknown Object (File)
Dec 23 2023, 12:32 AM
Unknown Object (File)
Dec 16 2023, 7:37 PM
Unknown Object (File)
Dec 13 2023, 6:20 AM
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
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.