Skip to content

Commit

Permalink
Redirect kmsg to /dev/log and detect hungup
Browse files Browse the repository at this point in the history
1. ihkmond retrieves kmsg when the amount of kmsg exceeds the threashold and
   /dev/mcosX is deleted
2. ihkmond periodically monitors OS status change to detect hungup
  • Loading branch information
masamichitakagi committed Sep 19, 2017
1 parent a3404e9 commit f74d1e7
Show file tree
Hide file tree
Showing 24 changed files with 1,235 additions and 461 deletions.
8 changes: 5 additions & 3 deletions cokernel/attached/mic/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
#define MIC_BOOT_MAGIC_READY 0x25470293

extern void main(void);
extern void setup_x86(void);
extern void setup_x86_phase1(void);
extern void setup_x86_phase2(void);
extern void init_sfi(void);
extern void init_boot_processor_local(void);

static unsigned char stack[8192] __attribute__((aligned(4096)));
extern struct ihk_kmsg_buf kmsg_buf;
extern struct ihk_kmsg_buf *kmsg_buf;

static struct mic_boot_param *boot_param;

Expand Down Expand Up @@ -164,7 +165,8 @@ void arch_init(void)

init_sfi();

setup_x86();
setup_x86_phase1();
setup_x86_phase2();

sbox_base = map_fixed_area(SBOX_BASE, SBOX_SIZE, 1);
boot_param = map_fixed_area((unsigned long)boot_param,
Expand Down
8 changes: 5 additions & 3 deletions cokernel/builtin/mic/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ unsigned long boot_param_pa;
struct shimos_boot_param *boot_param;

extern void main(void);
extern void setup_x86(void);
extern void setup_x86_phase1(void);
extern void setup_x86_phase2(void);
extern void init_boot_processor_local(void);
extern struct ihk_kmsg_buf kmsg_buf;
extern struct ihk_kmsg_buf *kmsg_buf;

unsigned long x86_kernel_phys_base;

Expand Down Expand Up @@ -94,7 +95,8 @@ void arch_init(void)

build_ihk_cpu_info();

setup_x86();
setup_x86_phase1();
setup_x86_phase2();
boot_param = map_fixed_area(boot_param_pa, sizeof(*boot_param), 0);
}

Expand Down
8 changes: 5 additions & 3 deletions cokernel/builtin/x86/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ unsigned long boot_param_pa;
struct shimos_boot_param *boot_param;

extern void main(void);
extern void setup_x86(void);
extern void setup_x86_phase1(void);
extern void setup_x86_phase2(void);
extern void init_boot_processor_local(void);
extern struct ihk_kmsg_buf kmsg_buf;
extern struct ihk_kmsg_buf *kmsg_buf;

unsigned long x86_kernel_phys_base;
unsigned long ap_trampoline = 0;
Expand Down Expand Up @@ -84,7 +85,8 @@ void arch_init(void)

build_ihk_cpu_info();

setup_x86();
setup_x86_phase1();
setup_x86_phase2();
boot_param = map_fixed_area(boot_param_pa, sizeof(*boot_param), 0);
}

Expand Down
2 changes: 1 addition & 1 deletion cokernel/smp/x86/bootparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct smp_boot_param {
are loaded, used for boundary check in early_alloc_pages(). */
unsigned long bootstrap_mem_end;

unsigned long msg_buffer;
unsigned long msg_buffer; /* Physical address */
unsigned long msg_buffer_size;
unsigned long mikc_queue_recv, mikc_queue_send;

Expand Down
24 changes: 12 additions & 12 deletions cokernel/smp/x86/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@
#include <errno.h>
#include <registers.h>
#include "bootparam.h"
#include <kmsg.h>

/* BUILTIN Setup.c */
static unsigned char stack[8192] __attribute__((aligned(4096)));

unsigned long boot_param_pa;
struct smp_boot_param *boot_param;
int boot_param_size;

unsigned long bootstrap_mem_end;
static int boot_param_size;

extern void main(void);
extern void setup_x86_phase1(void);
extern void setup_x86_phase2(void);
extern void init_boot_processor_local(void);
extern struct ihk_kmsg_buf kmsg_buf;
extern struct ihk_kmsg_buf *kmsg_buf;
extern int no_turbo;

unsigned long x86_kernel_phys_base;
Expand Down Expand Up @@ -49,6 +51,7 @@ void arch_start(unsigned long param_addr, unsigned long phys_address,
asm volatile("movq %0, %%rsp" : : "r" (stack + sizeof(stack)));

init_boot_processor_local();

main();

while (1);
Expand Down Expand Up @@ -107,14 +110,19 @@ void arch_init(void)
}

setup_x86_phase1();
setup_x86_phase2();
kprintf("boot_param_size: %lu\n", boot_param_size);

/* Remap boot parameter structure */
/* Map boot parameter structure with the non-bootstrap map */
boot_param = map_fixed_area(boot_param_pa, boot_param_size, 0);

dump_page = (struct ihk_dump_page *)map_fixed_area(boot_param->dump_page_set.phy_page, boot_param->dump_page_set.page_size, 0);

/* Map kmsg_buf, which is out of kernel image, with the non-bootstrap map. */
kmsg_buf = (struct ihk_kmsg_buf *)map_fixed_area(boot_param->msg_buffer, boot_param->msg_buffer_size, 0);
kmsg_init();
kputs("IHK/McKernel started.\n");

setup_x86_phase2();
kprintf("ns_per_tsc: %lu\n", boot_param->ns_per_tsc);
build_ihk_cpu_info();
}
Expand Down Expand Up @@ -209,14 +217,6 @@ char *ihk_get_kargs(void)
return boot_param->kernel_args;
}

int ihk_set_kmsg(unsigned long addr, unsigned long size)
{
boot_param->msg_buffer = addr;
boot_param->msg_buffer_size = size;

return 0;
}

int ihk_set_monitor(unsigned long addr, unsigned long size)
{
boot_param->monitor = addr;
Expand Down
3 changes: 3 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
/* Define to address of kernel symbol x86_trampoline_base, or 0 if exported */
#undef IHK_KSYM_x86_trampoline_base

/* Temporary directory used by IHK */
#undef IHK_TMPDIR

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

Expand Down
68 changes: 68 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ IHK_RELEASE_DATE
DCFA_VERSION
MCKERNEL_VERSION
IHK_VERSION
IHK_TMPDIR
MANDIR
KMODDIR
LIBDIR
Expand Down Expand Up @@ -3046,6 +3047,9 @@ case $WITH_TARGET in
if test "X$INCLUDEDIR" = X; then
INCLUDEDIR="$prefix/include"
fi
if test "X$IHK_TMPDIR" = X; then
IHK_TMPDIR="$prefix/tmp"
fi
;;
smp-arm64)
if test "X$BINDIR" = X; then
Expand Down Expand Up @@ -4981,6 +4985,70 @@ else
$as_echo "$as_me: rusage is disabled" >&6;}
fi

libudev=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_new in -ludev" >&5
$as_echo_n "checking for udev_new in -ludev... " >&6; }
if ${ac_cv_lib_udev_udev_new+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ludev $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char udev_new ();
int
main ()
{
return udev_new ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_udev_udev_new=yes
else
ac_cv_lib_udev_udev_new=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_new" >&5
$as_echo "$ac_cv_lib_udev_udev_new" >&6; }
if test "x$ac_cv_lib_udev_udev_new" = xyes; then :
libudev=yes
else
libudev=no
fi

ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default"
if test "x$ac_cv_header_libudev_h" = xyes; then :
libudev=yes
else
libudev=no
fi


if test "x$libudev" = "xno" ; then
as_fn_error $? "Install libudev package, e.g. yum install libudev-devel" "$LINENO" 5
fi

if test "x$IHK_TMPDIR" != "x" ; then

cat >>confdefs.h <<_ACEOF
#define IHK_TMPDIR "$IHK_TMPDIR"
_ACEOF

fi





Expand Down
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ case $WITH_TARGET in
if test "X$INCLUDEDIR" = X; then
INCLUDEDIR="$prefix/include"
fi
if test "X$IHK_TMPDIR" = X; then
IHK_TMPDIR="$prefix/tmp"
fi
;;
smp-arm64)
if test "X$BINDIR" = X; then
Expand Down Expand Up @@ -386,6 +389,17 @@ else
AC_MSG_NOTICE([rusage is disabled])
fi

libudev=no
AC_CHECK_LIB([udev],[udev_new],[libudev=yes],[libudev=no])
AC_CHECK_HEADER([libudev.h],[libudev=yes],[libudev=no])
if test "x$libudev" = "xno" ; then
AC_MSG_ERROR([Install libudev package, e.g. yum install libudev-devel])
fi

if test "x$IHK_TMPDIR" != "x" ; then
AC_DEFINE_UNQUOTED(IHK_TMPDIR,"$IHK_TMPDIR",[Temporary directory used by IHK])
fi

AC_SUBST(CC)
AC_SUBST(XCC)
AC_SUBST(ARCH)
Expand All @@ -397,6 +411,7 @@ AC_SUBST(INCLUDEDIR)
AC_SUBST(LIBDIR)
AC_SUBST(KMODDIR)
AC_SUBST(MANDIR)
AC_SUBST(IHK_TMPDIR)
AC_SUBST(CFLAGS)

AC_SUBST(IHK_VERSION)
Expand Down
Loading

0 comments on commit f74d1e7

Please sign in to comment.