From patchwork Mon Sep 26 13:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12988684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E93DC07E9D for ; Mon, 26 Sep 2022 13:07:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CC1F8E0048; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8441A8E0047; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70C948E0046; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6291C8E0039 for ; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 34AE3140358 for ; Mon, 26 Sep 2022 13:07:38 +0000 (UTC) X-FDA: 79954263396.23.AFC485F Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf03.hostedemail.com (Postfix) with ESMTP id 7746820007 for ; Mon, 26 Sep 2022 13:07:36 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MbjfP6sfbzHpmT; Mon, 26 Sep 2022 21:05:17 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.63) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 21:07:32 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v3 1/3] selftests/memory-hotplug: Add checking after online or offline Date: Mon, 26 Sep 2022 21:03:39 +0800 Message-ID: <20220926130341.253039-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926130341.253039-1-zhaogongyi@huawei.com> References: <20220926130341.253039-1-zhaogongyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.63] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664197656; a=rsa-sha256; cv=none; b=pfcPqxAMAr4fSqujPdjVqQvL2EvS1zRFDdD+gJNnN95S93NuylD79zXM7arqyWdpuAA1Bp Am0sIDqfRYXs/W1TjxXY3DZpC0Iyogqjhk4ymvwNyIRGL3lFSsEkx6M3fX3l7ALoSkoN6g XYRhVx9yh4VjAdf3/V6Pd0672R0D81U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664197656; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mzgn0uw3BIsUPb0HV7gY1TMBB3TqMwIAwFShhuEJ1ec=; b=3Y1kA9GEH85iuPGZFIIokKp4m/AzH9qe5xfDqLcj0EQglf2UktXHyKi5ADytHt2zj7Nuw5 sFJGlW/lT2KZYZqbClptqzOpG8nF7dV+Fvuqb3LTpH+nYc4gnTZMyYWQphcaNxPaDDW39E V4sWng/ZuqWL4ILGIhzY80WKTTWFdiI= X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 7746820007 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Stat-Signature: tdizfwubftm3467ucm3em95mhbgyw6a9 X-HE-Tag: 1664197656-785415 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checking for online_memory_expect_success()/ offline_memory_expect_success()/offline_memory_expect_fail(), or the test would exit 0 although the functions return 1. Signed-off-by: Zhao Gongyi --- .../selftests/memory-hotplug/mem-on-off-test.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh index 46a97f318f58..3edda1f13f7b 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -266,7 +266,10 @@ done # echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error for memory in `hotpluggable_offline_memory`; do - online_memory_expect_fail $memory + online_memory_expect_fail $memory || { + echo "online memory $memory: unexpected success" + retval=1 + } done # @@ -274,7 +277,10 @@ done # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error for memory in `hotpluggable_offline_memory`; do - online_memory_expect_success $memory + online_memory_expect_success $memory || { + echo "online memory $memory: unexpected fail" + retval=1 + } done # @@ -283,7 +289,10 @@ done echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error for memory in `hotpluggable_online_memory`; do if [ $((RANDOM % 100)) -lt $ratio ]; then - offline_memory_expect_fail $memory + offline_memory_expect_fail $memory || { + echo "offline memory $memory: unexpected success" + retval=1 + } fi done From patchwork Mon Sep 26 13:03:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12988687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0A98C07E9D for ; Mon, 26 Sep 2022 13:07:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F2F08E0049; Mon, 26 Sep 2022 09:07:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44C768E0047; Mon, 26 Sep 2022 09:07:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22A0F8E0049; Mon, 26 Sep 2022 09:07:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0B6F68E0047 for ; Mon, 26 Sep 2022 09:07:40 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D7F1740B4D for ; Mon, 26 Sep 2022 13:07:39 +0000 (UTC) X-FDA: 79954263438.13.769D650 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf25.hostedemail.com (Postfix) with ESMTP id E32A2A0018 for ; Mon, 26 Sep 2022 13:07:38 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MbjbW6HnnzHtjp; Mon, 26 Sep 2022 21:02:47 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.63) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 21:07:33 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v3 2/3] selftests/memory-hotplug: Restore memory before exit Date: Mon, 26 Sep 2022 21:03:40 +0800 Message-ID: <20220926130341.253039-3-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926130341.253039-1-zhaogongyi@huawei.com> References: <20220926130341.253039-1-zhaogongyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.63] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664197659; a=rsa-sha256; cv=none; b=3DsBNXgzgY/Z6JOyf0vbVGUIiqOtO4/w8//LWafKWymYNx3Xu+dRZO7cDGWLBnh04SBpNI 0loV9TRR8dNpMExxKGTaRxALwsQZlqf+M7hM8QFqCX2VN9FzVN2TDyPDzE7TpsxdQyIlSr RmJXG+y8vE9w7nqw9266iXMaU51cBFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664197659; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+ucIlu97PPyASTCqO5HqLLIqCdRTf4rBblueIrLXunY=; b=YM+FGmXSthhxRUcJAVdrnJJdczNUDYnR8Zg391XkT/SRXq0Oupi3rBQ0UP7ZMgaRA48Uop QMeeWICRGZajPjFS58ssEdTMBC5U0+mxe3m3nA1NNKdQcULVjbGnqh7kCZDe+4ZzvIu2rM gMwu6Sowyu76/76+H5U2SWg3xYXz138= X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E32A2A0018 X-Stat-Signature: kamxdxgwrb16gbhai3duabhm4awfomg4 Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-HE-Tag: 1664197658-76368 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Some momory will be left in offline state when calling offline_memory_expect_fail() failed. Restore it before exit. Signed-off-by: Zhao Gongyi --- .../memory-hotplug/mem-on-off-test.sh | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh index 3edda1f13f7b..6173859d3379 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -134,6 +134,16 @@ offline_memory_expect_fail() return 0 } +online_all_offline_memory() +{ + for memory in `hotpluggable_offline_memory`; do + online_memory_expect_success $memory || { + echo "online memory $memory: unexpected fail" + retval=1 + } + done +} + error=-12 priority=0 # Run with default of ratio=2 for Kselftest run @@ -276,12 +286,7 @@ done # Online all hot-pluggable memory # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error -for memory in `hotpluggable_offline_memory`; do - online_memory_expect_success $memory || { - echo "online memory $memory: unexpected fail" - retval=1 - } -done +online_all_offline_memory # # Test memory hot-remove error handling (online => offline) @@ -299,4 +304,9 @@ done echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error /sbin/modprobe -q -r memory-notifier-error-inject +# +# Restore memory before exit +# +online_all_offline_memory + exit $retval From patchwork Mon Sep 26 13:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12988686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47BE3C6FA83 for ; Mon, 26 Sep 2022 13:07:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07E178E0039; Mon, 26 Sep 2022 09:07:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02D918E0047; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5DC78E0039; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D630B8E0047 for ; Mon, 26 Sep 2022 09:07:38 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B1D19120C88 for ; Mon, 26 Sep 2022 13:07:38 +0000 (UTC) X-FDA: 79954263396.30.A7D570E Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 0510EC0026 for ; Mon, 26 Sep 2022 13:07:37 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MbjcM58xgzWh5P; Mon, 26 Sep 2022 21:03:31 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.63) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 21:07:34 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v3 3/3] docs: notifier-error-inject: Correct test's name Date: Mon, 26 Sep 2022 21:03:41 +0800 Message-ID: <20220926130341.253039-4-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926130341.253039-1-zhaogongyi@huawei.com> References: <20220926130341.253039-1-zhaogongyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.63] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664197658; a=rsa-sha256; cv=none; b=enSAP5G4Pgk88lpBbiaqC+dAofYmc0O48kj8zlAKrZr17Hr261We8rSxt9IjweeeB0tLMe dZB42/V6tqHyfPEU8g/blNPBude9DFJl6vNY0n2/5DXD3sd7MjAcm9dYYT9vhetTLb+vcb uzQFUjyGmpjmS7Td2M87NqE8U2b3s7c= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664197658; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r1ZDDIW2eFS2NJbuhgxKbpf1IivBqY4os6rjBiejqgk=; b=MvtxUswiCti/QnmFwW5yyayTOyJW+UUO2Tf0Kj2J0LR351H9td9CgdRYgAdk0AGMckpK1v Kkzg+dg11P1I+z6Bj7f1oWOL4jaf3lJDn5r26hHYpwMDf5NUL/re1pUVGxE4e3IvF2nZnf gE2IH0YcOI+VqjT3QhmnxXvTmPC9W80= X-Rspamd-Server: rspam03 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Stat-Signature: bzcozn3uoes3pmkqaez6gomtij3m6553 X-Rspamd-Queue-Id: 0510EC0026 X-HE-Tag: 1664197657-921122 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Correct test's name for mem-on-off-test.sh/cpu-on-off-test.sh. Signed-off-by: Zhao Gongyi Reviewed-by: David Hildenbrand --- Documentation/fault-injection/notifier-error-inject.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/Documentation/fault-injection/notifier-error-inject.rst b/Documentation/fault-injection/notifier-error-inject.rst index 1668b6e48d3a..fdf2dc433ead 100644 --- a/Documentation/fault-injection/notifier-error-inject.rst +++ b/Documentation/fault-injection/notifier-error-inject.rst @@ -91,8 +91,8 @@ For more usage examples There are tools/testing/selftests using the notifier error injection features for CPU and memory notifiers. - * tools/testing/selftests/cpu-hotplug/on-off-test.sh - * tools/testing/selftests/memory-hotplug/on-off-test.sh + * tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh + * tools/testing/selftests/memory-hotplug/mem-on-off-test.sh These scripts first do simple online and offline tests and then do fault injection tests if notifier error injection module is available.