Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include kernels >= 5.1.0 (CentOS Stream release 9) #191

Closed
wants to merge 3 commits into from

Conversation

amichelotti
Copy link

On my mrf delivered with CentOS Stream release 9:
/opt/epics/modules/mrfioc2/mrmShared/linux/uio_mrf.c:129:19: error: assignment of read-only member ‘vm_flags’
129 | vma->vm_flags |= VM_IO | VM_RESERVED;

Fixed just applying the patch also to kernels >= 5.1.0

@gabrielfedel
Copy link
Contributor

gabrielfedel commented Oct 30, 2024

@amichelotti , it seems something is not right. I have being compiling the kernel driver for kernel 5.15 without problem.
You can see with your change the build fails on kernel 5.9.6 : https://github.com/epics-modules/mrfioc2/actions/runs/11590754198/job/32285612288?pr=191

Which exactly version is your kernel ?

@gabrielfedel gabrielfedel self-assigned this Oct 30, 2024
@amichelotti
Copy link
Author

amichelotti commented Oct 30, 2024 via email

@mdavidsaver
Copy link
Collaborator

I think vm_flags_set() was introduced by torvalds/linux@bc292ab before v6.3-rc1.

Now the story may be more complicated if this change has been backported by some distributor. Since it is an inline function, not a macro, I don't see a simple way to test for this possibility.

@amichelotti
Copy link
Author

Hi @mdavidsaver, you’re absolutely right! Apologies for submitting such an incorrect patch. I hadn’t realized that distributors can create customized versions of the Linux kernel in such a way. I've just received three utca crates with unfortunately centos 9, previous were centos 7.9 (everything ok).

this is one of the lines of the 'customized'  kernel by Centos where they introduced vm_flags_set:

/usr/src/kernels/5.14.0-522.el9.x86_64/include/linux/mm.h:static inline void vm_flags_set(struct vm_area_struct *vma,

that as @gabrielfedel detected is not present in the kernels 5.9 (also following).
Probably the best thing to capture also this situation could be to introduce a macro USE_VM_FLAGS_SET that can be set in the makefile to avoid compilation errors with this distribution (maybe other do this things?):

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) || defined(USE_VM_FLAGS_SET)
   vm_flags_set(vma, VM_IO | VM_RESERVED);
#else
   vma->vm_flags |= VM_IO | VM_RESERVED;
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants