Page MenuHomeFreeBSD

Fix a couple of issues in nm_os_extmem_create
ClosedPublic

Authored by vmaffione on Mar 17 2021, 9:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 1:56 AM
Unknown Object (File)
Mar 7 2024, 1:56 AM
Unknown Object (File)
Mar 7 2024, 12:52 AM
Unknown Object (File)
Mar 7 2024, 12:00 AM
Unknown Object (File)
Dec 22 2023, 11:18 PM
Unknown Object (File)
Dec 21 2023, 9:35 PM
Unknown Object (File)
Sep 3 2023, 1:15 PM
Unknown Object (File)
Jun 24 2023, 4:49 AM

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

vmaffione created this revision.
sys/dev/netmap/netmap_freebsd.c
740

If the processes mmapping it exit, then the /dev/netmap handle will be closed and the destructor will remove this mapping anyway. It looks like the real issue is that processes may munmap() the registered mapping?

768

I think this should really come after each failed vm_map_* call, before the goto.

Addressed reviewer comments

vmaffione added inline comments.
sys/dev/netmap/netmap_freebsd.c
740

If I understand correctly you are only suggesting a comment fix?

768

It should be equivalent, because all the gotos (except for the first) would pass here.
In any case, it's more readable as you suggest.

Code changes seem ok to me, thank you.

sys/dev/netmap/netmap_freebsd.c
740

Well, I believe the comment is wrong, but maybe I misunderstood. Like, is this kernel mapping ever actually accessed by netmap?

768

Right, this is just in case some code is added later which does not use Mach return codes.

This revision is now accepted and ready to land.Mar 19 2021, 5:24 PM

Il giorno ven 19 mar 2021 alle ore 18:24 markj (Mark Johnston) <
phabric-noreply@freebsd.org> ha scritto:

markj accepted this revision.
markj added a comment.
This revision is now accepted and ready to land.

Code changes seem ok to me, thank you.

INLINE COMMENTS

vmaffione wrote in netmap_freebsd.c:740
If I understand correctly you are only suggesting a comment fix?

Well, I believe the comment is wrong, but maybe I misunderstood. Like, is
this kernel mapping ever actually accessed by netmap?

It looks incorrect also to me. I think the kernel mapping is accessed by
netmap (kernel) at least to touch the netmap_ring structs, and initialize
netmap_if structs (in some cases, VALE can also touch the netmap buffers).
But I may be misunderstanding, since "extmem" is a kind of recent addition.
Maybe Giuseppe can shed a light on this matter.

vmaffione wrote in netmap_freebsd.c:768
It should be equivalent, because all the gotos (except for the first)

would pass here.

In any case, it's more readable as you suggest.

Right, this is just in case some code is added later which does not use
Mach return codes.

Sounds good, thanks.

CHANGES SINCE LAST ACTION

https://reviews.freebsd.org/D29318/new/

REVISION DETAIL

https://reviews.freebsd.org/D29318

EMAIL PREFERENCES

https://reviews.freebsd.org/settings/panel/emailpreferences/

To: vmaffione, markj, giuseppe.lettieri_unipi.it

Forgot to link the commit to this review.

It looks incorrect also to me. I think the kernel mapping is accessed by
netmap (kernel) at least to touch the netmap_ring structs, and initialize
netmap_if structs (in some cases, VALE can also touch the netmap buffers).
But I may be misunderstanding, since "extmem" is a kind of recent addition.
Maybe Giuseppe can shed a light on this matter.

You are both right and the new comment (mentioning munmap()) is correct.