OpenMPDK / SMDK

SMDK, Scalable Memory Development Kit, is developed for Samsung CXL(Compute Express Link) Memory Expander to enable full-stack Software-Defined Memory system
280 stars 60 forks source link

SMDK 2.0 build error (during header install) #30

Closed Sangun-Choi closed 4 months ago

Sangun-Choi commented 4 months ago

Dear SMDK contributors,

I am trying to build SMDK 2.0, but the build process got stuck while running header_install.sh with an error indicating that "CONFIG_EXMEM is leaked to user-space."

The error messages are as follows:

...
HDRINST usr/include/asm-generic/mman-common.h
error: include/uapi/asm-generic/mman-common.h: leak CONFIG_EXMEM to user-space
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/asm-generic/mman-common.h] error 1
make[1]: *** [/home/user_name/SMDK/SMDK/lib/linux-6.6-smdk/Makefile:1298: headers] error 2
make: *** [Makefile:234: __sub-make] error 2

Here is my brief server information (CPU, memory, and kernel version):

[CPU] 2 Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz (3rd Gen) [Board] Intel® Server Board M50CYP2SBSTD [Memory] 8 64 GB @3200 MT/s DDR4 Synchronous LRDIMM Samsung M386A8K40DM2-CWE [Linux kernel version] 6.6.0

Although our server does not support CXL and does not have CXL memory devices, I guess this error is orthogonal to the hardware specifications. Additionally, building SMDK 1.5.1 did not produce this error, as there is no #ifdef CONFIG_EXMEM line in the mman-common.h header of SMDK 1.5.1.

I would like to ask if you have ever encountered this problem when building SMDK 2.0 and whether it can be resolved without modifying the kernel code.

Thank you!

SeungjunHa commented 4 months ago

Thank you for telling us.

We also experienced this during the build process.

This is a security-related error that prevents the kernel config of the Linux kernel from being exposed to the user space through #ifdef, etc. when the kernel installs the header regardless of CXL Device or System status.

Unlike SMDK 1.5.1, SMDK 2.0 has added a madvise flag called MADV_TRY_POPULATE_WRITE, which is used by SMDK Allocator, SMDK's userspace framework. We didn't use "make heads_install" during development process, just declared it immediately. We also knew that this method was not the norm, but we did it to focus on implementing functions.

This function doesn't generate a swap by preventing a slow path when populating a lazy allocated mmap address through a madvise. Of course, this makes memory allocation more likely to fail for a single mmap system, but we tried to overcome it through fallback at the user level in SMDK Allocator.

The easiest way to solve the above error is to delete #ifdef CONFIG_EXMEM and #endif in smdk/lib/linux-6.6-smdk/include/uapi/asm-generic/mman-common.h. and then "make headers_install" It works anyway... and no problems if you turn on CONFIG_EXMEM.

Sangun-Choi commented 4 months ago

Thank you for your response. The explanation of the function was also helpful for my understanding!