From patchwork Tue Mar 26 19:24:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10872113 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 6E5E31669 for ; Tue, 26 Mar 2019 19:24:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CAB028DC4 for ; Tue, 26 Mar 2019 19:24:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DD2C28DCB; Tue, 26 Mar 2019 19:24:51 +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 E859A28DC4 for ; Tue, 26 Mar 2019 19:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732196AbfCZTYu (ORCPT ); Tue, 26 Mar 2019 15:24:50 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37615 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732201AbfCZTYg (ORCPT ); Tue, 26 Mar 2019 15:24:36 -0400 Received: by mail-pf1-f196.google.com with SMTP id 8so8525825pfr.4 for ; Tue, 26 Mar 2019 12:24:35 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=VpO+kH5n/TCwOCtL6i6LDDDwCLUmaIA5kDbeBwsenW8=; b=ic2pO6JrvwEPAs1CnVuT7xWHP8ABOKGkFUt9H1s0OLBDzjFRw1epxg+DmzlHEGONnX IixtodF2vh92KGgKTGRYdCz8Qfg7aK04HlZJQmLZZu6bgaA7wzxGBDOf24vFPGpVK2hJ cmIfAFVEayqe/33wv7JRMHW2vxfovfoZ/Y5Ck= 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=VpO+kH5n/TCwOCtL6i6LDDDwCLUmaIA5kDbeBwsenW8=; b=hqX0c8RPwEQY6gq/9HbLoCYipeMMJ4zMiLtlV/Lu0NTqN9BomZOINnOA+mzO6ArywK 6RxWPnEkRaNcs+a9qGwz7LCNyceqEIrCotuj7fQUtRG0lkyIpwD2uT1J0z3l5SrXVfez +nro+ev0ZfO0k0y5YedmFfjTbX0LnQlYCr9mEFSGAMsgaUTvUaIBY7KXPgNiRPHMsNOc npDvfjpsIg+6wwrJ7jwIM8Ll8ljfaphq8MmyHj6Pj/Q7kCvzeA3mlr7GFz/MHqldgGUX y8YjKeRx5/oBvh9ISepiwKAro7H5uTAX9VU5YLVnHKWO1T8wstruWrv+PVDnHQeVQ94b 1clA== X-Gm-Message-State: APjAAAWBNTOMhosRXl3CBhSQkYOoTPMQvcdeQpSYA3z+eKwDjN5zshH4 pkV3B6ebtw67VarxBfwLkqriVA== X-Google-Smtp-Source: APXvYqxRuFbNRDdKaMGu2pfXId9tLkyI2m9Vc5ldX1d4DDCuVuNBaT6qoRUfJTbviF9W9099+n61Lg== X-Received: by 2002:a62:e502:: with SMTP id n2mr31731079pff.242.1553628275495; Tue, 26 Mar 2019 12:24:35 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id l12sm36761889pgn.83.2019.03.26.12.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 12:24:34 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , rcu@vger.kernel.org, byungchul.park@lge.com, Ingo Molnar , Josh Triplett , kernel-team@android.com, Lai Jiangshan , linux-kselftest@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Peter Zijlstra , Shuah Khan , Steven Rostedt , Will Deacon Subject: [PATCH v2 3/4] rcutorture: Select from only online CPUs Date: Tue, 26 Mar 2019 15:24:10 -0400 Message-Id: <20190326192411.198070-3-joel@joelfernandes.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190326192411.198070-1-joel@joelfernandes.org> References: <20190326192411.198070-1-joel@joelfernandes.org> 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. Cc: rcu@vger.kernel.org Signed-off-by: Joel Fernandes (Google) --- tools/testing/selftests/rcutorture/bin/jitter.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh b/tools/testing/selftests/rcutorture/bin/jitter.sh index 3633828375e3..47bd9829dc55 100755 --- a/tools/testing/selftests/rcutorture/bin/jitter.sh +++ b/tools/testing/selftests/rcutorture/bin/jitter.sh @@ -47,10 +47,11 @@ do exit 0; fi - # Set affinity to randomly selected CPU - cpus=`ls /sys/devices/system/cpu/*/online | + # Set affinity to randomly selected online CPU + cpus=`grep 1 /sys/devices/system/cpu/*/online | sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//' | grep -v '^0*$'` + cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN { srand(n + me + systime()); ncpus = split(cpus, ca);