From patchwork Sat Mar 23 03:46:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10866747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E100713B5 for ; Sat, 23 Mar 2019 03:46:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C29AF2A834 for ; Sat, 23 Mar 2019 03:46:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B398B2A840; Sat, 23 Mar 2019 03:46:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 614342A834 for ; Sat, 23 Mar 2019 03:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbfCWDqm (ORCPT ); Fri, 22 Mar 2019 23:46:42 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37354 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbfCWDql (ORCPT ); Fri, 22 Mar 2019 23:46:41 -0400 Received: by mail-pf1-f196.google.com with SMTP id 8so2785770pfr.4 for ; Fri, 22 Mar 2019 20:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y7urVVlGfP+Dr6qybUiwWY4XqrDZhKCkR15U/6No/2w=; b=L2Kvmy9bFB3fiCk6xnItiq1AKYagpWpHBkKLBRgMB0Vefj122+OTKGSsifJBhOF0TL HZxhW7Fe1uh0yZV7ZNLmB8bOtl+KnJJSuBUdECFhtp/FlqMkz1FMbotK0TfmCb525wvl 99poxvRcZB5xpVDsbnHAt/0JN4TPHgff6cf6c= 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=Y7urVVlGfP+Dr6qybUiwWY4XqrDZhKCkR15U/6No/2w=; b=BUO15jCsxiaZPve6TnjSMyGdc3zo32Ji2JCIUthKwvjkOnl8ssOG8o1KCbyQxshF2S 03Drp4Aee6lB6M5O4txCk7AoQ1hklUSow6MDl0cWVzuavCnAJn07/Yb30GrXHw3P8PrN P7fkQwLHxIQl5uKvBjoT8M/BhA6LfvjA1UcKu3QrwUAqizL2YkEhi51ku07/RJU/WjMN troLc8W9QyaWCJh07JYQoygQZScKJYvrqabNvs20zP0H34nY9dBuPaHIPHaj0Ea1CGYl miaQKnkefm7tHSl39pVsOcuxwUf0K6xeOu860Sp9xsp4QVIk+2Q2zOsfniF5B7k6f7hg HwYw== X-Gm-Message-State: APjAAAU/vBTF8q6JwoEobs+ITXv0uog4Q5T8h3V27HUEOt7/L8wFsWjQ MgMuA8A9pHKSxZdPzEXLCBMyzQ== X-Google-Smtp-Source: APXvYqxXcHoKOQx3nBzz0qkbJRXzzRFTfB9hxQ/A1WzjfDfrEpvfaZAZ921lWk2gcRp/kA2JPAPShw== X-Received: by 2002:a17:902:8489:: with SMTP id c9mr69606plo.311.1553312801137; Fri, 22 Mar 2019 20:46:41 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id m7sm18061559pgg.62.2019.03.22.20.46.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 20:46:39 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Josh Triplett , Lai Jiangshan , linux-kselftest@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Shuah Khan , Steven Rostedt Subject: [PATCH] rcutorture: Select from only online CPUs Date: Fri, 22 Mar 2019 23:46:19 -0400 Message-Id: <20190323034619.15792-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The rcutorture jitter.sh script selects a random CPU but does not check if it is offline or online. This leads to taskset errors many times. On my machine, hyper threading is disabled so half the cores are offline causing taskset errors a lot of times. Let us fix this by checking from only the online CPUs on the system. Signed-off-by: Joel Fernandes (Google) --- tools/testing/selftests/rcutorture/bin/jitter.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh b/tools/testing/selftests/rcutorture/bin/jitter.sh index 3633828375e3..53bf9d99b5cd 100755 --- a/tools/testing/selftests/rcutorture/bin/jitter.sh +++ b/tools/testing/selftests/rcutorture/bin/jitter.sh @@ -47,10 +47,19 @@ do exit 0; fi - # Set affinity to randomly selected CPU + # Set affinity to randomly selected online CPU cpus=`ls /sys/devices/system/cpu/*/online | sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//' | grep -v '^0*$'` + + for c in $cpus; do + if [ "$(cat /sys/devices/system/cpu/cpu$c/online)" == "1" ]; + then + cpus_tmp="$cpus_tmp $c" + fi + done + cpus=$cpus_tmp + cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN { srand(n + me + systime()); ncpus = split(cpus, ca);