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