From patchwork Mon May 20 11:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Paul Adrian Glaubitz X-Patchwork-Id: 13668204 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3705D182DF for ; Mon, 20 May 2024 11:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=130.133.4.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203478; cv=none; b=lGOyIJq5CHAD8pqnnAONN6+Aww/X3RGsc1GdoLdvMF0YVzfERiU6r4ywVPQOMt45XP6QMf7uazWfcxVoDDHrm3v2a0+Mqm6+18WUeWLfxo2Syq89W3LJuQKGBjXI6jd9EG+ORO8eORlm9CJC2ivYz+uA9EuV19QWHNsW78xhE6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203478; c=relaxed/simple; bh=cs6A4UkWdl/w7crwYvSYznrY3s3D92v1CuvQaknXS7k=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NSd2FkEJDXbhnwHcQM+JMfcgaLfzbRMY079SrY9tntfiwIGJJCWk/HdXbwDCcvWgU5jzy11Ezcor3GP5gbO+3kMD1BEwkd0DFb6ntkorfQciJDtTvddI0sVFyLRDe52QeN/aQQb+eKNkC1iiQD/YzSb/cSyfIYnk79WHnrXWSCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=physik.fu-berlin.de; spf=pass smtp.mailfrom=zedat.fu-berlin.de; dkim=pass (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b=Yk6pCo9f; arc=none smtp.client-ip=130.133.4.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=physik.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zedat.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b="Yk6pCo9f" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fu-berlin.de; s=fub01; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TJB69kFi25+o7AGvHqKDdChmqEtI5EMwywmtlrQHtxg=; t=1716203475; x=1716808275; b=Yk6pCo9fs4h0X//U6jeoUeBksR7Findb/W0+DaE/vs30mBhCeRoLNMLu/481P0Er9K/Y/TDJy8s hTWuEbxXbnXvJseMtxFUbxz7k00gT65252NyEl5qMDCaOinf4XPgzE+6me1vkKJq7+EfRZ5+l6Li3 oiUN6ZkBlLI3bV+HaSqvJLc8UDebzF78P5IkEbcwUvJgAG5CRAyvShsE2U3ckqcMtRvOTLaSHnqz3 DhDPOloKQh6cfnoU7AO9Mu3C199jxLsG1u5QkDyRuygQ+/dpM8vjd5lLHqSIirlJ5Qe2RGg4o8bTM UcZohpHI67+ykufWdIM+JgWxGwTrVRC76AnQ==; Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.97) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1s90v9-00000000DJ6-18U4; Mon, 20 May 2024 13:11:11 +0200 Received: from p57bd9a40.dip0.t-ipconnect.de ([87.189.154.64] helo=z6.fritz.box) by inpost2.zedat.fu-berlin.de (Exim 4.97) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1s90v9-00000001VGP-0Fze; Mon, 20 May 2024 13:11:11 +0200 Received: from glaubitz by z6.fritz.box with local (Exim 4.96) (envelope-from ) id 1s90v8-000PzD-29; Mon, 20 May 2024 13:11:10 +0200 From: John Paul Adrian Glaubitz To: git@vger.kernel.org Cc: Eric Sunshine , Sam James , Andreas Larsson , John Paul Adrian Glaubitz Subject: [PATCH] chainlint.pl: Extend regexp pattern for /proc/cpuinfo on Linux SPARC Date: Mon, 20 May 2024 13:11:09 +0200 Message-Id: <20240520111109.99882-1-glaubitz@physik.fu-berlin.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Original-Sender: glaubitz@physik.fu-berlin.de X-ZEDAT-Hint: PO On SPARC systems running Linux, individual processors are denoted with "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:" so that the current regexp in ncores() returns 0. Extend the regexp to match lines with "CPUnn:" as well to properly detect the number of available cores on these systems. Signed-off-by: John Paul Adrian Glaubitz --- t/chainlint.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/chainlint.pl b/t/chainlint.pl index 556ee91a15..63cac942ac 100755 --- a/t/chainlint.pl +++ b/t/chainlint.pl @@ -718,7 +718,7 @@ sub ncores { # Windows return $ENV{NUMBER_OF_PROCESSORS} if exists($ENV{NUMBER_OF_PROCESSORS}); # Linux / MSYS2 / Cygwin / WSL - do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\s\d]*:/, <>)); } if -r '/proc/cpuinfo'; + do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\s\d]*:||^CPU[\d]*:/, <>)); } if -r '/proc/cpuinfo'; # macOS & BSD return qx/sysctl -n hw.ncpu/ if $^O =~ /(?:^darwin$|bsd)/; return 1; From patchwork Mon May 20 19:01:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sunshine X-Patchwork-Id: 13668602 Received: from impout002.msg.chrl.nc.charter.net (impout002aa.msg.chrl.nc.charter.net [47.43.20.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00A9A137C27 for ; Mon, 20 May 2024 19:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.43.20.26 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231810; cv=none; b=JIo1FBWG16msWeD3NDoR/u/BzScSgomdkARcUIOzevt6Gq+GnHMpAIh/itV3w1j6HFNpGgMDZyrUd6oWEV+FZoZieThr1pWkEC1JWGfQC0RNbD/SeZhwOw6HN/G0EeJc3AKiIXz8UUXBECEJIGj4cBgZUIMAWLYU6HML0qwPCnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231810; c=relaxed/simple; bh=7587w9jyCAQ0zpXz3sTZrRCR6J8sKuMuU7jbspxxDNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sW8yEc5RHbLBl2m8HHQ34NiJsv4E8UGmYJwvSiNtWBpTMVNc5puaZAcPNF4f/zzbzuPay4p4fmRxa9MLzHUY75pBZPAJ3c/iWt0x0hDZK9AessL8dKI2VkPZq4AxOCiZp+9q44Pt352DOi80fmcjXyTLxsYOn+HcQC+g/58mHEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=charter.net; spf=pass smtp.mailfrom=charter.net; dkim=pass (2048-bit key) header.d=charter.net header.i=@charter.net header.b=E0K/xEWY; arc=none smtp.client-ip=47.43.20.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=charter.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=charter.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=charter.net header.i=@charter.net header.b="E0K/xEWY" Received: from localhost.localdomain ([97.71.114.58]) by cmsmtp with ESMTPA id 98GYsTho2i0hy98GdsQjS2; Mon, 20 May 2024 19:01:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=charter.net; s=c20240129; t=1716231712; bh=7587w9jyCAQ0zpXz3sTZrRCR6J8sKuMuU7jbspxxDNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E0K/xEWY8YN9LutJqvFN0g5LSZl9K/8I7MrRUURC2vF+YtEpnEXWAkqoMGTMMWzE6 /yUz6lKcMPRgWSPbq2gT3fqWKEz7fPxKUCEv5XDlM7JJkZIbJEozzDJjmp8jpVl3Vy LElapbTNP09fymPiE5XdYXfTw6Do6AnXezpkNj0kd1AxiPt22FMxESj0FuJjGL+5Vu itIKCGlo7eQLvToafTBe+t+PPHy6dFK+51ijxfd5NsE80cC6yUH/BMPRe6TuGiAisx qegyvzdRNbBodinj8ZB0tCSzPOlOzNJR2Q1siIi5wA+WoFEU29L0g86QS/LHH6jy39 WAmDa19r/4D0Q== Authentication-Results: charter.net; auth=pass (LOGIN) smtp.auth=ericsunshine@charter.net X-Authority-Analysis: v=2.4 cv=Wf8KaVhX c=1 sm=1 tr=0 ts=664b9e20 a=4h87Vkt5vDwEBqoyvSX4iA==:117 a=4h87Vkt5vDwEBqoyvSX4iA==:17 a=BCjA09oAAAAA:8 a=XVdubl8vyDbsfP2rsRcA:9 a=jYKBPJSq9nmHKCndOPe9:22 From: Eric Sunshine To: git@vger.kernel.org Cc: Junio C Hamano , John Paul Adrian Glaubitz , Eric Sunshine Subject: [PATCH 2/3] chainlint.pl: fix incorrect CPU count on Linux SPARC Date: Mon, 20 May 2024 15:01:30 -0400 Message-ID: <20240520190131.94904-3-ericsunshine@charter.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240520190131.94904-1-ericsunshine@charter.net> References: <20240520111109.99882-1-glaubitz@physik.fu-berlin.de> <20240520190131.94904-1-ericsunshine@charter.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfB7QGDXEuRasyztpVK8MLyBevEnVIZTSKmZgSiUFVNlOxDg/bgblh71gFwbx61n+lFLCiQX5j+VeFnMLhDCPdm+InoGvdYwQKsxgLyDioA9K/Og/MESM qnuMWUWGh2o2e9FBl9nynopGWqDc6VPyraCWhBhzFZvTp/YkupdfTrIDFM75WZ7DJlua2lypYaWjwzV0Sfp7YyAfSU37A8wnaMg7vIKcDk4vmshLNM80bv31 9xTs8QjoaWXtXmgqiOa4OkondmFlbMgWBdmnoIpdFhuxU1/cT3wEgR8QcXFZ90fst/jdXwaBLTsjGp04+aGyog== From: John Paul Adrian Glaubitz On SPARC systems running Linux, individual processors are denoted with "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:". As a result, the regexp in ncores() matches 0 times. Address this shortcoming by extending the regexp to also match lines with "CPUnn:". Signed-off-by: John Paul Adrian Glaubitz [es: simplified regexp; tweaked commit message] Signed-off-by: Eric Sunshine --- t/chainlint.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/chainlint.pl b/t/chainlint.pl index d9a2691889..d593cb95e7 100755 --- a/t/chainlint.pl +++ b/t/chainlint.pl @@ -724,7 +724,7 @@ sub ncores { if (open my $fh, '<', '/proc/cpuinfo') { my $cpuinfo = do { local $/; <$fh> }; close($fh); - my @matches = ($cpuinfo =~ /^processor[\s\d]*:/mg); + my @matches = ($cpuinfo =~ /^(processor|CPU)[\s\d]*:/mg); return @matches ? scalar(@matches) : 1; } # macOS & BSD From patchwork Mon May 20 19:01:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sunshine X-Patchwork-Id: 13668603 Received: from impout002.msg.chrl.nc.charter.net (impout002aa.msg.chrl.nc.charter.net [47.43.20.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00AD5137C28 for ; Mon, 20 May 2024 19:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.43.20.26 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231810; cv=none; b=UwAPTC0yHiMdVjqT9xR5XW/BXFBSCmYnLcxE75JisdIDBikJDtokrh7KnHiYIchqM9isSepEV2ulIWWaXsaBpJTai65SEAg4UJymy2sIw8DqljGlikvEV59mGhnbf6bqiwk+ptzh3JgRLKQ+s2r3rHLx38DQiegQyVChjeWmWiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716231810; c=relaxed/simple; bh=w5WYloa0T5Uw5sHSuCJ+xrzLizWpZ8ZlF42IPQAP+Mw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bnhO8jv5+9DDHNkNPp04x6V2tFzYln/XyD727yHxJomVbsbymGf4sDuhRfTBjEGh2E8GG3y/f4Fsc0hBbou9GofFFNtwYmut+85gDZ+Woiz94L401qtFmS0XtCAp30PLDPcRXKs46JQnJSWoN0mj5rToz6PYCS3Bewnf7gQ6cA8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=charter.net; spf=pass smtp.mailfrom=charter.net; dkim=pass (2048-bit key) header.d=charter.net header.i=@charter.net header.b=svkbdC+o; arc=none smtp.client-ip=47.43.20.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=charter.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=charter.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=charter.net header.i=@charter.net header.b="svkbdC+o" Received: from localhost.localdomain ([97.71.114.58]) by cmsmtp with ESMTPA id 98GYsTho2i0hy98GesQjS9; Mon, 20 May 2024 19:01:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=charter.net; s=c20240129; t=1716231712; bh=w5WYloa0T5Uw5sHSuCJ+xrzLizWpZ8ZlF42IPQAP+Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=svkbdC+o6f5lzAlaOaHZhUbY2CWRx6D94KFXvJ6/fy+xLir5zuw/5GbIyi+qiPzJ5 68mqq1JaEXBDTsIPtV3A5HH6ur2DyWnucuVLL6SAAVv4IHxnt01w34AmF053spPMyN DK8mjb7HZ2TLIMIwh6Miuvx65VRgxy+IwbZOGnAZqxz2KT8KBwg+LPIhA/cnR24qvE fZQFhy5DA41pSeM1il6DL5aRHFXj+gJBdrMkYDBZBpD2yLP+kUcPvx393Ly8+gX8Cl 46qmPYo5y4c9C+MtimUVdOR8ltCMQ4Rnex9yyFFHFH+yWESYDY8E6TNeYqkhAqJuB3 6FvJ+X7bI32wQ== Authentication-Results: charter.net; auth=pass (LOGIN) smtp.auth=ericsunshine@charter.net X-Authority-Analysis: v=2.4 cv=Wf8KaVhX c=1 sm=1 tr=0 ts=664b9e20 a=4h87Vkt5vDwEBqoyvSX4iA==:117 a=4h87Vkt5vDwEBqoyvSX4iA==:17 a=BCjA09oAAAAA:8 a=VwQbUJbxAAAA:8 a=7C5ArlEIky0_6m2BBFwA:9 a=jYKBPJSq9nmHKCndOPe9:22 a=AjGcO6oz07-iQ99wixmX:22 From: Eric Sunshine To: git@vger.kernel.org Cc: Junio C Hamano , John Paul Adrian Glaubitz , Eric Sunshine Subject: [PATCH 3/3] chainlint.pl: latch CPU count directly reported by /proc/cpuinfo Date: Mon, 20 May 2024 15:01:31 -0400 Message-ID: <20240520190131.94904-4-ericsunshine@charter.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240520190131.94904-1-ericsunshine@charter.net> References: <20240520111109.99882-1-glaubitz@physik.fu-berlin.de> <20240520190131.94904-1-ericsunshine@charter.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfB7QGDXEuRasyztpVK8MLyBevEnVIZTSKmZgSiUFVNlOxDg/bgblh71gFwbx61n+lFLCiQX5j+VeFnMLhDCPdm+InoGvdYwQKsxgLyDioA9K/Og/MESM qnuMWUWGh2o2e9FBl9nynopGWqDc6VPyraCWhBhzFZvTp/YkupdfTrIDFM75WZ7DJlua2lypYaWjwzV0Sfp7YyAfSU37A8wnaMg7vIKcDk4vmshLNM80bv31 9xTs8QjoaWXtXmgqiOa4OkondmFlbMgWBdmnoIpdFhuxU1/cT3wEgR8QcXFZ90fst/jdXwaBLTsjGp04+aGyog== From: Eric Sunshine On Linux, ncores() computes the number of CPUs by counting the "processor" or "CPU" lines emitted by /proc/cpuinfo. However, on some platforms, /proc/cpuinfo does not enumerate the CPUs at all, but instead merely mentions the total number of CPUs. In such cases, pluck the CPU count directly from the /proc/cpuinfo line which reports the number of active CPUs. (In particular, check for "cpus active: NN" and "ncpus active: NN" since both variants have been seen in the wild[1,2].) [1]: https://lore.kernel.org/git/503a99f3511559722a3eeef15d31027dfe617fa1.camel@physik.fu-berlin.de/ [2]: https://lore.kernel.org/git/7acbd5c6c68bd7ba020e2d1cc457a8954fd6edf4.camel@physik.fu-berlin.de/ Reported-by: John Paul Adrian Glaubitz Signed-off-by: Eric Sunshine --- t/chainlint.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/chainlint.pl b/t/chainlint.pl index d593cb95e7..1bbd985b78 100755 --- a/t/chainlint.pl +++ b/t/chainlint.pl @@ -724,6 +724,9 @@ sub ncores { if (open my $fh, '<', '/proc/cpuinfo') { my $cpuinfo = do { local $/; <$fh> }; close($fh); + if ($cpuinfo =~ /^n?cpus active\s*:\s*(\d+)/m) { + return $1 if $1 > 0; + } my @matches = ($cpuinfo =~ /^(processor|CPU)[\s\d]*:/mg); return @matches ? scalar(@matches) : 1; }