From patchwork Thu Sep 15 08:57:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12977057 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 8C068C6FA86 for ; Thu, 15 Sep 2022 09:01:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32C706B0075; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B4868D0005; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17EB78D0003; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 03D106B0074 for ; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D569FA0CA3 for ; Thu, 15 Sep 2022 09:01:53 +0000 (UTC) X-FDA: 79913727306.22.6101022 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 484AD1C00C1 for ; Thu, 15 Sep 2022 09:01:52 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrh92LPqzmVPx; Thu, 15 Sep 2022 16:58: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.31; Thu, 15 Sep 2022 17:01:47 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 1/5] docs: notifier-error-inject: fix non-working usage of negative values Date: Thu, 15 Sep 2022 16:57:53 +0800 Message-ID: <20220915085757.258608-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-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; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663232512; a=rsa-sha256; cv=none; b=Ee1Wt/xJfD2qMZoV5F5jmhKaWWs6XWMPxovuqZensTH7iTzL4KT9PdJsTluLKyf6QPFuEx Vut0F4eg9Oe19UyvFNXBWEmclBRSJI5cv30mUAx9D1CmK2/uyJt2ciCAb+brhmHEiQGQ9Q 6EvWMvJ/lwlL286YM3YMZqE/OfuPhq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663232512; 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=7TzQVCBqcgNuWDkzqXPmETtsBzHFV2HsKvKC8Vn+8J1KAgbgzNnvIxTjFPaYDLbvWetHKe SQGKppkKFb+2Dx+DdElausxg3bW83oBD8TK26HqNtBIropMsg9VLnDojXg9SjjqwgqXKRh kdwiMXoP9tK0lBmJvSmq4FXtikvLAYQ= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 484AD1C00C1 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: kx7cagghdcygn69u9mh9whem9b9z3bg1 X-HE-Tag: 1663232512-316232 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 Thu Sep 15 08:57:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12977068 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 4BF03ECAAA1 for ; Thu, 15 Sep 2022 09:02:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D198C6B007E; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C52048D0005; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF2C68D0002; Thu, 15 Sep 2022 05:02:18 -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 A1E156B0078 for ; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7F8B2140C78 for ; Thu, 15 Sep 2022 09:02:18 +0000 (UTC) X-FDA: 79913728356.29.7961ADA Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf18.hostedemail.com (Postfix) with ESMTP id EC5871C00A4 for ; Thu, 15 Sep 2022 09:02:17 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrgj4ZpPzNmFg; Thu, 15 Sep 2022 16:57:37 +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; Thu, 15 Sep 2022 17:01:49 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 2/5] selftests/memory-hotplug: Use 'printf' instead of 'echo' Date: Thu, 15 Sep 2022 16:57:54 +0800 Message-ID: <20220915085757.258608-3-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-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=1663232538; a=rsa-sha256; cv=none; b=A4Og14Ub7dIv0xfW10EdGxOdfQDRYn0Jw0azaiMsFAxa8odx3CDbWnCHbv72ukK2tsWYU7 UnoWOLrj2kqRF+IyotwuiwXpkGu6iTTlgOT9A7gFRqeB7SCAO9rm+jqr6C9uRkgczBLgwt Nk6KZC8/DugFdAg/Rhjcgc5YQ1WVt7Q= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=pass (imf18.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=1663232538; 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=X6eA5oqqnYCFqqHjXEtml2P59t81nfwiRN72fSdms9g75T709rEP8sloh8fR+Slo53dXIk yEz+yvUoBrVYtNMcXvXATvuu0kKKVv6ooim2ZvPspeIKwHsASrJePSTOEm4POnQg7Gctw+ SaKlreOkfnJRzCKaQUzxezLzWFza/H0= Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.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-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3drbyrnhwnihu113mj3j65e3cu5uifxz X-Rspamd-Queue-Id: EC5871C00A4 X-HE-Tag: 1663232537-220454 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 Thu Sep 15 08:57:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12977070 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 1BF88C6FA86 for ; Thu, 15 Sep 2022 09:02:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4186C8D0002; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38B8E6B007D; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D634D8D0002; Thu, 15 Sep 2022 05:02:18 -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 BBA0B8D0003 for ; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8BE4C40CBE for ; Thu, 15 Sep 2022 09:02:18 +0000 (UTC) X-FDA: 79913728356.26.36D7706 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 6F67FC00C2 for ; Thu, 15 Sep 2022 09:02:17 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrgj56NbzNmG4; Thu, 15 Sep 2022 16:57:37 +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; Thu, 15 Sep 2022 17:01:49 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 3/5] selftests/memory-hotplug: Add checking after online or offline Date: Thu, 15 Sep 2022 16:57:55 +0800 Message-ID: <20220915085757.258608-4-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-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; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663232538; a=rsa-sha256; cv=none; b=FdIeozLf4AzMuenoWE2uxLyUzo1VEGtQ9R7ZeTE1YlBK0yYp7FIf/ms6XZkp1/OQFoHBcr P4KIa8Kc6hEwLU9tcVGXP5i6Q2+HLDgeiY8ndeqHm0wsLkKisd8vrzGFi2KxXfsYJjsyq9 fuZ3MdPJvJzXocD1gbC52BgPZ1zsZCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663232538; 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=ZecRRB0pWUX0kA9jOILHiJs0lLuOWrk5lFF/8tauzDwTD1I0lO1Bmr3JXrHmRgt9UeALUW cYTXvuGQUuFiEgt5M3ocK48Ys2MoCmCVBcco/TS9/Ta05V+0ie8NifeEl9csiYMftC12BI 5+pr4iAlZd8VjgcqvPewJD/02aoqEmE= 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-Rspam-User: X-Rspamd-Queue-Id: 6F67FC00C2 X-Rspamd-Server: rspam01 X-Stat-Signature: wqhns15oi6qgjcpyg6xgiqa7y1k6wgix X-HE-Tag: 1663232537-795136 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 --- .../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 Thu Sep 15 08:57: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: 12977069 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 CB87FECAAD3 for ; Thu, 15 Sep 2022 09:02:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A0756B0078; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01C848D0006; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D15DF6B007D; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B537F6B0078 for ; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9391040CCB for ; Thu, 15 Sep 2022 09:02:18 +0000 (UTC) X-FDA: 79913728356.20.928E953 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id 6FBF1400A5 for ; Thu, 15 Sep 2022 09:02:17 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrgj5cSHzNmGT; Thu, 15 Sep 2022 16:57:37 +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; Thu, 15 Sep 2022 17:01:50 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 4/5] selftests/memory-hotplug: Restore memory before exit Date: Thu, 15 Sep 2022 16:57:56 +0800 Message-ID: <20220915085757.258608-5-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663232538; 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=NO4tZrLG/ZuaYV9P9x5/P/zhmHOHBsdA7KD8hxGL3UQ=; b=a+Te9XhtOmIpgU6YhqNRlyipL8acjilXfQ/4D3omkZZBy7A+USnNH+SThklxjpcbxV1BYr o2dCD48iQC61tVon9gTtHA01Gs3ltUm5XFcivwk6uW0YME+Zn/vGhXEQ66BKQQT4yIBiVA 5hWmNgwkrZv5BEx3drdixd5/Dl5/Y30= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1663232538; a=rsa-sha256; cv=none; b=qFLoAdzaPsLYrlFLIjDGgYkGMZvfySGIv8JlqhDNF6Kyo61jqcDWtNTeP0E21X+PwlCxs1 36lfSC9+wFT9CUmTZfiosRC0G08uJ7C4Uc0HFRQGh1ssBy8HcUAAgVmG8O3vbwMz9oOB8e PuNXBgELgRyuCmkDERWJyPRUZjdKPD0= Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 6FBF1400A5 X-Stat-Signature: kndj1tfk7ccbxecdwmr54eohe3xphqik X-HE-Tag: 1663232537-243069 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..c620adf33629 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_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 @@ -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_offline_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_offline_memory + exit $retval From patchwork Thu Sep 15 08:57: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: 12977071 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 800B6ECAAD3 for ; Thu, 15 Sep 2022 09:02:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 635CD6B007B; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A1678D0005; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F38A98D0003; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C75246B0078 for ; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AF444A0C8E for ; Thu, 15 Sep 2022 09:02:18 +0000 (UTC) X-FDA: 79913728356.14.7D25803 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 1200C40112 for ; Thu, 15 Sep 2022 09:02:17 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrgk1rHwzNmGF; Thu, 15 Sep 2022 16:57: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.31; Thu, 15 Sep 2022 17:01:51 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 5/5] docs: notifier-error-inject: Correct test's name Date: Thu, 15 Sep 2022 16:57:57 +0800 Message-ID: <20220915085757.258608-6-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-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=1663232538; a=rsa-sha256; cv=none; b=fUkVbh/S3jy8GhVuSvfBpt5N7SAdTuEtMSDFsG1IsnGAoVNHWQV0Vic7IgYTWKKpqQMVpk /HoOUW2Wq0Zv2z+hRC3gaKkAk1kdm+pJ/+9IXRICoDAYjKmf20FXywPwKR0ALvhZjHY4md HCaSbjv0KCnHTZOfJUf4jUzBzqPoo9E= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.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=1663232538; 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=VX6J7y0igZIw/OKY41TcYG+yE/3ydGwruO9fz8OdF6c=; b=1cYl/dwvkQMtA9uvRMqD/7Nj+2DHiu5artY+Xf1vO8811q/8UbV7ZkZ+rOXEc7/eWaavnd ShRK4u55HJj5eY1/U25y2ruD0vGZKUoihUY9Q85to/+mlYJhHg1mfTB8CcL6GrxVEIwvDz r/J+AyHwXeVniSiVEgc0WKqdEFic20U= X-Stat-Signature: qtuqj55in8wcy7q8k4s7wnmbwpisztot X-Rspamd-Queue-Id: 1200C40112 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspamd-Server: rspam02 X-HE-Tag: 1663232537-296731 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.