Page MenuHomeFreeBSD

kern: physmem: return errors in region inclusion/exclusion
AcceptedPublic

Authored by kevans on Nov 6 2021, 7:27 PM.
Tags
None
Referenced Files
F103015770: D32872.diff
Tue, Nov 19, 8:48 PM
F102988516: D32872.id.diff
Tue, Nov 19, 1:01 PM
F102969129: D32872.id98543.diff
Tue, Nov 19, 8:10 AM
Unknown Object (File)
Mon, Nov 18, 1:24 PM
Unknown Object (File)
Sun, Nov 17, 5:46 PM
Unknown Object (File)
Sat, Nov 16, 1:13 AM
Unknown Object (File)
Fri, Nov 8, 1:40 AM
Unknown Object (File)
Tue, Nov 5, 12:09 PM
Subscribers

Details

Reviewers
kib
markj
Summary

These have some failure modes, acknowledge that. If we run past the
end of hwregions, the caller should be able to detect that before it
potentially becomes a panic() later when attempting to populate
phys_avail.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42739
Build 39627: arc lint + arc unit

Event Timeline

kevans requested review of this revision.Nov 6 2021, 7:27 PM
sys/kern/subr_physmem.c
441

I recommend to not use ENOMEM for any allocation API return code, except for true 'out of memory' conditions. There we are out of items, and users often cannot tell the difference.

461–462

Was the intent to change this panic to some error return?

sys/kern/subr_physmem.c
441

Hmm... E2BIG, maybe? ERANGE could make sense, but I already used that above to indicate out-of-bounds range.

461–462

Whoops, yeah, that one should also toss back an error and let the caller panic if they want to.

ENOMEM -> ENOBIG, don't panic in exclusion case

sys/kern/subr_physmem.c
404

What would caller do in case of this error? Is it supposed to somehow ignore it?

405

There seems to be two spaces before '='

kevans added inline comments.
sys/kern/subr_physmem.c
404

The caller can't really do anything about it and they typically won't do anything to sanity check what's been added to phys_avail, so I suppose this should just be a silent return 0.

Don't return error for short page @ 0x0, fix spacing

This revision is now accepted and ready to land.Nov 21 2021, 3:17 PM