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

Accommodate Red Hat’s kernel backports on CentOS Stream release 9 #192

Closed
wants to merge 6 commits into from

Conversation

amichelotti
Copy link

Sorry again for my previous patch. Here a more reasoned patch to solve driver compilation failure on CentOS Stream release 9.

@Insomnia1437
Copy link
Contributor

Using RHEL_RELEASE_CODE seems being a bad idea, because it fails on AlmaLinux 9

/home/acc/workspace/mrfioc2-vmflags/mrmShared/linux/uio_mrf.c: In function ‘mrf_mmap_physical’:
/home/acc/workspace/mrfioc2-vmflags/mrmShared/linux/uio_mrf.c:127:5: error: implicit declaration of function ‘vm_flags_set’ [-Werror=implicit-function-declaration]
  127 |     vm_flags_set(vma, VM_IO | VM_RESERVED);
      |     ^~~~~~~~~~~~
cc1: some warnings being treated as errors

I checked AlmaLinux 9.4 and RockyLinux 9.4, neither of them backports vm_flags_set, but they have these definitions:

#define RHEL_MAJOR 9
#define RHEL_MINOR 4
#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
#define RHEL_RELEASE_CODE 2308

@jerzyjamroz
Copy link
Contributor

jerzyjamroz commented Oct 31, 2024

@Insomnia1437 , good catch. What does grep "^NAME=" /etc/os-release return on each of your distros?
@amichelotti , what does it return for you?

@Insomnia1437
Copy link
Contributor

# On AlmaLinux
NAME="AlmaLinux"
# On RockyLinux
NAME="Rocky Linux"
# On CentOS Stream 9
NAME="CentOS Stream"

@amichelotti
Copy link
Author

amichelotti commented Oct 31, 2024

it returns:
NAME="CentOS Stream"
However it's a big mess with this backports.. RHEL_RELEASE_CODE is something that has some meaning across rhel distros?

here my numbers:

#define LINUX_VERSION_CODE 331264
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define LINUX_VERSION_MAJOR 5
#define LINUX_VERSION_PATCHLEVEL 14
#define LINUX_VERSION_SUBLEVEL 0
#define RHEL_MAJOR 9
#define RHEL_MINOR 6
#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
#define RHEL_RELEASE_CODE 2310
#define RHEL_RELEASE "522"

@jerzyjamroz
Copy link
Contributor

# On AlmaLinux
NAME="AlmaLinux"
# On RockyLinux
NAME="Rocky Linux"
# On CentOS Stream 9
NAME="CentOS Stream"

Could you check also: grep "^ID=" /etc/os-release?

@Insomnia1437
Copy link
Contributor

Rocky

NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"

Alma

NAME="AlmaLinux"
VERSION="9.4 (Seafoam Ocelot)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.4 (Seafoam Ocelot)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"
SUPPORT_END=2032-06-01

CentOS Stream 9

NAME="CentOS Stream"
VERSION="9"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="9"
PLATFORM_ID="platform:el9"
PRETTY_NAME="CentOS Stream 9"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:centos:centos:9"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://issues.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

@jerzyjamroz
Copy link
Contributor

@Insomnia1437 , @amichelotti - as I do not have a possibility to test it, could you do that for your Linux distros using the branch below:
https://github.com/jerzyjamroz/mrfioc2/tree/c9

@amichelotti
Copy link
Author

@jerzyjamroz tried, it worked, thanks! what is USE_VM_FLAGS_WRAPPER?

@Insomnia1437
Copy link
Contributor

@jerzyjamroz it works on AlmaLinux 9.4

@jerzyjamroz
Copy link
Contributor

jerzyjamroz commented Nov 1, 2024

@amichelotti , I added USE_VM_FLAGS_WRAPPER to allow back-ported distributions (at the moment only CentOS stream).

It would be good if community members added their OS-es to: https://github.com/epics-modules/mrfioc2/blob/master/.github/workflows
otherwise, in theory, those are not supported :)

@@ -123,7 +123,7 @@ int mrf_mmap_physical(struct uio_info *info, struct vm_area_struct *vma)
return -EINVAL;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) || (defined(RHEL_RELEASE_CODE) && (RHEL_RELEASE_CODE >= 906))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 906 meant to be 0x906, or better yet RHEL_RELEASE_VERSION(9,6)?

The situation seems to me confusing enough to merit a comment describing what we think happened.

/* vm_flags_set() function introduced in upstream Linux 6.3.
 * Backported to RHEL 9.6 ???
 */

Has anyone found a reference for how RHEL_RELEASE_VERSION progresses wrt. distribution versions? Or a summary of how it diverges for the various RHEL derivatives?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdavidsaver I haven't been using those distros but it looks like Rocky Linux and AlmaLinux don't backport but CentOS Stream does. All those 3 distros use the same macros.
I haven't found an easy solution but universal solution, so I am waiting for eventual proposals.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 906 meant to be 0x906, or better yet RHEL_RELEASE_VERSION(9,6)?

To be clear 906 == 0x38a == RHEL_RELEASE_VERSION(3, 138) is not what is intended. This is a bug. The condition needs to be on 0x906 or RHEL_RELEASE_VERSION(9,6).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far a "universal solution"... I think this would be difficult within the constraints of Make.

Our best case would be if RH and their competitors have a miraculous reconciliation. I wouldn't put money on this possibility. I think this leaves mrfioc2 to either 1) "delegate" handling of this situation to individual sites. Either as a one-line patch, or somehow defining an extra Make variable. (eg. make USR_CPPFLAGS=-DUSE_VM_FLAGS_WRAPPER) Or 2) trying to do test compilations like autoconf or cmake to see if vm_flags_set() exists. Possible with plain Make, but quite tedious.

Copy link
Contributor

@jerzyjamroz jerzyjamroz Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdavidsaver , I started a thread with the Centos Packaging Team discussion.fedoraproject. They wrote some conclusions.

@jerzyjamroz
Copy link
Contributor

@amichelotti , I think try to apply the comment of @mdavidsaver related to macros and then I think it can be merged. It means Alma and Rocky will not be supported for a few months (until they apply the Centos Stream patches (as explained by devs), then all compatible from that moment.

@amichelotti
Copy link
Author

@amichelotti , I think try to apply the comment of @mdavidsaver related to macros and then I think it can be merged. It means Alma and Rocky will not be supported for a few months (until they apply the Centos Stream patches (as explained by devs), then all compatible from that moment.
Ok that's sound good, it seems the only solution applicable other than not using this kind of distro. I'm more and more convinced to go for Ubuntu on our controls. Many thanks you all!

@amichelotti
Copy link
Author

amichelotti commented Nov 9, 2024

@jerzyjamroz patch is ok, thanks you all.

@amichelotti amichelotti closed this Nov 9, 2024
@jerzyjamroz
Copy link
Contributor

@amichelotti , what I wrote is that this what you are trying to do is ok. Why did you close the PR? Just apply the RHEL_RELEASE_VERSION(9,6) and test the things.

@amichelotti
Copy link
Author

amichelotti commented Nov 11, 2024 via email

@jerzyjamroz
Copy link
Contributor

@amichelotti , and adding your CI update once tested is useful as well.

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