Page MenuHomeFreeBSD

LinuxKPI: always use contig allocations in linux_alloc_kmem()
AcceptedPublic

Authored by bz on Sep 12 2024, 9:25 PM.
Tags
None
Referenced Files
F109175170: D46661.diff
Sat, Feb 1, 6:47 PM
Unknown Object (File)
Thu, Jan 30, 5:29 PM
Unknown Object (File)
Mon, Jan 27, 11:45 PM
Unknown Object (File)
Mon, Jan 20, 9:39 AM
Unknown Object (File)
Sun, Jan 12, 1:12 AM
Unknown Object (File)
Nov 12 2024, 3:43 PM
Unknown Object (File)
Oct 26 2024, 5:36 AM
Unknown Object (File)
Oct 24 2024, 12:48 AM

Details

Reviewers
jhb
dumbbell
Group Reviewers
linuxkpi
Summary

In linux_alloc_kmem() [used by *get_page*()] we always at least allocate
PAGE_SIZE and we want the allocation to be contiguous so it can be passed
to DMA. Always use kmem_alloc_contig() and only change the low argument
depending on the GFP_DMA32 flag being given or not.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 59470
Build 56357: arc lint + arc unit

Event Timeline

bz requested review of this revision.Sep 12 2024, 9:25 PM

I just built a kernel with this patch and will use it starting from tomorrow.

The documentation is not entirely clear, but both core-api/dma-api-howto.rst and kernel-hacking/hacking.rst do imply that these functions allocate contiguous memory. Also, the PMAP_HAS_DMAP version in the caller of this function is careful to allocate contiguous memory always.

This revision is now accepted and ready to land.Wed, Jan 29, 9:42 PM

After three days of using it, I didn’t see any regressions.