From patchwork Thu Dec 17 15:34:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lai Jiangshan X-Patchwork-Id: 11979885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E42EEC4361B for ; Thu, 17 Dec 2020 14:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C508238EF for ; Thu, 17 Dec 2020 14:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726601AbgLQOen (ORCPT ); Thu, 17 Dec 2020 09:34:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbgLQOem (ORCPT ); Thu, 17 Dec 2020 09:34:42 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23A53C06138C; Thu, 17 Dec 2020 06:34:02 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id e2so20437364pgi.5; Thu, 17 Dec 2020 06:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XqJrHzwrbVCnYsklx/lbZ+b/PHnqbPpGX0MwSNjrUx0=; b=t+YqQn+q8oP+JS5tuezkORM/ouWFBiFsdi+TJ2+RV8BDwUIjGdimnJ4zP6IcEXt0v2 wG4l9UEOrBetfNTetpTyxDSic549Tcxlf6Vw8PGQKgqHAk+JdYbTBQqsXtx15TavfS+d Ab1MAf/FkVo5LRFFPYjBWbAkyfGGo5cvR8w0b2OQ1omSzfzQXD/OLNNYpSpi+ut/rnh1 9oWSLdgyy1izj/9AtKeGq4mk1+eh5EeGVD25kSu+vnC3iyv5uMh2mhdFRldiLOpZh7Ne M0o0wGqqpDioSGbAr4SJm3GdJkdr0WN/yu8g3ss31yEYTDSN548XnSC0BcyrXHcqkxbi KnGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XqJrHzwrbVCnYsklx/lbZ+b/PHnqbPpGX0MwSNjrUx0=; b=dj1HJRdFAKzTnYhslz3s2XS/ehgwtKR5Oy3k3FIJYFwuBUxR3QshKY/qBgnZ/Z485B wrrGx71VIlSCUMhLbb6Ar7jK7Xx/EkZ3L9gGm2Fb+3a2ffZi1AZdK6CHoeJUnvcA1xG8 ju/d7ZKb2BLhOCSpkzcUBWt+4PsC4LyBq62ZT+59GPNLxKGOHy8JLnFj/FrkSc5cl1E8 gogVPOxXihyz0XZUi/ioT++SQoTQoAueEtbeQpmhsKpEI5lZX1L5a+MgCpZXwdruPvsS ZUA70F1ZbL2M98aV+lT7RFGH1oL4IdY5X37A1dVctn7Q9Tzuy/3jlBfx9vBKgEiunQYB Gv4A== X-Gm-Message-State: AOAM5302Zdwk7lGn2nr2fD/AnVURZs0Qd9l4yRW7W8rmVJZN+vGOTI5/ PrDd3lNf0725U0mL6JrYl36iGrrvLDQMcQ== X-Google-Smtp-Source: ABdhPJxyUFWlxo3vqfDdhCyYFQmcNByGDl5ae49O6LLHOXx39EpzMRWGDvdlLo8qUo3P0URQrntbKQ== X-Received: by 2002:a05:6a00:ac5:b029:19d:97c2:d3a7 with SMTP id c5-20020a056a000ac5b029019d97c2d3a7mr30140018pfl.61.1608215641440; Thu, 17 Dec 2020 06:34:01 -0800 (PST) Received: from localhost ([47.251.4.198]) by smtp.gmail.com with ESMTPSA id v6sm6102924pfi.31.2020.12.17.06.34.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2020 06:34:00 -0800 (PST) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Lai Jiangshan , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftest: don't offline the last CPU in cpu hotplug test Date: Thu, 17 Dec 2020 23:34:32 +0800 Message-Id: <20201217153434.10945-1-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Lai Jiangshan In my box, all CPUs are allowed to be offline. The test tries to offline all offline-able CPUs and causes fail on the last one. We should just skip offlining the last CPU Signed-off-by: Lai Jiangshan --- tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | 5 +++++ 1 file changed, 5 insertions(+) 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 0d26b5e3f966..5cdef96326a7 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -126,6 +126,11 @@ offline_cpu_expect_success() { local cpu=$1 + # don't offline the last CPU if all CPUs are offline-able + if [[ a$cpu = a`cat $SYSFS/devices/system/cpu/online` ]]; then + return + fi + if ! offline_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 exit 1 From patchwork Thu Dec 17 15:34:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lai Jiangshan X-Patchwork-Id: 11979887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03685C2BB9A for ; Thu, 17 Dec 2020 14:35:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A74572396D for ; Thu, 17 Dec 2020 14:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728021AbgLQOet (ORCPT ); Thu, 17 Dec 2020 09:34:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbgLQOet (ORCPT ); Thu, 17 Dec 2020 09:34:49 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AF2C061794; Thu, 17 Dec 2020 06:34:09 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id s21so19126100pfu.13; Thu, 17 Dec 2020 06:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vurp5AB62xjY65/6uguVYlQjjwgwSNtjp5iCAxAyneI=; b=mQHlNiaQxsFzbhdWdM8P5t7Y4gC7Vq+rIJaPFhhej/EzteBKWkrd56IP7D6vMsN/Tz W87E1rjQmJs9xHil0hDHw35VX+XSIx6LkSl7F/4jJkezlI/GwYUzl+ewLijeXJ4dmJ6c h1xm4gy4O8qUqAxPYEWGBCfynXDD5c9A2BZZ8UsfDvHvmzeiW2VvDNV2H1QckdndBSLQ ARMzby6c0ea7bKZaV+0Tmqh80eQgw5RvsBrLiEPZvj7eqP2ic90nEBS8+N8T67aNjfKP ztApQwzqGwzwWmjV2e7llLTqRXc08Wi3wW8+FZTW70+JNmQIjsxNQQjSOkgxgIedsQWQ wlEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vurp5AB62xjY65/6uguVYlQjjwgwSNtjp5iCAxAyneI=; b=lI4NdXaOwc3vCIbqEdXHKjuYmDEI03jQYZmVHWlLimeDzW2ujgDtdLv8zT95NOBJKl L85xCg5AGulRthb/eHrHa3ugmaLlk/gvK34C11K0vJyFfIE59Qiv2Pom9oLkYtTOxCa4 I2XksN/nLiLs3qUTYELCntc2XEBk7EWVnOaobKakP+O9xeViKYs9XzKzOIMgzwQjQElE kRWP/IeifyQT2RC6Bwl9GgU72CZoqaLnjbbHjI/TNFBdXXjY5zi0jIHVkWe8vPDz4ZHY tYGrcwAW79vJ/WUleJmo+Nw4WZVo7aGIUDLfQG7qC1P9QuN2WD4DA36+2jLDqUzCnbTF RXPw== X-Gm-Message-State: AOAM531QzK7xqss5Z6MWDis3LrkBoyJavcVlEDm78+IGY43TLGUPYUGo tkPM/Y+vPwoho9RwKDOmwvDvY/Q8ttEF+A== X-Google-Smtp-Source: ABdhPJwa6j3MTE+2geq5QFVRSZ6FWeyy5u/CFgRUCzuoGygyTQnGk8x2QESlE0g9fE4DJmTJIZbpOA== X-Received: by 2002:aa7:8209:0:b029:19f:3002:513 with SMTP id k9-20020aa782090000b029019f30020513mr7206322pfi.49.1608215648491; Thu, 17 Dec 2020 06:34:08 -0800 (PST) Received: from localhost ([47.251.4.198]) by smtp.gmail.com with ESMTPSA id v12sm6531052pgq.3.2020.12.17.06.34.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2020 06:34:08 -0800 (PST) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Lai Jiangshan , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH 2/2] selftest: parse the max cpu corretly from cpu list string Date: Thu, 17 Dec 2020 23:34:33 +0800 Message-Id: <20201217153434.10945-2-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20201217153434.10945-1-jiangshanlai@gmail.com> References: <20201217153434.10945-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Lai Jiangshan "," is allowed in cpu list strings, such as "0-3,5". We need to handle these cases. Signed-off-by: Lai Jiangshan --- tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | 6 +++--- 1 file changed, 3 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 5cdef96326a7..ac37bd54ea1c 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -30,7 +30,7 @@ prerequisite() echo "CPU online/offline summary:" online_cpus=`cat $SYSFS/devices/system/cpu/online` - online_max=${online_cpus##*-} + online_max=${online_cpus##*[-|,]} if [[ "$online_cpus" = "$online_max" ]]; then echo "$msg: since there is only one cpu: $online_cpus" @@ -38,7 +38,7 @@ prerequisite() fi present_cpus=`cat $SYSFS/devices/system/cpu/present` - present_max=${present_cpus##*-} + present_max=${present_cpus##*[-|,]} echo "present_cpus = $present_cpus present_max = $present_max" echo -e "\t Cpus in online state: $online_cpus" @@ -47,7 +47,7 @@ prerequisite() if [[ "a$offline_cpus" = "a" ]]; then offline_cpus=0 else - offline_max=${offline_cpus##*-} + offline_max=${offline_cpus##*[-|,]} fi echo -e "\t Cpus in offline state: $offline_cpus" }