Compare commits

...

7 Commits
1.7.6 ... 1.7.8

Author SHA1 Message Date
2039139380 release: 1.7.8: fix ihklib/ihk_reserve_cpu when using krm
Change-Id: I57235d51f51ae7327cb08a9e3ae56be995157100
2021-03-12 12:54:56 +09:00
c80b112ce7 release: 1.7.7: fix fput and mckernel.spec
Change-Id: I74f7530b067d44790e3f014479f580867387584a
2021-03-11 08:09:07 +00:00
4a05024656 spec: cmake-config cmake paramters
Change-Id: Ic0e7f62d9172f31afe90297bdd22b8e50cc6fc9e
2021-03-11 07:19:04 +00:00
7a04c6eb5c ihkmond: redirect kmsg to /dev/kmsg line by line
Change-Id: Iafc9d0eb47696073434dcc869a29336a51b8c50e
2021-03-11 16:11:17 +09:00
3e00189de0 kprintf: fix checking if interrupt is disabled
Change-Id: I2ee1a1e2438ae761c4136593953ede2738bc6f74
2021-03-11 07:03:04 +00:00
c94cf8e6f0 mcexec: fput executable just after its contents is transferred
Change-Id: I3fae841bd7341bca030fd6b7eceffa068c9e0f4e
2021-03-11 07:03:04 +00:00
ee974b200d mcexec_open_exec: fix missing fput on error
Change-Id: I3ac94e336dc54ec313e69c0fa85c17086dc256fd
2021-03-11 07:03:04 +00:00
11 changed files with 113 additions and 43 deletions

View File

@ -7,7 +7,7 @@ endif (NOT CMAKE_BUILD_TYPE)
enable_language(C ASM)
project(mckernel C ASM)
set(MCKERNEL_VERSION "1.7.6")
set(MCKERNEL_VERSION "1.7.8")
# See "Fedora Packaging Guidelines -- Versioning"
set(MCKERNEL_RELEASE "")
@ -124,6 +124,14 @@ if(ENABLE_FUGAKU_DEBUG)
set(KBUILD_C_FLAGS "${KBUILD_C_FLAGS} -DENABLE_FUGAKU_DEBUG")
endif()
# redirect kernel messages to Linux's /dev/kmsg
option(ENABLE_KMSG_REDIRECT "Redirect kernel message to Linux's /dev/kmsg" OFF)
if(ENABLE_KMSG_REDIRECT)
add_definitions(-DENABLE_KMSG_REDIRECT)
set(KBUILD_C_FLAGS "${KBUILD_C_FLAGS} -DENABLE_KMSG_REDIRECT")
endif()
option(PROFILE_ENABLE "System call profile" ON)
if(PROFILE_ENABLE)
add_definitions(-DPROFILE_ENABLE)
@ -340,4 +348,5 @@ message("ENABLE_WERROR: ${ENABLE_WERROR}")
message("ENABLE_UBSAN: ${ENABLE_UBSAN}")
message("ENABLE_LINUX_WORK_IRQ_FOR_IKC: ${ENABLE_LINUX_WORK_IRQ_FOR_IKC}")
message("ENABLE_PER_CPU_ALLOC_CACHE: ${ENABLE_PER_CPU_ALLOC_CACHE}")
message("ENABLE_KMSG_REDIRECT: ${ENABLE_KMSG_REDIRECT}")
message("-------------------------------")

View File

@ -912,7 +912,6 @@ unsigned long cpu_enable_interrupt_save(void)
return flags;
}
#ifdef ENABLE_FUGAKU_HACKS
int cpu_interrupt_disabled(void)
{
unsigned long flags;
@ -925,7 +924,6 @@ int cpu_interrupt_disabled(void)
: "memory");
return (flags == masked);
}
#endif
#else /* defined(CONFIG_HAS_NMI) */
@ -989,6 +987,18 @@ unsigned long cpu_enable_interrupt_save(void)
: "memory");
return flags;
}
int cpu_interrupt_disabled(void)
{
unsigned long flags;
asm volatile(
"mrs %0, daif // arch_local_irq_save\n"
: "=r" (flags)
:
: "memory");
return !!(flags & 0x2);
}
#endif /* defined(CONFIG_HAS_NMI) */
/* we not have "pause" instruction, instead "yield" instruction */

View File

@ -1273,6 +1273,15 @@ unsigned long cpu_enable_interrupt_save(void)
return flags;
}
int cpu_interrupt_disabled(void)
{
unsigned long flags;
asm volatile("pushf; pop %0" : "=r"(flags) : : "memory", "cc");
return !(flags & 0x200);
}
/*@
@ behavior valid_vector:
@ assumes 32 <= vector <= 255;

View File

@ -1,3 +1,52 @@
=============================================
Version 1.7.8 (Mar 12, 2021)
=============================================
----------------------
IHK major updates
----------------------
N/A
------------------------
IHK major bug fixes
------------------------
#. ihklib: ihk_reserve_cpu: fix job cpu check when using krm
----------------------
McKernel major updates
----------------------
N/A
------------------------
McKernel major bug fixes
------------------------
N/A
=============================================
Version 1.7.7 (Mar 11, 2021)
=============================================
----------------------
IHK major updates
----------------------
N/A
------------------------
IHK major bug fixes
------------------------
N/A
----------------------
McKernel major updates
----------------------
N/A
------------------------
McKernel major bug fixes
------------------------
#. mcexec: fput executable just after its contents is transferred
#. spec: cmake-config cmake parameters
=============================================
Version 1.7.6 (Mar 11, 2021)
=============================================

View File

@ -166,22 +166,6 @@ Create the tarball and the spec file:
make dist
cp mckernel-<version>.tar.gz <rpmbuild>/SOURCES
(optional) Edit the following line in ``scripts/mckernel.spec`` to change
cmake options. For example:
::
%cmake -DCMAKE_BUILD_TYPE=Release \
-DUNAME_R=%{kernel_version} \
-DKERNEL_DIR=%{kernel_dir} \
%{?cmake_libdir:-DCMAKE_INSTALL_LIBDIR=%{cmake_libdir}} \
%{?build_target:-DBUILD_TARGET=%{build_target}} \
%{?toolchain_file:-DCMAKE_TOOLCHAIN_FILE=%{toolchain_file}} \
-DENABLE_TOFU=ON -DENABLE_FUGAKU_HACKS=ON \
-DENABLE_KRM_WORKAROUND=OFF -DWITH_KRM=ON \
-DENABLE_FUGAKU_DEBUG=OFF -DENABLE_UTI=ON \
.
Create the rpm package:
When not cross-compiling:

View File

@ -2010,7 +2010,7 @@ int mcexec_open_exec(ihk_os_t os, char * __user filename)
fullpath = d_path(&file->f_path, pathbuf, PATH_MAX);
if (IS_ERR(fullpath)) {
retval = PTR_ERR(fullpath);
goto out_free;
goto out_put_file;
}
mcef = kmalloc(sizeof(*mcef), GFP_KERNEL);

View File

@ -2419,6 +2419,7 @@ int main(int argc, char **argv)
}
#endif // MCEXEC_BIND_MOUNT
/* fget executable as well */
if ((ret = load_elf_desc_shebang(argv[optind], &desc,
&shebang_argv, 1 /* execvp */))) {
fprintf(stderr, "%s: could not load program: %s\n",
@ -2860,6 +2861,14 @@ int main(int argc, char **argv)
fprintf(stderr, "error: transferring image\n");
return -1;
}
/* fput executable */
if ((ret = ioctl(fd, MCEXEC_UP_CLOSE_EXEC)) != 0) {
fprintf(stderr, "error: MCEXEC_UP_CLOSE_EXEC failed with %d\n",
ret);
return 1;
}
fflush(stdout);
fflush(stderr);
@ -4111,11 +4120,6 @@ int main_loop(struct thread_data_s *my_thread)
It is done by not calling do_syscall_return(fd, cpu, 0, 0, 0, 0, 0);
here and making McKernel side wait until release_handler() is called. */
/* Drop executable file */
if ((ret = ioctl(fd, MCEXEC_UP_CLOSE_EXEC)) != 0) {
fprintf(stderr, "WARNING: close_exec() couldn't find exec file?\n");
}
__dprintf("__NR_exit/__NR_exit_group: %ld (cpu_id: %d)\n",
w.sr.args[0], cpu);
if(w.sr.number == __NR_exit_group){
@ -4308,15 +4312,6 @@ gettid_out:
__dprintf("pid(%d): signals and syscall threads OK\n",
getpid());
/* Hold executable also in the child process */
if ((ret = ioctl(fd, MCEXEC_UP_OPEN_EXEC, exec_path))
!= 0) {
fprintf(stderr, "Error: open_exec() fails for %s: %d (fd: %d)\n",
exec_path, ret, fd);
fs->status = -errno;
goto fork_child_sync_pipe;
}
/* Check if we need to limit number of threads in the pool */
if ((ret = ioctl(fd, MCEXEC_UP_GET_NUM_POOL_THREADS)) < 0) {
fprintf(stderr, "Error: obtaining thread pool count\n");
@ -4472,6 +4467,7 @@ fork_err:
}
filename = pathbuf;
/* fget executable as well */
if ((ret = load_elf_desc_shebang(filename, &desc,
&shebang_argv, 0)) != 0) {
goto return_execve1;
@ -4569,6 +4565,13 @@ return_execve1:
}
__dprintf("%s", "execve(): image transferred\n");
/* fput executable */
if ((ret = ioctl(fd, MCEXEC_UP_CLOSE_EXEC)) != 0) {
fprintf(stderr, "error: MCEXEC_UP_CLOSE_EXEC failed with %d\n",
ret);
return 1;
}
if (close_cloexec_fds(fd) < 0) {
ret = EINVAL;
goto return_execve2;

2
ihk

Submodule ihk updated: 8e637b7873...2ced7eda65

View File

@ -87,7 +87,7 @@ void kputs(char *buf)
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
kprintf_unlock(flags_outer);
if (irqflags_can_interrupt(flags_outer) &&
if (!cpu_interrupt_disabled() &&
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
@ -128,7 +128,7 @@ int __kprintf(const char *format, ...)
}
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
if (irqflags_can_interrupt(flags_inner) &&
if (!cpu_interrupt_disabled() &&
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
@ -171,7 +171,7 @@ int kprintf(const char *format, ...)
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
kprintf_unlock(flags_outer);
if (irqflags_can_interrupt(flags_outer) &&
if (!cpu_interrupt_disabled() &&
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);

View File

@ -23,9 +23,7 @@ extern int num_processors;
void cpu_enable_interrupt(void);
void cpu_disable_interrupt(void);
#ifdef ENABLE_FUGAKU_HACKS
int cpu_interrupt_disabled(void);
#endif
void cpu_halt(void);
#ifdef ENABLE_FUGAKU_HACKS
void cpu_halt_panic(void);

View File

@ -15,6 +15,11 @@
%{!?kernel_dir: %global kernel_dir /usr/src/kernels/%{kernel_version}}
%define krequires %(echo %{kernel_version} | sed "s/.%{_target_cpu}$//")
%define ktag %(echo %{krequires} | tr '-' '_' | sed -e 's/\.el[0-9_]*$//' | sed -e 's/\.\([a-zA-Z]\)/_\1/')
%if "@ENABLE_UTI@" == "ON"
%define enable_uti 1
%else
%define enable_uti 0
%endif
Name: mckernel
Version: @MCKERNEL_VERSION@
@ -77,9 +82,10 @@ pushd build
%{?cmake_libdir:-DCMAKE_INSTALL_LIBDIR=%{cmake_libdir}} \
%{?build_target:-DBUILD_TARGET=%{build_target}} \
%{?toolchain_file:-DCMAKE_TOOLCHAIN_FILE=%{toolchain_file}} \
-DENABLE_TOFU=ON -DENABLE_FUGAKU_HACKS=ON \
-DENABLE_KRM_WORKAROUND=OFF -DWITH_KRM=ON \
-DENABLE_FUGAKU_DEBUG=OFF -DENABLE_UTI=ON \
-DENABLE_TOFU=@ENABLE_TOFU@ -DENABLE_FUGAKU_HACKS=@ENABLE_FUGAKU_HACKS@ \
-DENABLE_KRM_WORKAROUND=@ENABLE_KRM_WORKAROUND@ -DWITH_KRM=@WITH_KRM@ \
-DENABLE_FUGAKU_DEBUG=@ENABLE_FUGAKU_DEBUG@ -DENABLE_UTI=@ENABLE_UTI@ \
-DENABLE_FJMPI_WORKAROUND=@ENABLE_FJMPI_WORKAROUND@ \
..
%make_build
popd
@ -112,6 +118,7 @@ popd
%{_libdir}/libsched_yield.so.1.0.0
%{_libdir}/libsched_yield.so
%{_libdir}/libldump2mcdump.so
%if 0%{?enable_uti}
%{_libdir}/libmck_syscall_intercept.so
%{_libdir}/libsyscall_intercept.so.0.1.0
%{_libdir}/libsyscall_intercept.so.0
@ -119,6 +126,7 @@ popd
%{_libdir}/mck/libuti.so.1.0.0
%{_libdir}/mck/libuti.so.1
%{_libdir}/mck/libuti.so
%endif
%{_sysconfdir}/irqbalance_mck.in
%{_mandir}/man1/mcreboot.1.gz
%{_mandir}/man1/ihkconfig.1.gz