Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2290931imc; Tue, 12 Mar 2019 10:42:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwed1H3kyMrsTFe7ST5t/E/fbUPYrQt7yvVhmuQ8wHR6TH9c3Fcal3cvSQkzqCHEdERpOwx X-Received: by 2002:a62:1303:: with SMTP id b3mr41091901pfj.147.1552412537992; Tue, 12 Mar 2019 10:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552412537; cv=none; d=google.com; s=arc-20160816; b=nWTZkz46zDoTxhIuVw1DOmarcCe4B6EHo8Swdnhc/r2oXqbWjKwMCG6JL3mMHEPgmv W03yB/RGU/5OxJoAgRqtT2paJ8SgqWU1LL7Tj2w2/s17w5NsscnHplSOh6BoB8mrAREo 5YsMspsGqL6RuT0W4vzUmXiUKqxU95XRs/hFg/osbg2p1i13fV0vCny8SkjW7rFTusby 8b79zMMrKnXxLxmONE/EJgJI8meGzJCaOy3M3lkUskJfST+RuvYESmtt9FzfTvdG3+zs T3cTeKT2QnU/q8d+axfY4B+mMIrjaAahZJk8alqbdIYXA3si/wA5XNf6N4q/O10Rt/lS TxOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MoQI8qLSvXbNXhTUMGAlqsvo0kmw64XiyKuO22dk9aA=; b=sgIgJKb0CR1L58z3duTTubzgS3t4nSF5QF9ZpUPM/NIbvktgJm9lcgnNVw17cgf/vh 0BFncFJqSn+4Dtp4fOOWZP9XjJWUguK9CeAXtrD6ypBxKps6770CqWS1/GPYqcSe36+E 81wen+/a29hFPw3Wj9YeIbue1t77vVifAAyqLzh476H5fTp16VUmDOZM/5GO7vYvxxMM q1fhZXSxkEC8ZE9N2aW0rjv7Lmvy1NlSDhTHM1NwJbWPkp15MZ0Zs1+Ld/vXbH7lV05K RhkCgsThDJOl59BQoOXyXOpRG/Ylfymnh2hW42ppnl0kgT/UEMx8RmAR3QGlweCAA7oR 36Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MdqBFiuQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si3172098pgq.125.2019.03.12.10.42.02; Tue, 12 Mar 2019 10:42:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MdqBFiuQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729172AbfCLRjt (ORCPT + 99 others); Tue, 12 Mar 2019 13:39:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:57956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729067AbfCLRQS (ORCPT ); Tue, 12 Mar 2019 13:16:18 -0400 Received: from localhost (unknown [104.133.8.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B155E2183F; Tue, 12 Mar 2019 17:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410977; bh=rcgj4uFqzecp/VfI3X3sGGN8roB1SMjVWPrNfOob1QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdqBFiuQs1QkHPMBUiv5ur7zQQPcc70Zr5GJ/XrNZdnHw7fqUe/Qc6BkbKYlTFsXS c9qSFUVx4xB+Bt3DSEt3u/5X27jz9T5Jia+VQmbk7w7vG3PSxMqIKNXksdccHSJQ0P 22MOA88UtXLo1mXHJAi2qaUH5t7pJZCF6PWSsKME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Shuah Khan , Sasha Levin Subject: [PATCH 4.14 053/135] selftests: cpu-hotplug: fix case where CPUs offline > CPUs present Date: Tue, 12 Mar 2019 10:08:20 -0700 Message-Id: <20190312170346.068561418@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170341.127810985@linuxfoundation.org> References: <20190312170341.127810985@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 2b531b6137834a55857a337ac17510d6436b6fbb ] The cpu-hotplug test assumes that we can offline the maximum CPU as described by /sys/devices/system/cpu/offline. However, in the case where the number of CPUs exceeds like kernel configuration then the offline count can be greater than the present count and we end up trying to test the offlining of a CPU that is not available to offline. Fix this by testing the maximum present CPU instead. Also, the test currently offlines the CPU and does not online it, so fix this by onlining the CPU after the test. Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug") Signed-off-by: Colin Ian King Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 f3a8933c1275..49ccd2293343 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -35,6 +35,10 @@ prerequisite() exit 0 fi + present_cpus=`cat $SYSFS/devices/system/cpu/present` + present_max=${present_cpus##*-} + echo "present_cpus = $present_cpus present_max = $present_max" + echo -e "\t Cpus in online state: $online_cpus" offline_cpus=`cat $SYSFS/devices/system/cpu/offline` @@ -149,6 +153,8 @@ online_cpus=0 online_max=0 offline_cpus=0 offline_max=0 +present_cpus=0 +present_max=0 while getopts e:ahp: opt; do case $opt in @@ -188,9 +194,10 @@ if [ $allcpus -eq 0 ]; then online_cpu_expect_success $online_max if [[ $offline_cpus -gt 0 ]]; then - echo -e "\t offline to online to offline: cpu $offline_max" - online_cpu_expect_success $offline_max - offline_cpu_expect_success $offline_max + echo -e "\t offline to online to offline: cpu $present_max" + online_cpu_expect_success $present_max + offline_cpu_expect_success $present_max + online_cpu $present_max fi exit 0 else -- 2.19.1