Page MenuHomeFreeBSD

LinuxKPI: Adding functions to mmu_notifier.h to satisify requirements to compile kfd_process.c in amdkfd driver
Needs RevisionPublic

Authored by siri_racha.ca on Mon, Jul 13, 2:11 AM.
Referenced Files
F162574740: D58207.diff
Tue, Jul 14, 4:59 PM
Unknown Object (File)
Mon, Jul 13, 2:57 AM
Subscribers

Details

Reviewers
bz
Group Reviewers
linuxkpi
Summary

I'm working on getting kfd_proces.c working, and it uses quite a few functions from mmu_notifier in the LinuxKPI. I have added them in to allow the file to compile. I will note that I did not fully implement them, and have left a warning to expect issues if you execute the file.
https://github.com/ROCm/amdgpu/blob/8fa1981194836936acd57c4cf4b3fd694af47cc3/drivers/gpu/drm/amd/amdkfd/kfd_process.c

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bz requested changes to this revision.Mon, Jul 13, 8:14 AM
bz added a subscriber: bz.

I have https://reviews.freebsd.org/D58169 open in case you want to see a pr_debug() example file with a lot more stubbed only functions.

sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
30
#include <linux/kernel.h>     /* for pr_debug */
37

While clear, the #warning is not needed.

We have temporary placeholders in a lot of places in LinuxKPI. The important bit is that if return values are required, that they signal an error according to the API.

57

Where function arguments are no used, we could annotate them with __unused

59

Add before return:

pr_debug("%s TODO\n", __func__);

here and for all the functions below.

59

return (0); return values get ()

This revision now requires changes to proceed.Mon, Jul 13, 8:14 AM
sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
37

Sounds good, I'll remove the warning and make the other changes
But I am a bit concerned with just returning ENOSYS/ENOIMPL, because the driver might be bugged and not check the return value, and thus cause issues.
Beyond pr_debug(...) is there something else I can/should add in?

sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
37

Well, all you return is 0 and NULL so far. I'll comment on those two below. If a driver is bugged beyond expectations then bugs need to be fixed but that is for that code and not this one here ;-)

I know of nothing else to add beyond pr_debug().

59

-EINVAL is a valid return value for the function a driver needs to deal with, so you could use that.

70

ops != NULL && ... != NULL

return ()

73

return (ERR_PTR(-EINVAL)); should be fine here.

79

Same here. != NULL checks for style.

sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
37

Alright then, sounds good, I'll make the changes and add in pr_debug()
Thank you!

sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
37

@bz Before I make another revision, should I leave the comment above the warn in, or remove it?