Page MenuHomeFreeBSD

uma: Make the cache alignment mask unsigned
ClosedPublic

Authored by olce on Oct 17 2023, 2:58 PM.
Tags
None
Referenced Files
F102641652: D42262.diff
Fri, Nov 15, 5:42 AM
Unknown Object (File)
Tue, Nov 12, 1:46 PM
Unknown Object (File)
Tue, Nov 12, 1:46 PM
Unknown Object (File)
Tue, Nov 12, 1:46 PM
Unknown Object (File)
Mon, Nov 11, 5:18 AM
Unknown Object (File)
Sat, Oct 19, 7:44 PM
Unknown Object (File)
Sat, Oct 19, 7:44 PM
Unknown Object (File)
Sat, Oct 19, 7:44 PM

Details

Summary

In uma_set_align_mask(), ensure that the passed value doesn't have its
highest bit set, which would lead to problems since keg/zone alignment
is internally stored as signed integers. Such big values do not make
sense anyway and indicate some programming error. A future commit will
introduce checks for this case and other ones.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

In uma_set_align_mask(), check that the passed value doesn't have its
highest bit set, which would lead to problems since keg/zone alignment
is internally stored as signed integers. Such big values do not make
sense anyway and indicate some programming error.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Oct 17 2023, 2:58 PM
sys/arm/arm/cpufunc.c
64–65

As a matter of style I think we prefer to write "unsigned int", though this is admittedly not documented anywhere AFAIK.

sys/vm/uma_core.c
3258–3264

I think some comment or assertion here is appropriate.

sys/vm/uma_core.c
3258–3264

As I noted in other place, this should really assert that the mask is 2^x - 1.

olce marked 3 inline comments as done.
olce edited the summary of this revision. (Show Details)

unsigned => unsigned int

sys/vm/uma_core.c
3258–3264

I didn't because this piece of code is changed by a subsequent commit. But ok, here's one.

3258–3264

Yes, already done in a subsequent commit (see D42263).

This revision is now accepted and ready to land.Oct 19 2023, 12:05 PM

The header sys/vm/_uma_align_mask.h has been renamed to sys/vm/uma_align_mask.h in D42258. Not updating the diff here.

This revision was automatically updated to reflect the committed changes.