Announcement

Collapse
No announcement yet.

Clang LTO Support Looks Like It Could Land For Linux 5.12

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by xpris View Post

    OpenMandriva ships Clang kernel as option in past release and Clang kernel should be default one in upcoming. So not that hard.
    Huh, you got a link to code that shows how they do it? I'm interested.

    Comment


    • #22
      Originally posted by leandrolnh View Post

      That's the discussion of the news: LTO with Clang is not in mainstream yet. I don't think xanmod has added support for it either.
      That's why you haven't found it.
      Yes. I thought there were in but not yet enabled. Looks like they're just about to get in. It somehow reads they're just about to be enabled for 5.12.
      I don't think xanmod would do this amount of work downstream but rely on upstream.

      Anyways, my bod^M script is ready.

      Comment


      • #23
        Originally posted by reba View Post
        Virtualbox will not work as the vboxdrv-module isn't loaded and has to be compiled manually.
        I made aptitude reinstall the virtualbox-dkms package but it fails when compiling for the active kernel.

        So I thought "Hm. Maybe the CC (which is usually gcc) for compiling the module does not like the Clang compiled kernel. So, what about compiling the module with Clang, too?"

        So I edited the Makefile of the vboxdrv to add the same compiler-options as for the kernel:
        Code:
        nano /usr/src/linux-headers-5.10.7-xanmod-llvm-native
        Just added these on top:
        Code:
        CC=clang
        HOSTCC=clang
        LLVM=1
        and the recompilation of the module worked!

        Trying
        Code:
        modprobe vboxdrv
        loaded the module without complains.
        Hi reba
        I have a similar problem where my vbox v6.1.22 fails to run any guests and its because the vboxdrv fails to compile through dkms.
        I naturally thought it was something for Virtualbox to fix so I filed a bug there... https://www.virtualbox.org/ticket/20425

        Not sure really who needs to fix this but it needs to get fixed, how are kernel modules going to get compile dynamically when changed if the Linux kernel is built with clang and lto=thin?

        How did you fix it? You mentioned you edited the Makefile of the vboxdrv but your quote above does a "nano" of the linux-header's Makefile? I'm a little confused and would appreciate if you could elaborate as I too would like to use clang lto'ed kernel. I've rolled back to gcc built kernel as I can't work without virtualbox.

        Thanks in advance!

        Comment


        • #24
          Originally posted by DanglingPointer View Post
          Thanks in advance!
          Hi there. I just re-played the stuff in my posting and made some adjustments.
          For example bison was missing as a dependency and I added some snippets and explainations.
          And, yes, you're supposed to edit the Makefile of the linux headers.

          The module zramswap also breaks *sigh* so there might be others as well that are in need for a recompile.
          Maybe, after all, I am doing something wrong?
          Code:
          Jul 10 13:26:33 debian root[12072]: Starting Zram
          Jul 10 13:26:33 debian zramswap[12072]: <13>Jul 10 13:26:33 root: Starting Zram
          Jul 10 13:26:33 debian zramswap[12074]: modprobe: FATAL: Module zram not found in directory /lib/modules/5.13.1-xanmod-llvm-native
          Jul 10 13:26:33 debian root[12075]: Error: inserting the zram kernel module
          Jul 10 13:26:33 debian zramswap[12075]: <13>Jul 10 13:26:33 root: Error: inserting the zram kernel module
          Jul 10 13:26:33 debian systemd[1]: zramswap.service: Main process exited, code=exited, status=1/FAILURE

          Comment


          • #25
            Originally posted by reba View Post

            Hi there. I just re-played the stuff in my posting and made some adjustments.
            For example bison was missing as a dependency and I added some snippets and explainations.
            And, yes, you're supposed to edit the Makefile of the linux headers.

            The module zramswap also breaks *sigh* so there might be others as well that are in need for a recompile.
            Maybe, after all, I am doing something wrong?
            Code:
            Jul 10 13:26:33 debian root[12072]: Starting Zram
            Jul 10 13:26:33 debian zramswap[12072]: <13>Jul 10 13:26:33 root: Starting Zram
            Jul 10 13:26:33 debian zramswap[12074]: modprobe: FATAL: Module zram not found in directory /lib/modules/5.13.1-xanmod-llvm-native
            Jul 10 13:26:33 debian root[12075]: Error: inserting the zram kernel module
            Jul 10 13:26:33 debian zramswap[12075]: <13>Jul 10 13:26:33 root: Error: inserting the zram kernel module
            Jul 10 13:26:33 debian systemd[1]: zramswap.service: Main process exited, code=exited, status=1/FAILURE
            So did your zram fail because dkms used gcc to try and compile it instead of "cc" aliasing clang?

            my vbox module is getting explicitly compiled by dkms with gcc and failing. switching cc to clang didn't do anything.

            I think this is a dkms issue. DKMS needs to use "cc" instead of explicit compiler calls to /usr/bin/gcc and it suite of tools

            No one is going to use llvm clang lto'ed kernels if this isn't sorted (other than those using openMandriva).

            Comment


            • #26
              dkms developers need to fix this!

              dkms needs to be able to dynamically figure out what build tools were used to build the kernel and use the same ones for the modules! Other's have had the same issue and raised a ticket against dkms. dkms was invented by Dell and github repo and issue tracker ticket for the bug is here...
              I'm trying to build various dkms packages using clang rather than gcc and I don't know how to override the default gcc setting and get dkms to use clang instead. The linux kernel now supports nativ...


              If you are having the same problems with modules or like me with Virtualbox using dkms with a host compiled by llvm-clang; please add your voice and comment in the ticket above! Sooner this is fixed the sooner we can all benefit from a more optimised linux kernel for hosts running VMs.
              Last edited by DanglingPointer; 12 July 2021, 11:42 PM.

              Comment

              Working...
              X