From patchwork Tue Sep 27 03:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12989833 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 004BBC54EE9 for ; Tue, 27 Sep 2022 03:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EC8A8E00A5; Mon, 26 Sep 2022 23:32:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89BE18E0090; Mon, 26 Sep 2022 23:32:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78B6C8E00A5; Mon, 26 Sep 2022 23:32:51 -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 6D18E8E0090 for ; Mon, 26 Sep 2022 23:32:51 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3A27DAAA0A for ; Tue, 27 Sep 2022 03:32:51 +0000 (UTC) X-FDA: 79956443742.10.18947BB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf08.hostedemail.com (Postfix) with ESMTP id 2620A160011 for ; Tue, 27 Sep 2022 03:32:48 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mc4qz1CvlzpTmh; Tue, 27 Sep 2022 11:29:51 +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; Tue, 27 Sep 2022 11:32:45 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Subject: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline Date: Tue, 27 Sep 2022 11:28:49 +0800 Message-ID: <20220927032851.128174-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927032851.128174-1-zhaogongyi@huawei.com> References: <20220927032851.128174-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=1664249570; a=rsa-sha256; cv=none; b=cz+J37jhQg/OPqpZ58ZU1wEV9brUXKE+4VVnR4WcV+5hFPh4I2oQ+pHdL0AlnLfWzMMMie wekSGwxdoJ74MSpOfIRBcUPMtJ5mrmGF2dPU2QPS+aenMg2mFh/UrIWR4cSLMKZI4k4GfW VVc0DSvDAOoVjIZaElyh8rdvDg5I6UE= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.187 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=1664249570; 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=H7fmGVVf9PPyDgmxWNL6RDAaY4UU8mP6bxHJ+Y31tuo=; b=gYj14+fOwJmZFppN6XBKPcaoGTXfhXQ6oL3bl9Q0EJcvQeJ7JAQPd3rF5odocSy/bSaJYM 0koPY0cvk+iGqr5BU9XVMh3TD/0MUZ/jPGYH2OAdSkYEhkCtiD+N4sCrw71MLp49Q/HdZ1 xOPALjI8zmZSS0HKtsnxPCVz7n2ysac= Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2620A160011 X-Stat-Signature: hx8p3f5n5dj1idnppgdphj1r7jm4cok7 X-Rspam-User: X-HE-Tag: 1664249568-23890 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 Reviewed-by: David Hildenbrand --- .../selftests/memory-hotplug/mem-on-off-test.sh | 12 +++++++++--- 1 file changed, 9 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..1d87611a7d52 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,9 @@ done # echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error for memory in `hotpluggable_offline_memory`; do - online_memory_expect_fail $memory + if ! online_memory_expect_fail $memory; then + retval=1 + fi done # @@ -274,7 +276,9 @@ done # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error for memory in `hotpluggable_offline_memory`; do - online_memory_expect_success $memory + if ! online_memory_expect_success $memory; then + retval=1 + fi done # @@ -283,7 +287,9 @@ 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 + if ! offline_memory_expect_fail $memory; then + retval=1 + fi fi done From patchwork Tue Sep 27 03:28:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12989835 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 64EC4C6FA93 for ; Tue, 27 Sep 2022 03:32:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F9CF8E00A7; Mon, 26 Sep 2022 23:32:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A8E48E0090; Mon, 26 Sep 2022 23:32:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FBB38E00A8; Mon, 26 Sep 2022 23:32:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0057A8E00A7 for ; Mon, 26 Sep 2022 23:32:51 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BDB4DC0710 for ; Tue, 27 Sep 2022 03:32:51 +0000 (UTC) X-FDA: 79956443742.18.3CF82F0 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf01.hostedemail.com (Postfix) with ESMTP id 36C5940008 for ; Tue, 27 Sep 2022 03:32:50 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mc4pS1L6ZzlXMF; Tue, 27 Sep 2022 11:28:32 +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; Tue, 27 Sep 2022 11:32:46 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Subject: [PATCH -next v4 2/3] selftests/memory-hotplug: Restore memory before exit Date: Tue, 27 Sep 2022 11:28:50 +0800 Message-ID: <20220927032851.128174-3-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927032851.128174-1-zhaogongyi@huawei.com> References: <20220927032851.128174-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=1664249571; a=rsa-sha256; cv=none; b=k+Q7wMzCZIAI+Qucnk/YOvRJLzNhBkreQ08rlF4yxTN3GyQt/c2TMTaenv6WYZiOtNVp+8 YGxQh36CjN+rsKWAk0mMmCyIxBZW5i+GbJBfRU97xcgwMbyDpZLztRRHQlv6vlaVk5yin8 cVvdsrDdEOyT+9AjKao6ggR/H4lvwwc= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664249571; 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=+DfEmh0PutoNkD56lBwHXsWUSeC0EnJJkVTdXFcnoic=; b=htl+oJWzdSJ1hhqpuExis768+kQwTRjiy56YAr8ul5NNgI+sPjG8Dtx6PDEMigy3xTAv9n 8c3Z0UJOKmAcGAFHEudEtpx0ZSUOOFRPW7bSbtm6A7oNgiC6Vm4dAUKnixrANm+jfC6qBE 9KDK9QaJRWBG2m9r1a/ZxAU98tN3XOk= Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: iau4qnzch9p97p5qedthjetuepdkytaj X-Rspamd-Queue-Id: 36C5940008 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1664249570-493767 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 Reviewed-by: David Hildenbrand --- .../memory-hotplug/mem-on-off-test.sh | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 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 1d87611a7d52..91a7457616bb 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 + if ! online_memory_expect_success $memory; then + echo "$FUNCNAME $memory: unexpected fail" >&2 + retval=1 + fi + done +} + error=-12 priority=0 # Run with default of ratio=2 for Kselftest run @@ -275,11 +285,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 - if ! online_memory_expect_success $memory; then - retval=1 - fi -done +online_all_offline_memory # # Test memory hot-remove error handling (online => offline) @@ -296,4 +302,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 Tue Sep 27 03:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12989836 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 24E0EC6FA82 for ; Tue, 27 Sep 2022 03:32:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E47328E00A8; Mon, 26 Sep 2022 23:32:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA8FA8E0090; Mon, 26 Sep 2022 23:32:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B83378E00A8; Mon, 26 Sep 2022 23:32:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A5D0A8E0090 for ; Mon, 26 Sep 2022 23:32:54 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5A44A160324 for ; Tue, 27 Sep 2022 03:32:54 +0000 (UTC) X-FDA: 79956443868.14.F5A2DA8 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 2CE861C0009 for ; Tue, 27 Sep 2022 03:32:52 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mc4pg4SNQzWgsB; Tue, 27 Sep 2022 11:28:43 +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; Tue, 27 Sep 2022 11:32:47 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Subject: [PATCH -next v4 3/3] docs: notifier-error-inject: Correct test's name Date: Tue, 27 Sep 2022 11:28:51 +0800 Message-ID: <20220927032851.128174-4-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927032851.128174-1-zhaogongyi@huawei.com> References: <20220927032851.128174-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=1664249572; a=rsa-sha256; cv=none; b=NwxwOHIbwOGlOXI+RmqCIW54PWh9FpfgcJuFFbGZVB0RTIoLFcoaH5ZNSUPHb9qZ5NlJOJ vDwrCvkYZvUkyecd+fw+0oFYNDYYDcQUTUDHNy6wfcklGeeFwXFBrXnqmAd+HnD3WtJc6R LeYhHKxwqBsYapda/QjlWwGqQWarXt0= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664249572; 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=TkD/5ut2SGvu48p3oRm2tzbLwEbGDslb2w9P6Ez0kGlHzh4CxjlgxMxKcNMOzIl/Zh40UB EJrgxxQygEBAw6mK6KMxtiB727b/S6Gn5pTwTVjjgkwRxUdyWzNPX+4CkRpTRcoX6mZ7dA N+qemLErqavzZzXyqD1ExsV3EDpqqe0= Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: 8rfbt5m3teyma9u9h5udwehitapkh38z X-Rspamd-Queue-Id: 2CE861C0009 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1664249572-832568 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.