Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp52039pxm; Tue, 22 Feb 2022 16:27:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJynH+Iw1nsyYRg7W/uwy7JfjRPF8klpRwZSgF/FYlwMT/RiM8vnfv2wU7FP+M6huLCpnl4l X-Received: by 2002:a17:906:714c:b0:6cf:4850:52cc with SMTP id z12-20020a170906714c00b006cf485052ccmr21255388ejj.319.1645576044997; Tue, 22 Feb 2022 16:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645576044; cv=none; d=google.com; s=arc-20160816; b=RwOwsRBDYDsxv7wxVoL2RjC3atZp4qT8ive6VvZOl+McYBmMB25kMNqilC+11u511r +LlWnp6gnw0eR+ZHDWUNjRWRN29tRRC75ng8aiYrqHnsSrmSXMGmszSMkc83H7ZhBmrX SPXoAzxNJZQbEYT3XaJ5cDf0t+EXQPb5APbVJkO6gveAxeEHLKZfvwoZj5pbUa+pBGXd IOhLVA7OjhP6TU5+7P2fBvqqcT+S2bCQx1gBYBbU+3iS8OKIr8cN5hap5VqvtVADPT+V 45DJrcKUK2m4K84DKHb8iZzVmCBdTHSzcj4Z89Q+Gw3ByczS9+1QCzgIN6Dtm1Utjkow ANvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7k4+BgkXcDagKgnG2qY1+glzEDOErw+uqubVma0xNdo=; b=ZquQ+PkuhLRFtNRiEsF9S6JeIWTwAWMjvUryy72s/5OKsgByEg3TEMgvBLXStAQ1Og v78zEEFaMK3Nv5h4Bngn6vdcXTJFV7twhYdVI3yf48d3CoTFigqygLgFhSI1SDz9R0VA iBpopHqNB1Pa1oFteeym66DeAHBL5tVm47U2wOdyH3fVyMbmKzmspwP11AhtjrDWhtxj RggUu1wQy2xNrcRWOHyVNKmxjz1fIfHXhPck5LheIOpT9zg4d6JyLAVZEBySVbKxlu5v OIxXSM90utez8PqdDYWXJkCv0XyYsrs5qa6KTZkJj2cJXkP7tcKvRDYDu3oPN91zOJRQ nCpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JM5TDoR6; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw2si13196586ejc.709.2022.02.22.16.26.59; Tue, 22 Feb 2022 16:27:24 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=JM5TDoR6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbiBVRn5 (ORCPT + 99 others); Tue, 22 Feb 2022 12:43:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbiBVRnz (ORCPT ); Tue, 22 Feb 2022 12:43:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DCA01688F9; Tue, 22 Feb 2022 09:43:30 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id CADEB6135F; Tue, 22 Feb 2022 17:43:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35572C340E8; Tue, 22 Feb 2022 17:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645551809; bh=DmHgyuRJSQJXP4y4nwKOfhnNvc5tuz329RwqznVDwN8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=JM5TDoR6PLHEOElzcfgrnX1loUapcSrdjr7XcOcrIjsueMby9+yUu4DOD1tR2K2BE DtZGtIpWShSj52o9Se+0WlnzqiZLRJ5as4EETAQhVJI9vco8jEqxR76h6uaYMkeMJh 4xNZPKeq29P4sQpuSWyT8h6wW9PV/2yT6w5vQDVVQm56MWOeG8IFMxpgzbDioWnu1L tO9CL/Rm0QXUzVRSBUk6LSQNiGpj/jsfQJXB5GW7Uz43N4yVnjzkSJ3bM8htdu/6oa LKlJ+DmxlScYISA5nd6eWFGnVdbx2a9uSfpKuxVQSvMt9KXbgRukiGrj/yqCmonDl2 uarqfHSejNm9g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E2E105C031F; Tue, 22 Feb 2022 09:43:28 -0800 (PST) Date: Tue, 22 Feb 2022 09:43:28 -0800 From: "Paul E. McKenney" To: Paul Menzel Cc: Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Shuah Khan , Zhouyi Zhou , rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] torture: Make thread detection more robust by using lspcu Message-ID: <20220222174328.GL4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220222120718.17141-1-pmenzel@molgen.mpg.de> <20220222120718.17141-2-pmenzel@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220222120718.17141-2-pmenzel@molgen.mpg.de> X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 On Tue, Feb 22, 2022 at 01:07:17PM +0100, Paul Menzel wrote: > For consecutive numbers *lscpu* collapses the output and just shows the > range with start and end. The processors are numbered that way on POWER8. > > $ sudo ppc64_cpu --smt=8 > $ lscpu | grep '^NUMA node' > NUMA node(s): 2 > NUMA node0 CPU(s): 0-79 > NUMA node8 CPU(s): 80-159 > > This causes the heuristic to detect the number threads per core, looking > for the number after the first comma, to fail, and QEMU aborts because of > invalid arguments. > > $ lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p' > $ > > (Before the last patch, the whole line was returned.) > > $ lscpu | grep '^NUMA node0' | sed -e 's/^[^,-]*(,|\-)\([0-9]*\),.*$/\1/' > NUMA node0 CPU(s): 0-79 > > *lscpu* shows the number of threads per core, so use that value directly. > > $ sudo ppc64_cpu --smt=8 > $ lscpu | grep 'Thread(s) per core' > Thread(s) per core: 8 > $ sudo ppc64_cpu --smt=off > $ lscpu | grep 'Thread(s) per core' > Thread(s) per core: 1 > > Note, the replaced heuristic is also incorrect for that case, where the > threads per core are disabled. > > $ lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p' > 8 > > Signed-off-by: Paul Menzel Makes sense, and thank you for chasing this down and for the fix! But should this patch and 1/2 be merged? Or am I confused and they are somehow affecting two different lines of scripting? Thanx, Paul > --- > tools/testing/selftests/rcutorture/bin/functions.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh > index 5cff520955e6..66d0414d8e4b 100644 > --- a/tools/testing/selftests/rcutorture/bin/functions.sh > +++ b/tools/testing/selftests/rcutorture/bin/functions.sh > @@ -301,7 +301,7 @@ specify_qemu_cpus () { > echo $2 -smp $3 > ;; > qemu-system-ppc64) > - nt="`lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p'`" > + nt="`lscpu | sed -n 's/^Thread(s) per core:\s*//p'`" > echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt > ;; > esac > -- > 2.35.1 >