From mboxrd@z Thu Jan 1 00:00:00 1970 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 C641FC6FA83 for ; Tue, 27 Sep 2022 07:41:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37E3C8E00B2; Tue, 27 Sep 2022 03:41:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32DA98E00AF; Tue, 27 Sep 2022 03:41:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CED88E00B2; Tue, 27 Sep 2022 03:41:25 -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 0AA8D8E00AF for ; Tue, 27 Sep 2022 03:41:25 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D568A140BC4 for ; Tue, 27 Sep 2022 07:41:24 +0000 (UTC) X-FDA: 79957070088.09.69C7328 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 59C4514000D for ; Tue, 27 Sep 2022 07:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664264483; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wz0ur1AHxlH7fz/miPX8mkQPPUSyAQo52GQCeq+89y0=; b=YZG4xQSg/Fqa4WjHC60QqdtbfUj4b8VC7NT18r4X4jG7pdV4WNbLgcH4Ofa9P4FqD///4V baYSGLtyMmwqcM1/1lKlJLiJ1wlG5OerOZerD9jYVsfwCkfpSO5YIYro79BFl4Nboxf8WU eslWmSu8JNbY96ldQaPq4NGNPAnrqSY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-94-quCVjhwTPpemoQ9vv7RGPQ-1; Tue, 27 Sep 2022 03:41:22 -0400 X-MC-Unique: quCVjhwTPpemoQ9vv7RGPQ-1 Received: by mail-wr1-f70.google.com with SMTP id h22-20020adfa4d6000000b0022cbee47920so269956wrb.6 for ; Tue, 27 Sep 2022 00:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=Wz0ur1AHxlH7fz/miPX8mkQPPUSyAQo52GQCeq+89y0=; b=BgudnV0zUKDiAfNQls3nhsga7L3nBrL2xdk1dvr1dxiBzCaYH5ZwYiPvI8Om7+DYKJ 546oZA4loDLZ59rLvKtBqz6xM5DBS0M5QL/DEFQRm38KYmkZ4qVzJc39qL0929xHt0BA bAT8/rvpskfZoitSfBR5PJgcS2+O3wttOt0HNVxh6K7X6ZtH15uaBY1g6LYfeRAiQrNb qxozV6ebKnhrz+VnKyETcisdLg0c38osLM6rvU00wPm9Fh63bwyERzKRafDuS5cvOxv8 FB+I7I1XVwve7BEiEWzTQD5o6/5CAAEvugjuJFiFwkS+LfPlyGGArvakafD1fMseKBXD x6sw== X-Gm-Message-State: ACrzQf1SbRJQI6KNMpItdZCBsmAtCXrpK9aVo108se7SqEMWRIQIFIj7 TXrwcyXN/Qq0eoejXGl/M5ZFtYOV+UteTWU6IOM6lW/++7C5aTY9adsDyrRllFORtFEJczh8G/Y K37uD2yUImEc= X-Received: by 2002:a5d:64eb:0:b0:22b:fe0:98e2 with SMTP id g11-20020a5d64eb000000b0022b0fe098e2mr15858723wri.178.1664264480859; Tue, 27 Sep 2022 00:41:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e+48WcaWEDSJYJpZ1vL2d444VYu79LJ/bkUvle1DpEGVRI2Nvd7IRUsVqoVTh4Ecfwry9Og== X-Received: by 2002:a5d:64eb:0:b0:22b:fe0:98e2 with SMTP id g11-20020a5d64eb000000b0022b0fe098e2mr15858710wri.178.1664264480570; Tue, 27 Sep 2022 00:41:20 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:ff00:9ec2:6ff6:11a1:3e80? (p200300cbc705ff009ec26ff611a13e80.dip0.t-ipconnect.de. [2003:cb:c705:ff00:9ec2:6ff6:11a1:3e80]) by smtp.gmail.com with ESMTPSA id c11-20020a05600c0a4b00b003b4fdbb6319sm15712391wmq.21.2022.09.27.00.41.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Sep 2022 00:41:20 -0700 (PDT) Message-ID: <9178c097-664b-11ce-272f-c24d24f012e7@redhat.com> Date: Tue, 27 Sep 2022 09:41:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH -next v4 2/3] selftests/memory-hotplug: Restore memory before exit To: Zhao Gongyi , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Cc: akinobu.mita@gmail.com, corbet@lwn.net, osalvador@suse.de, shuah@kernel.org References: <20220927032851.128174-1-zhaogongyi@huawei.com> <20220927032851.128174-3-zhaogongyi@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220927032851.128174-3-zhaogongyi@huawei.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664264484; a=rsa-sha256; cv=none; b=LPXo1vrqBjuvpL2M1g76hykWOXb2g9NquXkvqIoj7lHg8YspeHlzJRJEt4rCDc4ICqpGoA bE08UfgR6sj4J04HeuqBVnnXn1QO10rRV8kvUR2V2nClohFhTE4UV05noUe+YPvh6LqhMR 4leKVW5m8jACDSDBQk9tedueuCAC4Nc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YZG4xQSg; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664264484; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Wz0ur1AHxlH7fz/miPX8mkQPPUSyAQo52GQCeq+89y0=; b=IS0SviI/dsjdjbJiDzz1dKjEEfWj7PzUQ0ul32F+4gI8Oqb93F3JcoZN8A7M3TzsLKl2PD kN0BBNEmUTHjcGVXt/fYedQ8SEp4SXPEiESHyELlfp/zuWCpdR8FxiHiY2qU7jXHaarHQj ECwFWo9bTbTHlcjfmolzmN69EzQjVSg= X-Rspamd-Server: rspam03 X-Rspam-User: Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YZG4xQSg; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com X-Stat-Signature: og8dzjt1819sjkfzf7ezfcgjfr95zzzj X-Rspamd-Queue-Id: 59C4514000D X-HE-Tag: 1664264484-811873 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000996, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 27.09.22 05:28, Zhao Gongyi wrote: > 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 | 21 ++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > 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 > -- Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb