From patchwork Wed Oct 19 08:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251130wrs; Wed, 19 Oct 2022 03:50:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IzGz2X0KgzhdDUruku6UFewvqyJYNjYPiyUL2NHN+RyR36Ck4ZLByk5Qwadtx+CpI/dgt X-Received: by 2002:a05:6402:1e8d:b0:454:79a9:201f with SMTP id f13-20020a0564021e8d00b0045479a9201fmr6917755edf.176.1666176656378; Wed, 19 Oct 2022 03:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176656; cv=none; d=google.com; s=arc-20160816; b=TFWv3Nuv36aQGQVlnmt5lrHDlA4YdTaE58yWF3n8Awr42rYo/e7GWCicctxPRC4v2x ibdm1xnMp+szQzDFCgH0GipUyU2YGWyNK/YqvmJyzV8JEIRo+amZFatJGJxfWlYI6LkJ E92TeN3cM0YgIpZJDK7r333lfXB3B4Vko7SpMnVRNqypawXGXuI5XydtlQqI6h6oeqhK XjlHbMfwuXOwXzZKCf5K/u1o51TmzO/6+z3KBpqm3goWfu8R6ddRs7Dmce00Ceq5dSWg SLLD2/+efAcVehkM9QmdyjRcYmIWjqNw9L/tpesdqfQgjSL4LFU5/b1dg9OCnHOtHwMT l5tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LWUgJhCifC6EHhFaRZfYsi42jCxM/QqW0NZr3mUESYg=; b=sdDMlNpkLV9VuyxQ5MpZagelofQjBPW5HEf3ICoFlbgEOV2M0t1fNBqXx/UYe4cGJi SkAEwB9WVMRbaxGL8TwcHcXxGheAPTVBaGPW99sL4VZFW6hYZeV0JEuB16j/tdaPWT0V gF/7GoecWyXrdZECLEGHdJwvbV5T31XqHlmu1iSQJJhKGlmAX3ffmj6xhb1YJ6SRnf7N R3P9B7/WJuR4H/TaSuyvIuGU82fE2rDtqwVcCmuzCqXajhFKJSlJccGbJcSrbjczvXpl r/pcutaAkN509lncBB+TDGg98GblEn3wHFpMtfQ6FD+dBLB71myn27JE7OHDDdl+6fZ2 FXDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M8iy/iiG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc32-20020a17090716a000b0078ddd8656d9si14919060ejc.9.2022.10.19.03.50.31; Wed, 19 Oct 2022 03:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M8iy/iiG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232817AbiJSKuA (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiJSKrF (ORCPT ); Wed, 19 Oct 2022 06:47:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F0DA15B122; Wed, 19 Oct 2022 03:21:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14B5CB82436; Wed, 19 Oct 2022 08:58:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 872F1C433C1; Wed, 19 Oct 2022 08:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169911; bh=4D97w+ZQu+bU7Fk+WX+tUrif/4N620Eec9wOqEqA3S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M8iy/iiGFAuGS+5fJrG5hJMpQbdSwdRiXD/ZJ8aDnpPEHUZda4yyX9C3BdEH2fAN3 4GRrPJ9xUg1ILJPmV0+Qq3UCOBIXnbmDIlubtMstxhvh3CrymCvs5Zboknz73oDAld yj8c/6ABV75bSVChNp+b3YO334H83BhpAxzAs6kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhao Gongyi , Shuah Khan , Sasha Levin Subject: [PATCH 6.0 456/862] selftests/cpu-hotplug: Reserve one cpu online at least Date: Wed, 19 Oct 2022 10:29:03 +0200 Message-Id: <20221019083310.133101348@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112853365635462?= X-GMAIL-MSGID: =?utf-8?q?1747112853365635462?= From: Zhao Gongyi [ Upstream commit 51d4c851465c32143d9c7b1cfb46fc581922b116 ] Considering that we can not offline all cpus in any cases, we need to reserve one cpu online when the test offline all hotpluggable online cpus, otherwise the test will fail forever. Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug") Signed-off-by: Zhao Gongyi Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh index 32ec7e4489ee..4c1d6d9abecc 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -149,6 +149,25 @@ offline_cpu_expect_fail() fi } +online_all_hot_pluggable_cpus() +{ + for cpu in `hotplaggable_offline_cpus`; do + online_cpu_expect_success $cpu + done +} + +offline_all_hot_pluggable_cpus() +{ + local reserve_cpu=$online_max + for cpu in `hotpluggable_online_cpus`; do + # Reserve one cpu oneline at least. + if [ $cpu -eq $reserve_cpu ];then + continue + fi + offline_cpu_expect_success $cpu + done +} + allcpus=0 online_cpus=0 online_max=0 @@ -197,25 +216,10 @@ else echo -e "\t online all offline cpus" fi -# -# Online all hot-pluggable CPUs -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done +online_all_hot_pluggable_cpus -# -# Offline all hot-pluggable CPUs -# -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_success $cpu -done +offline_all_hot_pluggable_cpus -# -# Online all hot-pluggable CPUs again -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done +online_all_hot_pluggable_cpus exit $retval