From 25f67c9ef8fc6024ba4144f2d5cb6aa82cf2d228 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Wed, 4 Jan 2017 18:31:44 +0900 Subject: [PATCH] mcreboot/mcstop-smp-x86: surpress libkmod warnings --- arch/x86/tools/mcreboot-smp-x86.sh.in | 28 +++++++++++---------- arch/x86/tools/mcstop+release-smp-x86.sh.in | 18 ++++++------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/arch/x86/tools/mcreboot-smp-x86.sh.in b/arch/x86/tools/mcreboot-smp-x86.sh.in index 001be62b..316ca693 100644 --- a/arch/x86/tools/mcreboot-smp-x86.sh.in +++ b/arch/x86/tools/mcreboot-smp-x86.sh.in @@ -104,7 +104,7 @@ error_exit() { ;& mcoverlayfs_loaded) if [ "$enable_mcoverlay" == "yes" ]; then - rmmod mcoverlay + rmmod mcoverlay 2>/dev/null fi ;& linux_proc_bind_mounted) @@ -134,7 +134,7 @@ error_exit() { fi ;& mcctrl_loaded) - rmmod mcctrl || echo "warning: failed to remove mcctrl" >&2 + rmmod mcctrl 2>/dev/null || echo "warning: failed to remove mcctrl" >&2 ;& cpus_reserved) cpus=`${SBINDIR}/ihkconfig 0 query cpu` @@ -153,10 +153,10 @@ error_exit() { fi ;& ihk_smp_loaded) - rmmod ihk_smp_x86 || echo "warning: failed to remove ihk_smp_x86" >&2 + rmmod ihk_smp_x86 2>/dev/null || echo "warning: failed to remove ihk_smp_x86" >&2 ;& ihk_loaded) - rmmod ihk || echo "warning: failed to remove ihk" >&2 + rmmod ihk 2>/dev/null || echo "warning: failed to remove ihk" >&2 ;& irqbalance_stopped) if [ "`systemctl status irqbalance_mck.service 2> /dev/null |grep -E 'Active: active'`" != "" ]; then @@ -227,13 +227,13 @@ fi # Remove mcoverlay if loaded if [ "$enable_mcoverlay" == "yes" ]; then - if [ "`lsmod | grep mcoverlay`" != "" ]; then + if grep mcoverlay /proc/modules &>/dev/null; then if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_sys`" != "" ]; then umount -l /tmp/mcos/mcos0_sys; fi if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_proc`" != "" ]; then umount -l /tmp/mcos/mcos0_proc; fi if [ "`cat /proc/mounts | grep /tmp/mcos/linux_proc`" != "" ]; then umount -l /tmp/mcos/linux_proc; fi if [ "`cat /proc/mounts | grep /tmp/mcos`" != "" ]; then umount -l /tmp/mcos; fi if [ -e /tmp/mcos ]; then rm -rf /tmp/mcos; fi - if ! rmmod mcoverlay; then + if ! rmmod mcoverlay 2>/dev/null; then echo "error: removing mcoverlay" >&2 error_exit "initial" fi @@ -260,8 +260,8 @@ if [ ${LOGMODE} -ne 0 ]; then fi # Load IHK if not loaded -if [ "`lsmod | grep ihk`" == "" ]; then - if ! insmod ${KMODDIR}/ihk.ko; then +if ! grep -E 'ihk\s' /proc/modules &>/dev/null; then + if ! insmod ${KMODDIR}/ihk.ko 2>/dev/null; then echo "error: loading ihk" >&2 error_exit "irqbalance_stopped" fi @@ -276,8 +276,10 @@ sync && echo 3 > /proc/sys/vm/drop_caches # Merge free memory areas into large, physically contigous ones echo 1 > /proc/sys/vm/compact_memory 2>/dev/null +sync + # Load IHK-SMP if not loaded and reserve CPUs and memory -if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then +if ! grep ihk_smp_x86 /proc/modules &>/dev/null; then ihk_irq="" for i in `seq 64 255`; do if [ ! -d /proc/irq/$i ] && [ "`cat /proc/interrupts | grep ":" | awk '{print $1}' | grep -o '[0-9]*' | grep -e '^$i$'`" == "" ]; then @@ -289,7 +291,7 @@ if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then echo "error: no IRQ available" >&2 error_exit "ihk_loaded" fi - if ! insmod ${KMODDIR}/ihk-smp-x86.ko ihk_start_irq=$ihk_irq ihk_ikc_irq_core=$ihk_ikc_irq_core; then + if ! insmod ${KMODDIR}/ihk-smp-x86.ko ihk_start_irq=$ihk_irq ihk_ikc_irq_core=$ihk_ikc_irq_core 2>/dev/null; then echo "error: loading ihk-smp-x86" >&2 error_exit "ihk_loaded" fi @@ -304,8 +306,8 @@ if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then fi # Load mcctrl if not loaded -if [ "`lsmod | grep mcctrl`" == "" ]; then - if ! insmod ${KMODDIR}/mcctrl.ko; then +if ! grep mcctrl /proc/modules &>/dev/null; then + if ! insmod ${KMODDIR}/mcctrl.ko 2>/dev/null; then echo "error: inserting mcctrl.ko" >&2 error_exit "cpus_reserved" fi @@ -379,7 +381,7 @@ if [ "$enable_mcoverlay" == "yes" ]; then echo "error: mount /tmp/mcos/linux_proc" >&2 error_exit "tmp_mcos_mounted" fi - if ! insmod ${KMODDIR}/mcoverlay.ko; then + if ! insmod ${KMODDIR}/mcoverlay.ko 2>/dev/null; then echo "error: inserting mcoverlay.ko" >&2 error_exit "linux_proc_bind_mounted" fi diff --git a/arch/x86/tools/mcstop+release-smp-x86.sh.in b/arch/x86/tools/mcstop+release-smp-x86.sh.in index 854d060c..c23a7a56 100644 --- a/arch/x86/tools/mcstop+release-smp-x86.sh.in +++ b/arch/x86/tools/mcstop+release-smp-x86.sh.in @@ -18,7 +18,7 @@ mem="" cpus="" # No SMP module? Exit. -if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then exit 0; fi +if ! grep ihk_smp_x86 /proc/modules &>/dev/null; then exit 0; fi # Destroy all LWK instances if ls /dev/mcos* 1>/dev/null 2>&1; then @@ -59,36 +59,36 @@ if [ "${mem}" != "" ]; then fi # Remove delegator if loaded -if [ "`lsmod | grep mcctrl`" != "" ]; then - if ! rmmod mcctrl; then +if grep mcctrl /proc/modules &>/dev/null; then + if ! rmmod mcctrl 2>/dev/null; then echo "error: removing mcctrl" >&2 exit 1 fi fi # Remove mcoverlay if loaded -if [ "`lsmod | grep mcoverlay`" != "" ]; then +if grep mcoverlay /proc/modules &>/dev/null; then if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_sys`" != "" ]; then umount -l /tmp/mcos/mcos0_sys; fi if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_proc`" != "" ]; then umount -l /tmp/mcos/mcos0_proc; fi if [ "`cat /proc/mounts | grep /tmp/mcos/linux_proc`" != "" ]; then umount -l /tmp/mcos/linux_proc; fi if [ "`cat /proc/mounts | grep /tmp/mcos`" != "" ]; then umount -l /tmp/mcos; fi if [ -e /tmp/mcos ]; then rm -rf /tmp/mcos; fi - if ! rmmod mcoverlay; then + if ! rmmod mcoverlay 2>/dev/null; then echo "warning: failed to remove mcoverlay" >&2 fi fi # Remove SMP module -if [ "`lsmod | grep ihk_smp_x86`" != "" ]; then - if ! rmmod ihk_smp_x86; then +if grep ihk_smp_x86 /proc/modules &>/dev/null; then + if ! rmmod ihk_smp_x86 2>/dev/null; then echo "error: removing ihk_smp_x86" >&2 exit 1 fi fi # Remove core module -if [ "`lsmod | grep -E 'ihk\s' | awk '{print $1}'`" != "" ]; then - if ! rmmod ihk; then +if grep -E 'ihk\s' /proc/modules &>/dev/null; then + if ! rmmod ihk 2>/dev/null; then echo "error: removing ihk" >&2 exit 1 fi