From patchwork Fri Sep 9 07:51:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971195 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 04FF4ECAAD5 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BBFE8D0006; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86B9F8D0001; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 733E48D0006; Fri, 9 Sep 2022 03:55:39 -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 66E588D0001 for ; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 294331606C4 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) X-FDA: 79891787598.07.43D6B55 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf25.hostedemail.com (Postfix) with ESMTP id 471FDA00A5 for ; Fri, 9 Sep 2022 07:55:38 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MP7Xf3KXyzHngB; Fri, 9 Sep 2022 15:53:38 +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.24; Fri, 9 Sep 2022 15:55:35 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 1/5] docs: notifier-error-inject: fix non-working usage of negative values Date: Fri, 9 Sep 2022 15:51:56 +0800 Message-ID: <20220909075200.198363-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-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; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662710138; a=rsa-sha256; cv=none; b=c6ecu/PPbE83lSfOVxeeWbfY9dgtYT43jJzBz79z7CA0QYAhsX0mPpULZVP2SHOVyXKDlc w4/Wd8sqtlJ0bHkhTc5qjhGrvfK58CG4LHRfafZnfYMtD60nD17O5wCRlcNVdbxzPH69s7 OLUFehQzwWKWjKTewzNLocX55vZsupo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662710138; 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=FM5FPnNCknRy6kBMjXhRDVq5x0+KPm9flgrZKjcm+5w=; b=3mgMGRp0ehU+sbFqJEwv2liUjCJphlHVkZ2XghZkm0cUu3vBPHNvguNLMxizjmNUptpjRL y6Ol3aqBNxIYk1gdatXYLjfoEWcPD0yUgXeTE4KaF0O6GK0hLfe6hbiJZc9wuHmu1AAvsz ow0BQL3v1femYgGs5UprD7pAEZLSJMo= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 471FDA00A5 Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: zn8ejtucpzyihg398hhd56ksb9zig3hi X-Rspam-User: X-HE-Tag: 1662710138-847677 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: Fault injection uses debugfs in a way that the provided values via sysfs are interpreted as u64. Providing negative numbers results in an error: # cd sys/kernel/debug/notifier-error-inject/memory # echo -12 > actions/MEM_GOING_ONLINE/error -bash: echo: write error: Invalid argument Update the docs and examples to use "printf %#x " in these cases. Signed-off-by: Zhao Gongyi --- .../fault-injection/notifier-error-inject.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/Documentation/fault-injection/notifier-error-inject.rst b/Documentation/fault-injection/notifier-error-inject.rst index 1668b6e48d3a..0e2790122166 100644 --- a/Documentation/fault-injection/notifier-error-inject.rst +++ b/Documentation/fault-injection/notifier-error-inject.rst @@ -11,6 +11,10 @@ modules that can be used to test the following notifiers. * powerpc pSeries reconfig notifier * Netdevice notifier +Note that the interface only accepts unsigned values. So, if you want +to use a negative errno, you'd better use 'printf' instead of 'echo', e.g.: +$ printf %#x -12 > actions/PM_SUSPEND_PREPARE/error + PM notifier error injection module ---------------------------------- This feature is controlled through debugfs interface @@ -26,7 +30,7 @@ Possible PM notifier events to be failed are: Example: Inject PM suspend error (-12 = -ENOMEM):: # cd /sys/kernel/debug/notifier-error-inject/pm/ - # echo -12 > actions/PM_SUSPEND_PREPARE/error + # printf %#x -12 > actions/PM_SUSPEND_PREPARE/error # echo mem > /sys/power/state bash: echo: write error: Cannot allocate memory @@ -44,7 +48,7 @@ Possible memory notifier events to be failed are: Example: Inject memory hotplug offline error (-12 == -ENOMEM):: # cd /sys/kernel/debug/notifier-error-inject/memory - # echo -12 > actions/MEM_GOING_OFFLINE/error + # printf %#x -12 > actions/MEM_GOING_OFFLINE/error # echo offline > /sys/devices/system/memory/memoryXXX/state bash: echo: write error: Cannot allocate memory @@ -82,7 +86,7 @@ Netdevice notifier events which can be failed are: Example: Inject netdevice mtu change error (-22 == -EINVAL):: # cd /sys/kernel/debug/notifier-error-inject/netdev - # echo -22 > actions/NETDEV_CHANGEMTU/error + # printf %#x -22 > actions/NETDEV_CHANGEMTU/error # ip link set eth0 mtu 1024 RTNETLINK answers: Invalid argument From patchwork Fri Sep 9 07:51:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971196 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 F22CDECAAA1 for ; Fri, 9 Sep 2022 07:55:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D7988D0001; Fri, 9 Sep 2022 03:55:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55E7F940007; Fri, 9 Sep 2022 03:55:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 317B78D0007; Fri, 9 Sep 2022 03:55:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1F8B28D0001 for ; Fri, 9 Sep 2022 03:55:40 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DC607809C4 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) X-FDA: 79891787598.23.5640CF0 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf15.hostedemail.com (Postfix) with ESMTP id 45961A0070 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MP7Xh0fJvzHnfF; Fri, 9 Sep 2022 15:53:40 +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.24; Fri, 9 Sep 2022 15:55:36 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 2/5] selftests/memory-hotplug: Use 'printf' instead of 'echo' Date: Fri, 9 Sep 2022 15:51:57 +0800 Message-ID: <20220909075200.198363-3-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-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; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.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=1662710139; a=rsa-sha256; cv=none; b=p/Q5nFuyoQYdfhCFxrCgp1gT054SkbQR4pyLMv/SI/V/wlNI5hHCAnE+L0XlR4/txs9oAO e6JXPrzpe9ahDHv42MpM3USh97fIY6DVR8IkZJf3HsEfxSHP5rNmFtD3QTdCscuW4ceYBZ 7RNMEwWlXPQIIxtuTw6Qv0c+00a5jJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662710139; 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=ptvVmzSrRdAVQwrzWIZgnRsScC39RT8DiiEWXDbw1TY=; b=hgGMKZEwSQusVwxLq2Agp+rS54ci6cNoYrbEczDpziwAtmqGYZemGR/frCgtAfu1sYV5iP soR2O157eycoSKuLEnbvzxOw8tPWk/3JTUg3ERz9XsSWeA/md28MkMOkS7kBd4hIWjDlSq fQjXYy4wwHqfC0ikvY+mi8mhKg4+Rfo= Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: sah7rpysx1na7hh9hxmdqkck5snypqzf X-Rspamd-Queue-Id: 45961A0070 X-HE-Tag: 1662710139-727638 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: Fault injection uses debugfs in a way that the provided values via sysfs are interpreted as u64. Providing negative numbers results in errors: # sh mem-on-off-test.sh ... mem-on-off-test.sh: line 267: echo: write error: Invalid argument ... mem-on-off-test.sh: line 283: echo: write error: Invalid argument ... # Signed-off-by: Zhao Gongyi --- tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 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..f1a9d81b934c 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -264,7 +264,8 @@ done # # Test memory hot-add error handling (offline => online) # -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error +printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/erro + for memory in `hotpluggable_offline_memory`; do online_memory_expect_fail $memory done @@ -280,7 +281,7 @@ done # # Test memory hot-remove error handling (online => offline) # -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error +printf %#x $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 From patchwork Fri Sep 9 07:51:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971197 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 88007ECAAD3 for ; Fri, 9 Sep 2022 07:55:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A7C3940008; Fri, 9 Sep 2022 03:55:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 980E2940007; Fri, 9 Sep 2022 03:55:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81F94940008; Fri, 9 Sep 2022 03:55:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6F6F6940007 for ; Fri, 9 Sep 2022 03:55:41 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4080B16063C for ; Fri, 9 Sep 2022 07:55:41 +0000 (UTC) X-FDA: 79891787682.29.E61560C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id 96C50C006F for ; Fri, 9 Sep 2022 07:55:40 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MP7Wx5qhBznVDK; Fri, 9 Sep 2022 15:53:01 +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.24; Fri, 9 Sep 2022 15:55:37 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 3/5] selftests/memory-hotplug: Add checking after online or offline Date: Fri, 9 Sep 2022 15:51:58 +0800 Message-ID: <20220909075200.198363-4-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-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=1662710140; a=rsa-sha256; cv=none; b=ilqv1CfNUOMoPEZqR28GCA8u9DlPnU726XI4BeS2oi8YFX846fHmh1RzfZbGEOe8wUEKhq aLlQfIUrNziadAKAVFr2bs4va7Z+yOXtTYITKA7e+EUI4fmkgms+1Bhkaut269tA8CzfZZ iJf4pixe/AHxfhsoWLsV/s5qF5j707c= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.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=1662710140; 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=t+aBi1A5LSDvxYRGukK2kg48jOMsk6Nfsc768Mj5Aio=; b=4zY4swYSo3gykYGk3TVETbHchd+WFo/0vLpMTjAFLzfT45eTf+tjWA6ZQWMvFENoqhiWcz RcFy2Qy8GeZORQpTpm+7Z+JoOdTPHgytwHlK2VcVJJ98XkZspYPrSIxeeCvAOraNn/IggW T9IV5Bu18AMK3B0oiCiEcFohHru8D0E= X-Stat-Signature: pmxkb1qqnyk8n4wqkg6motkaxe93kd3y X-Rspamd-Queue-Id: 96C50C006F X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspamd-Server: rspam12 X-HE-Tag: 1662710140-762163 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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 --- .../memory-hotplug/mem-on-off-test.sh | 18 +++++++++++++++--- 1 file changed, 15 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 f1a9d81b934c..3bdf3c4d6d06 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -267,7 +267,11 @@ done printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/erro 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 # @@ -275,7 +279,11 @@ 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 # @@ -284,7 +292,11 @@ done printf %#x $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 Fri Sep 9 07:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971199 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 4A432ECAAD3 for ; Fri, 9 Sep 2022 07:55:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B5AD940009; Fri, 9 Sep 2022 03:55:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EE31940007; Fri, 9 Sep 2022 03:55:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0585394000B; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C7522940009 for ; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A52468024D for ; Fri, 9 Sep 2022 07:55:42 +0000 (UTC) X-FDA: 79891787724.10.7AB8DCA Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf02.hostedemail.com (Postfix) with ESMTP id E4D7F8008A for ; Fri, 9 Sep 2022 07:55:41 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MP7VW5ywJz14QWx; Fri, 9 Sep 2022 15:51: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.24; Fri, 9 Sep 2022 15:55:38 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 4/5] selftests/memory-hotplug: Restore memory before exit Date: Fri, 9 Sep 2022 15:51:59 +0800 Message-ID: <20220909075200.198363-5-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-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=1662710142; a=rsa-sha256; cv=none; b=iKficWSnhPDg/o3GWtHZ/OmC9AT9a0M1+GdQEDZiQHNVXzhtQMvDVho34mpS/m2ePt0co7 ITiGZA09qTYyajoivSHfArpzvCfh+rKlvDbfCHDB4dPQfVZGPEO1ZrYDwJdFJ0uTMml8IN RIn/9i7DDxzeZNDKHDw0VkT4/lYqDFY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.255 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=1662710142; 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=lfmLJr7wfi+Xo/sAoDearhzCmZmtmOq+MOv3QySRyAI=; b=rZCHMWRTmJ8e3q/kfk19M0700CBYJloDV9TvIGG2OMoNmc49lUEvAroBfVvEVBe6EunCAN ZVmlIfUC06mCmOIJBoEcTafk2rSTsOIExIXGFPt3n/Bu6qjYDQybPz1A4jmAREd+oTU4fC FdwaPZSk8Nb6a19mXE2IK6vHvCPRPVk= X-Rspamd-Server: rspam03 X-Rspam-User: X-Stat-Signature: m9k4zascdmncrktkaf6a51frtcapih6d X-Rspamd-Queue-Id: E4D7F8008A Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1662710141-552444 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 | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 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 3bdf3c4d6d06..259fd8978639 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,17 @@ offline_memory_expect_fail() return 0 } +online_all_hot_pluggable_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 @@ -278,13 +289,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_hot_pluggable_memory # # Test memory hot-remove error handling (online => offline) @@ -303,4 +308,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_hot_pluggable_memory + exit $retval From patchwork Fri Sep 9 07:52:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971198 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 DE84DECAAA1 for ; Fri, 9 Sep 2022 07:55:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA85E94000A; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B54EC940007; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A498940009; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8BEB9940007 for ; Fri, 9 Sep 2022 03:55:42 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7059E8024D for ; Fri, 9 Sep 2022 07:55:42 +0000 (UTC) X-FDA: 79891787724.01.86ABCE1 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf12.hostedemail.com (Postfix) with ESMTP id E192540094 for ; Fri, 9 Sep 2022 07:55:41 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MP7Vn5hs4zmVM4; Fri, 9 Sep 2022 15:52:01 +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.24; Fri, 9 Sep 2022 15:55:39 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 5/5] docs: notifier-error-inject: Correct test's name Date: Fri, 9 Sep 2022 15:52:00 +0800 Message-ID: <20220909075200.198363-6-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-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=1662710142; a=rsa-sha256; cv=none; b=5TY/YGWeO5TOghQLiDnFltsOOJhPZBWN/Ul5wYALzQgX3Wu7Inu2PkAxhWUmgiFlogUNsa YjSfUH5ms1KOXly/XK0NaD0BI1jS/GVuWMhiDx1hAI/RewRse4PfUG2YSI0LbaEDeLpLsW NCHfUMGluDaX1kNgbkAtjAn9PgO9uhQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.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=1662710142; 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=h39W/NM0cD//sI4lV6iyHr4bmmoOMEEvd87rAebCJfU=; b=mRdtBkleqqj/dJGUYzr9uFGZi06kdspsJD+lORVyGm/9ikkkOzV+amThjJPXy32KtzjiAJ dISptm3RJbFN3w+98IaaHFl2TTanQDiLjeA7fc0K/CaHYT9Z7PTvgGl3wtDS4k4nsAxYgl i79gHi6ltgXjFmip0r6HbkqBhCo+sJs= Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspam-User: X-Rspamd-Queue-Id: E192540094 X-Rspamd-Server: rspam09 X-Stat-Signature: 4i8f8ubnxtn87bjw86xztta8guibi4kq X-HE-Tag: 1662710141-696041 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 0e2790122166..170c583eb5bc 100644 --- a/Documentation/fault-injection/notifier-error-inject.rst +++ b/Documentation/fault-injection/notifier-error-inject.rst @@ -95,8 +95,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.