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

Failure to build dkms modules #435

Closed
LethalManBoob opened this issue Apr 27, 2023 · 25 comments
Closed

Failure to build dkms modules #435

LethalManBoob opened this issue Apr 27, 2023 · 25 comments

Comments

@LethalManBoob
Copy link

LethalManBoob commented Apr 27, 2023

DKMS make.log for corefreq-1.95.5.r0.g34efe5d for kernel 6.3.0-4-cachyos-lto (x86_64)

Thu Apr 27 06:45:45 BST 2023
make: Entering directory '/usr/src/corefreq-1.95.5.r0.g34efe5d'
clang   corefreqd.c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd -lpthread -lm -lrt
clang   \
  corefreq-cli.c corefreq-ui.c corefreq-cli-rsc.c \
  corefreq-cli-json.c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli -lm -lrt
make -j1 -C /usr/lib/modules/6.3.0-4-cachyos-lto/build M=/var/lib/dkms/corefreq/1.95.5.r0.g34efe5d/build modules
make[1]: Entering directory '/usr/lib/modules/6.3.0-4-cachyos-lto/build'
make[1]: warning: -j1 forced in submake: resetting jobserver mode.
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: CachyOS - LLVM 15 BOLT clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
  You are using:           clang version 15.0.7
  CC [M]  /var/lib/dkms/corefreq/1.95.5.r0.g34efe5d/build/corefreqk.o
/var/lib/dkms/corefreq/1.95.5.r0.g34efe5d/build/corefreqk.c:22084:16: fatal error: cannot assign to non-static data member 'vm_flags' with const-qualified type 'const vm_flags_t' (aka 'const unsigned long')
        vma->vm_flags = VM_READ;
        ~~~~~~~~~~~~~ ^
./include/linux/mm_types.h:500:20: note: non-static data member 'vm_flags' declared const here
                const vm_flags_t vm_flags;
                ~~~~~~~~~~~~~~~~~^~~~~~~~
1 error generated.
make[2]: *** [scripts/Makefile.build:252: /var/lib/dkms/corefreq/1.95.5.r0.g34efe5d/build/corefreqk.o] Error 1
make[1]: *** [Makefile:2023: /var/lib/dkms/corefreq/1.95.5.r0.g34efe5d/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.3.0-4-cachyos-lto/build'
make: *** [Makefile:86: all] Error 2
make: Leaving directory '/usr/src/corefreq-1.95.5.r0.g34efe5d'
@cyring
Copy link
Owner

cyring commented Apr 27, 2023

Can you please try to build against the current master version ? This would be version 1.96.0

@cyring
Copy link
Owner

cyring commented Apr 27, 2023

Also if compiling Linux Kernel and CoreFreq with clang/llvm, check for CONFIG_FORTIFY_SOURCE fixed in this post

2023-04-27-160705_644x564_scrot

@cyring
Copy link
Owner

cyring commented Apr 29, 2023

  1. Using linux-cachyos 6.3.0-5
    built with _makemenuconfig=y _use_llvm_lto=full makepkg -sfir
  2. I have successfully compile CoreFreq 1.96.0
    with make CC='clang' LLVM=1 clean all
  3. and run:
    2023-04-29-022832_644x564_scrot

@LethalManBoob
Copy link
Author

Good new is it works now but..
image

@LethalManBoob
Copy link
Author

Also i seem to be unable to register the cpu idle driver but maybe i followed somthing wrong so if you can drop somthing here to help me that would be appreicated.

@cyring
Copy link
Owner

cyring commented May 1, 2023

Does your kernel log (dmesg) show any crash ?

Can you validate Processor with CoreFreq + ArchLinux from Live-CD ? Please take a picture.

@cyring
Copy link
Owner

cyring commented May 2, 2023

Do you still have an issue to start CoreFreq ?

@LethalManBoob
Copy link
Author

Okay so i was delayed but ill post the dmesg tomorrow.

@LethalManBoob
Copy link
Author

@LethalManBoob
Copy link
Author

also the daemon wont start on its own. i have to manually allow it to start every time.
I was told it requires me to make a modprobe file that calls for corefreqk to run but thats all i know.

@cyring
Copy link
Owner

cyring commented May 5, 2023

No sign of crash in log above.

Procedure to run CoreFreq

Right after booting, starts CoreFreq this way:

  1. Go to the source directory where you have downloaded latest 1.96 version, and fully rebuild:
make clean all CC='clang' LLVM=1 ## for your CachyOS LTO setup
  1. Load Driver as root
insmod ./corefreqk.ko
lsmod|grep corefreq ## you should see kernel module of CoreFreq 
  1. Starts Daemon as root
./corefreq -d ## one thread per CPU is listed
  1. Starts Client as a user
./corefreq-cli

Does it work ?

If not, please reboot to mainline Linux kernel, not CachyOS.
But simply build with gcc this time:

make clean all CC=gcc

Go back to step 2

@LethalManBoob
Copy link
Author

rm -f corefreqd corefreq-cli
make -j1 -C /lib/modules/6.3.1-1-cachyos-eevdf-bore-lto/build M=/home/joseph/CoreFreq clean
clang  -Wall -Wfatal-errors -pthread -c corefreqd.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd.o
clang  -Wall -Wfatal-errors -c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqm.o
clang  -Wall -Wfatal-errors corefreqd.c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd -lpthread -lm -lrt
clang  -Wall -Wfatal-errors -c corefreq-cli.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli.o
clang  -Wall -Wfatal-errors -c corefreq-ui.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-ui.o
clang  -Wall -Wfatal-errors -c corefreq-cli-rsc.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli-rsc.o
clang  -Wall -Wfatal-errors -c corefreq-cli-json.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-json.o
clang  -Wall -Wfatal-errors -c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-extra.o
clang  -Wall -Wfatal-errors \
  corefreq-cli.c corefreq-ui.c corefreq-cli-rsc.c \
  corefreq-cli-json.c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli -lm -lrt
make -j1 -C /lib/modules/6.3.1-1-cachyos-eevdf-bore-lto/build M=/home/joseph/CoreFreq modules
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: CachyOS - LLVM 15 BOLT clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
  You are using:           clang version 15.0.7
  CC [M]  /home/joseph/CoreFreq/corefreqk.o
LLVM ERROR: Permission denied: ThinLTO: Can't get a temporary file

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x00007f278b9ae15a (/usr/lib/libLLVM-15.so+0xdae15a)
 #1 0x00007f278b9ab1df llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM-15.so+0xdab1df)
 #2 0x00007f278b9ab32d (/usr/lib/libLLVM-15.so+0xdab32d)
 #3 0x00007f278a43e690 (/usr/lib/libc.so.6+0x3e690)
 #4 0x00007f278a49900b pthread_kill (/usr/lib/libc.so.6+0x9900b)
 #5 0x00007f278a43e5e8 raise (/usr/lib/libc.so.6+0x3e5e8)
 #6 0x00007f278a4224f8 abort (/usr/lib/libc.so.6+0x224f8)
 #7 0x00007f278b6e3281 (/usr/lib/libLLVM-15.so+0xae3281)
 #8 0x00007f278b897e40 LLVMConsumeError (/usr/lib/libLLVM-15.so+0xc97e40)
 #9 0x00007f278d65efdf (/usr/lib/libLLVM-15.so+0x2a5efdf)
#10 0x00007f278d65f953 (/usr/lib/libLLVM-15.so+0x2a5f953)
#11 0x00007f278d66041a llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, std::vector<std::pair<llvm::StringRef, llvm::BitcodeModule>, std::allocator<std::pair<llvm::StringRef, llvm::BitcodeModule>>>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/usr/lib/libLLVM-15.so+0x2a6041a)
#12 0x00007f278d63b40b (/usr/lib/libLLVM-15.so+0x2a3b40b)
#13 0x00007f278d651570 (/usr/lib/libLLVM-15.so+0x2a51570)
#14 0x00007f278bf7c60a (/usr/lib/libLLVM-15.so+0x137c60a)
#15 0x00007f278b92052d llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) (/usr/lib/libLLVM-15.so+0xd2052d)
#16 0x00007f278b920f25 (/usr/lib/libLLVM-15.so+0xd20f25)
#17 0x00007f278a49708f (/usr/lib/libc.so.6+0x9708f)
#18 0x00007f278a5294b0 (/usr/lib/libc.so.6+0x1294b0)
make[2]: *** [scripts/Makefile.build:252: /home/joseph/CoreFreq/corefreqk.o] Error 134
make[2]: *** Deleting file '/home/joseph/CoreFreq/corefreqk.o'
make[1]: *** [Makefile:2023: /home/joseph/CoreFreq] Error 2
make: *** [Makefile:86: all] Error 2

@cyring
Copy link
Owner

cyring commented May 5, 2023

Please see #435 (comment) how CachyOS is built

@LethalManBoob
Copy link
Author

LethalManBoob commented May 5, 2023

Look like a high change that lto now breaks it. the corefreq-cli works when build from source

@LethalManBoob
Copy link
Author

okay so when i install from aur...

corefreq-ro-shm: 'No such file or directory' @ line 21331```

@cyring
Copy link
Owner

cyring commented May 6, 2023

cachyo

AUR is built with these options:

_makenconfig=1 _use_llvm_lto=thin _cpusched=cachyos makepkg -cCsfir

CONFIG_FORTIFY_SOURCE is disabled as shown in #435 (comment)

@cyring
Copy link
Owner

cyring commented May 6, 2023

Now building with make clean all CC='clang' LLVM=1
Same bug as yours

LLVM ERROR: Permission denied

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
...

@cyring
Copy link
Owner

cyring commented May 6, 2023

Now building with no LTO

_makenconfig=1 _use_llvm_lto=none _cpusched=cachyos makepkg -cCsfir

@cyring
Copy link
Owner

cyring commented May 6, 2023

Now building with no LTO

_makenconfig=1 _use_llvm_lto=none _cpusched=cachyos makepkg -cCsfir

Booting:

Linux version 6.3.1-1-cachyos (linux-cachyos@cachyos) (gcc (GCC) 13.1.1 20230429, GNU ld (GNU Binutils) 2.40.0)
...
Command line: initrd=\EFI\Linux\amd-ucode.img initrd=\EFI\Linux\initramfs-linux-cachyos.img

Building:

make clean all ## GGC forced used because no LTO
...
make -j1 -C /lib/modules/6.3.1-1-cachyos/build M=/xxx/CoreFreq modules
  CC [M]  /xxx/CoreFreq/corefreqk.o
  MODPOST /xxx/CoreFreq/Module.symvers
  CC [M]  /xxx/CoreFreq/corefreqk.mod.o
  LD [M]  /xxx/CoreFreq/corefreqk.ko
  BTF [M] /xxx/CoreFreq/corefreqk.ko

Starting:

insmod /xxx/CoreFreq/corefreqk.ko
/xxx/CoreFreq/corefreqd -d
CoreFreq Daemon 1.96.1  Copyright (C) 2015-2023 CYRIL COURTIAT

  Processor [AMD Ryzen 9 3950X 16-Core Processor]
  Architecture [Zen2/Matisse] 32/32 CPU Online.
  SleepInterval(1000), SysGate(2000), 2335 tasks

    CPU #000 @ 3499.79 MHz
    ...

Btw:

zgrep CONFIG_FORTIFY_SOURCE /proc/config.gz 
# CONFIG_FORTIFY_SOURCE is not set

@cyring
Copy link
Owner

cyring commented May 6, 2023

Now configuring full LTO

_makenconfig=1 _use_llvm_lto=full _cpusched=cachyos makepkg -cCsfir

Booting:

Linux version 6.3.1-1-cachyos-lto (linux-cachyos-lto@cachyos) (clang version 15.0.7, LLD 15.0.7) #1 SMP PREEMPT_DYNAMIC Sat, 06 May 2023 03:15:57 +0000
Command line: initrd=\EFI\Linux\amd-ucode.img initrd=\EFI\Linux\initramfs-linux-cachyos-lto.img
...

Building & running CoreFreq

make clean all CC='clang' LLVM=1

insmod /xxx/CoreFreq/corefreqk.ko
/xxx/CoreFreq/corefreqd -d
CoreFreq Daemon 1.96.1  Copyright (C) 2015-2023 CYRIL COURTIAT

  Processor [AMD Ryzen 9 3950X 16-Core Processor]
  Architecture [Zen2/Matisse] 32/32 CPU Online.
  SleepInterval(1000), SysGate(2000), 2335 tasks

    CPU #000 @ 3499.82 MHz
    ...

@cyring
Copy link
Owner

cyring commented May 6, 2023

Wrapping up now

Thin LTO does not work with CoreFreq

@LethalManBoob
Copy link
Author

I am currently on the non lto version but it still gives me the error I said above when trying corefreq-cli

@cyring
Copy link
Owner

cyring commented May 6, 2023

I am currently on the non lto version but it still gives me the error I said above when trying corefreq-cli

Based on #435 (comment) and #435 (comment) it's hard to imagine what's going on your system.

There's only one way to make CoreFreq works; It has to successfully startup in that order:

  1. Driver
  2. Daemon
  3. Client

So I would like you to run CoreFreq with the mainstream Linux kernel and gcc ; no CachyOS flavor of whatever, no patch.
Please let me know if it successfully starts and we can validate first there is no hardware issue to support your processor.
Thank you.

@cyring
Copy link
Owner

cyring commented May 10, 2023

Hello,
Did you make the test requested above ?

@cyring cyring closed this as completed May 10, 2023
@LethalManBoob
Copy link
Author

Ill test this after work

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

No branches or pull requests

2 participants