From unknown Thu Aug 14 18:33:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#55431 <55431@debbugs.gnu.org> To: bug#55431 <55431@debbugs.gnu.org> Subject: Status: [PATCH] guix: cpu: recognize other architectures. Reply-To: bug#55431 <55431@debbugs.gnu.org> Date: Fri, 15 Aug 2025 01:33:29 +0000 retitle 55431 [PATCH] guix: cpu: recognize other architectures. reassign 55431 guix-patches submitter 55431 Julien Lepiller severity 55431 normal tag 55431 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun May 15 13:12:12 2022 Received: (at submit) by debbugs.gnu.org; 15 May 2022 17:12:12 +0000 Received: from localhost ([127.0.0.1]:50567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqHmt-0004RH-Q3 for submit@debbugs.gnu.org; Sun, 15 May 2022 13:12:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:40518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqHms-0004R9-Bp for submit@debbugs.gnu.org; Sun, 15 May 2022 13:12:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqHmr-0006go-TB for guix-patches@gnu.org; Sun, 15 May 2022 13:12:10 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:54284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqHmp-0000it-OI for guix-patches@gnu.org; Sun, 15 May 2022 13:12:09 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id d1c6996c for ; Sun, 15 May 2022 17:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=N6a yDETuXb2TovcWRXIBcBy+AvJtyKGKkV+Tp9Vtxas=; b=TEkOqfBuJJpAP9d0jQK j3XVdBAs89pi5jSRrqXHP/5hVUfDJ/KQQwabJldcfStkLSh2nvRbcGOhtYeOpwdV KclxK0m0VrTOuU4gewfqzvL1JfJTlkfNrqYKPAxaKboCEzbEICkqln+v6Dki9HqZ SCwjyrJ3yIOXnLkO3ZpWr4QZR2wdUSUflGjWKjXmGSYUFcm50yIkW3NQGeG1SP4u S/lGSNYewYqXlmZYFc5BHdJR0+7B0xcLFY4jrhzaOmRZ0a97bKcZaVxNicxVPZYe +oqeIodEP0zZzf7GAQdNxWfQbjUhO1aWK+QDfva4VTfo+r/fjP4wrgKor6evFDlj RwQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 5220eecf (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Sun, 15 May 2022 17:12:00 +0000 (UTC) Date: Sun, 15 May 2022 19:11:32 +0200 From: Julien Lepiller To: guix-patches@gnu.org Subject: [PATCH] guix: cpu: recognize other architectures. Message-ID: <20220515191132.288dc60d@sybil.lepiller.eu> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/WonMzy3MVQNcq_eVCc/p6JH" Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --MP_/WonMzy3MVQNcq_eVCc/p6JH Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Guix! The attached patch lets (guix cpu) recognize other architectures. The code of (current-cpu) is based on the content of /proc/cpuinfo which can be pretty different on non-intel architectures. For instance, here's a sample from an armhf machine: processor : 0 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 45.47 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 4 In particular, there's no flags entry, so (current-cpu) doesn't stop until eof, and returns #f. It's an issue because a test uses this code, for testing manifests with --tune. If no cpu is returned, the test crashes: In guix/transformations.scm: 864:25 1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain") (<80>) <80>)) In guix/cpu.scm: 94:2 0 (cpu->gcc-architecture #f) Since the test fails, the "guix" package doesn't build, and I can't reconfigure on armhf or aarch64. (well armhf has other issues right now...) The attached patch changes the logic of the code to read all lines, find information about the CPU even if it's an ARM CPU, and returns always something (to prevent the crash) when it reads eof. This means that it will return architecture information about the last CPU, instead of the first. I don't think that's an issue because this code is used for --tune which really only works on intel where you don't have multiple CPUs with too different features. WDYT? --MP_/WonMzy3MVQNcq_eVCc/p6JH Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-cpu-Recognize-other-architectures.patch >From 32ebfc93f838eba74c1f1188f7d23363f32ee94b Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sun, 15 May 2022 19:01:37 +0200 Subject: [PATCH] guix: cpu: Recognize other architectures. * guix/cpu.scm (current-cpu): Recognize aarch64. --- guix/cpu.scm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index a44cd082f1..7e25fcb9cf 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -62,31 +62,48 @@ (define (prefix? prefix) (lambda (port) (let loop ((vendor #f) (family #f) - (model #f)) + (model #f) + (flags '())) (match (read-line port) ((? eof-object?) - #f) + (cpu (utsname:machine (uname)) + vendor family model (list->set flags))) ((? (prefix? "vendor_id") str) (match (string-tokenize str) (("vendor_id" ":" vendor) - (loop vendor family model)))) + (loop vendor family model flags)))) + ((? (prefix? "CPU implementer") str) + (match (string-tokenize str) + (("CPU" "implementer" ":" vendor) + (loop vendor family model flags)))) ((? (prefix? "cpu family") str) (match (string-tokenize str) (("cpu" "family" ":" family) - (loop vendor (string->number family) model)))) + (loop vendor (string->number family) model flags)))) + ((? (prefix? "CPU architecture") str) + (match (string-tokenize str) + (("CPU" "architecture:" family) + (loop vendor family model flags)))) ((? (prefix? "model") str) (match (string-tokenize str) (("model" ":" model) - (loop vendor family (string->number model))) + (loop vendor family (string->number model) flags)) (_ - (loop vendor family model)))) + (loop vendor family model flags)))) + ((? (prefix? "CPU part") str) + (match (string-tokenize str) + (("CPU" "part" ":" model) + (loop vendor family (string->number (substring model 2) 16) flags)))) ((? (prefix? "flags") str) (match (string-tokenize str) (("flags" ":" flags ...) - (cpu (utsname:machine (uname)) - vendor family model (list->set flags))))) + (loop vendor family model flags)))) + ((? (prefix? "Features") str) + (match (string-tokenize str) + (("Features" ":" flags ...) + (loop vendor family model flags)))) (_ - (loop vendor family model)))))))) + (loop vendor family model flags)))))))) (define (cpu->gcc-architecture cpu) "Return the architecture name, suitable for GCC's '-march' flag, that -- 2.35.1 --MP_/WonMzy3MVQNcq_eVCc/p6JH-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 17 09:00:14 2022 Received: (at 55431-done) by debbugs.gnu.org; 17 May 2022 13:00:14 +0000 Received: from localhost ([127.0.0.1]:56045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqwo9-0001Zo-TV for submit@debbugs.gnu.org; Tue, 17 May 2022 09:00:14 -0400 Received: from flashner.co.il ([178.62.234.194]:50352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqwo7-0001YW-Tq for 55431-done@debbugs.gnu.org; Tue, 17 May 2022 09:00:12 -0400 Received: from localhost (unknown [31.210.180.235]) by flashner.co.il (Postfix) with ESMTPSA id C457B4021C; Tue, 17 May 2022 13:00:05 +0000 (UTC) Date: Tue, 17 May 2022 15:59:15 +0300 From: Efraim Flashner To: Julien Lepiller Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures. Message-ID: Mail-Followup-To: Efraim Flashner , Julien Lepiller , 55431-done@debbugs.gnu.org References: <20220515191132.288dc60d@sybil.lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CI51xbL9ICskQWbR" Content-Disposition: inline In-Reply-To: <20220515191132.288dc60d@sybil.lepiller.eu> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sun, May 15, 2022 at 07:11:32PM +0200, Julien Lepiller wrote: > Hi Guix! > > The attached patch lets (guix cpu) recognize other architectures. The > code of (current-cpu) is based on the content of [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [31.210.180.235 listed in dnsbl.sorbs.net] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 55431-done Cc: 55431-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --CI51xbL9ICskQWbR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 15, 2022 at 07:11:32PM +0200, Julien Lepiller wrote: > Hi Guix! >=20 > The attached patch lets (guix cpu) recognize other architectures. The > code of (current-cpu) is based on the content of /proc/cpuinfo which > can be pretty different on non-intel architectures. For instance, > here's a sample from an armhf machine: >=20 > processor : 0 > model name : ARMv7 Processor rev 4 (v7l) > BogoMIPS : 45.47 > Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls > vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 > CPU architecture: 7 > CPU variant : 0x0 > CPU part : 0xc07 > CPU revision : 4 >=20 > In particular, there's no flags entry, so (current-cpu) doesn't stop > until eof, and returns #f. >=20 > It's an issue because a test uses this code, for testing manifests with > --tune. If no cpu is returned, the test crashes: >=20 > In guix/transformations.scm: > 864:25 1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain") > (<80>) <80>)) In guix/cpu.scm: > 94:2 0 (cpu->gcc-architecture #f) >=20 > Since the test fails, the "guix" package doesn't build, and I can't > reconfigure on armhf or aarch64. (well armhf has other issues right > now...) >=20 > The attached patch changes the logic of the code to read all lines, > find information about the CPU even if it's an ARM CPU, and returns > always something (to prevent the crash) when it reads eof. This means > that it will return architecture information about the last CPU, > instead of the first. I don't think that's an issue because this code > is used for --tune which really only works on intel where you don't > have multiple CPUs with too different features. >=20 > WDYT? I just pushed mine without seeing yours, sorry. I did check the gcc source code and I found the options for determining the cpu flags for arm* processors in gcc/config/arm/arm-cpus.in. Do you think it'd be worth it to add detection for armv7 CPUs? Also, I'm pretty sure we can overlap armhf and aarch64 together, and i686 and x86_64 together, and then running 32-bit code on 64-bit processors will get a nice boost since it'll be tuned for the actual hardware. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --CI51xbL9ICskQWbR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmKDnCAACgkQQarn3Mo9 g1F9nxAAiLl1p68ATITa1A88daLSr9cSqOQAkg/25f3Xgr43M60PE867KThMYD2i r9kHt5v9CTKN2AfjQkevz9svhbavcOfyiRKOKWBfVhglCPUdYyp2KZ9aAHyOCDGJ lb6rvbg9NYAzgHj4nm04uAVUEpApdLY4mgKZOWDvU+D5HbamOmnfgH+CPRlptkCm ItYKc0nl4XxzagxLWC25+tJzeXW/obw/ckCLkUXXzRBUxUP8TT8QgIHxzb3PxUWX G/cKRQKQqfrI732C3ZzEMTfkLGsOwG7itpxdnT1Zsi2wIOjQGHi9Zdou6HBCStry x6eNDUfewHxVw+TJcb6WWoP98GRKnR01LNchchOwo7RI1ODDHBM5ygnDrnLJo//U MZWBYv8I1SfP3lX/vXKc7EMLMT2OyQNSriDpj7JyolKonoUfKx/vgHepMz38hRhe AyHrPjqbotmB6eS1N4BMHmi8hm0rj592ujVjlW+hiniFPYd5dAO5j4QdkwNmgHYf p5Nc/edQkhDq3EqA2n7rBZa1WlSJ6/iwHy9f7MvK5aYS1xAaBVDnXPDDQWiq5OeZ 264//63N6JrymdAgl93LKJAUEXAeos0ue+7+aPc5nmcK/Jrvj5q/iUcdqg8sqkru DI9oY/SNCIJQ+DpCiRjPAAAEhbfU+lxWU1/wfwr3JhF3YfgoDNE= =2HEI -----END PGP SIGNATURE----- --CI51xbL9ICskQWbR-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 17 11:56:03 2022 Received: (at 55431-done) by debbugs.gnu.org; 17 May 2022 15:56:03 +0000 Received: from localhost ([127.0.0.1]:57688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqzY6-0000aj-3Z for submit@debbugs.gnu.org; Tue, 17 May 2022 11:56:03 -0400 Received: from lepiller.eu ([89.234.186.109]:37050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqzY3-0000aZ-Mt for 55431-done@debbugs.gnu.org; Tue, 17 May 2022 11:55:48 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id ea710267; Tue, 17 May 2022 15:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:in-reply-to:references:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=eZFn8lxvspSK t5Nrj3OUT8Vsbr7S9N+whS08fhhJm50=; b=OCbiAnXVuRoEXC3nivdgOzdGC9a5 7ksJ+g628gpqI8Cg1Ycj4Gt/hUIF/KtA+8DpLVxUFr14v0XL4gExK1I/nZaJzUkI TY2uuL2fzum5cHyAC4JXAdvI77onWYB0nkIopLAauNpIiG2ds4tdO/AwxlwHSETE Oik5yKZLSpsf8XGXKddV/x79xIhVlnO/0igpLzga0bZZdAF6yUSGaVpQmJkRaKEB 9eLeXdwjYiAAsrMYRRgKvInP7qL3ZXX3Ho5craSBscJ9uexqRQ6qVljdic+YbvSm 1+l+pionrCK99sV1HdODgQg5/2UzUYWdVxdfWH0vzy9hqCnoTf7E/TOVkw== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 1a538473 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 17 May 2022 15:55:45 +0000 (UTC) Date: Tue, 17 May 2022 17:55:38 +0200 From: Julien Lepiller To: Efraim Flashner Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures. User-Agent: K-9 Mail for Android In-Reply-To: References: <20220515191132.288dc60d@sybil.lepiller.eu> Message-ID: <005DC196-6142-48CF-A82E-D532D6500597@lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----YK71XQTPERAX8FIQLLMXY7PPONPWD4 Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55431-done Cc: 55431-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) ------YK71XQTPERAX8FIQLLMXY7PPONPWD4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks for fixing that anyway :) I was only interested in it because it made me unable to reconfigure my sy= stems=2E I don't care too much about the --tune code, and I don't understan= d what you suggest=2E Do you mean to create "x86 on x86_64" as a separate a= rchitecture? Or as a --tune target? On May 17, 2022 2:59:15 PM GMT+02:00, Efraim Flashner wrote: >On Sun, May 15, 2022 at 07:11:32PM +0200, Julien Lepiller wrote: >> Hi Guix! >>=20 >> The attached patch lets (guix cpu) recognize other architectures=2E The >> code of (current-cpu) is based on the content of /proc/cpuinfo which >> can be pretty different on non-intel architectures=2E For instance, >> here's a sample from an armhf machine: >>=20 >> processor : 0 >> model name : ARMv7 Processor rev 4 (v7l) >> BogoMIPS : 45=2E47 >> Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls >> vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 >> CPU architecture: 7 >> CPU variant : 0x0 >> CPU part : 0xc07 >> CPU revision : 4 >>=20 >> In particular, there's no flags entry, so (current-cpu) doesn't stop >> until eof, and returns #f=2E >>=20 >> It's an issue because a test uses this code, for testing manifests with >> --tune=2E If no cpu is returned, the test crashes: >>=20 >> In guix/transformations=2Escm: >> 864:25 1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain") >> (<80>) <80>)) In guix/cpu=2Escm: >> 94:2 0 (cpu->gcc-architecture #f) >>=20 >> Since the test fails, the "guix" package doesn't build, and I can't >> reconfigure on armhf or aarch64=2E (well armhf has other issues right >> now=2E=2E=2E) >>=20 >> The attached patch changes the logic of the code to read all lines, >> find information about the CPU even if it's an ARM CPU, and returns >> always something (to prevent the crash) when it reads eof=2E This means >> that it will return architecture information about the last CPU, >> instead of the first=2E I don't think that's an issue because this code >> is used for --tune which really only works on intel where you don't >> have multiple CPUs with too different features=2E >>=20 >> WDYT? > >I just pushed mine without seeing yours, sorry=2E > >I did check the gcc source code and I found the options for determining >the cpu flags for arm* processors in gcc/config/arm/arm-cpus=2Ein=2E Do y= ou >think it'd be worth it to add detection for armv7 CPUs? > >Also, I'm pretty sure we can overlap armhf and aarch64 together, and >i686 and x86_64 together, and then running 32-bit code on 64-bit >processors will get a nice boost since it'll be tuned for the actual >hardware=2E > >--=20 >Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99= =D7=9D =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 >GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 >Confidentiality cannot be guaranteed on emails sent or received unencrypt= ed ------YK71XQTPERAX8FIQLLMXY7PPONPWD4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks for fixing that anyway :)

I was only= interested in it because it made me unable to reconfigure my systems=2E I = don't care too much about the --tune code, and I don't understand what you = suggest=2E Do you mean to create "x86 on x86_64" as a separate architecture= ? Or as a --tune target?

On May 17, 2022 = 2:59:15 PM GMT+02:00, Efraim Flashner <efraim@flashner=2Eco=2Eil> wro= te:
On Sun, May 15, 2022 at 07:11:32PM +020=
0, Julien Lepiller wrote:
Hi Guix!

The attached patch lets (guix cpu) recognize other archi= tectures=2E The
code of (current-cpu) is based on the content of /proc/c= puinfo which
can be pretty different on non-intel architectures=2E For i= nstance,
here's a sample from an armhf machine:

processor : 0
= model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 45=2E47
Features = : half thumb fastmult vfp edsp thumbee neon vfpv3 tls
vfpv4 idiva idivt = vfpd32 lpae evtstrm CPU implementer : 0x41
CPU architecture: 7
CPU va= riant : 0x0
CPU part : 0xc07
CPU revision : 4

In particular, t= here's no flags entry, so (current-cpu) doesn't stop
until eof, and retu= rns #f=2E

It's an issue because a test uses this code, for testing m= anifests with
--tune=2E If no cpu is returned, the test crashes:

= In guix/transformations=2Escm:
864:25 1 (_ _ _ _ ((package ad-hoc-pa= ckage "gcc-toolchain")
(<E2><80><A6>) <E2><80= ><A6>)) In guix/cpu=2Escm:
94:2 0 (cpu->gcc-architectu= re #f)

Since the test fails, the "guix" package doesn't build, and I= can't
reconfigure on armhf or aarch64=2E (well armhf has other issues r= ight
now=2E=2E=2E)

The attached patch changes the logic of the co= de to read all lines,
find information about the CPU even if it's an ARM= CPU, and returns
always something (to prevent the crash) when it reads = eof=2E This means
that it will return architecture information about the= last CPU,
instead of the first=2E I don't think that's an issue because= this code
is used for --tune which really only works on intel where you= don't
have multiple CPUs with too different features=2E

WDYT?

I just pushed mine without seeing yours, sorry=2E

= I did check the gcc source code and I found the options for determining
= the cpu flags for arm* processors in gcc/config/arm/arm-cpus=2Ein=2E Do you=
think it'd be worth it to add detection for armv7 CPUs?

Also, I'= m pretty sure we can overlap armhf and aarch64 together, and
i686 and x8= 6_64 together, and then running 32-bit code on 64-bit
processors will ge= t a nice boost since it'll be tuned for the actual
hardware=2E

--
Efraim Flashner <efraim@flashner= =2Eco=2Eil> =D7=90=D7=A4=D7=A8=D7=99=D7=9D =D7=A4=D7=9C=D7=A9=D7=A0=D7= =A8
GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Co= nfidentiality cannot be guaranteed on emails sent or received unencrypted
------YK71XQTPERAX8FIQLLMXY7PPONPWD4-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 18 08:06:40 2022 Received: (at 55431-done) by debbugs.gnu.org; 18 May 2022 12:06:41 +0000 Received: from localhost ([127.0.0.1]:59244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrIRs-00082O-N4 for submit@debbugs.gnu.org; Wed, 18 May 2022 08:06:40 -0400 Received: from flashner.co.il ([178.62.234.194]:51914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrIRr-00082A-GD for 55431-done@debbugs.gnu.org; Wed, 18 May 2022 08:06:40 -0400 Received: from localhost (unknown [31.210.180.235]) by flashner.co.il (Postfix) with ESMTPSA id 40E874035A; Wed, 18 May 2022 12:06:33 +0000 (UTC) Date: Wed, 18 May 2022 15:05:38 +0300 From: Efraim Flashner To: Julien Lepiller Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures. Message-ID: Mail-Followup-To: Efraim Flashner , Julien Lepiller , 55431-done@debbugs.gnu.org References: <20220515191132.288dc60d@sybil.lepiller.eu> <005DC196-6142-48CF-A82E-D532D6500597@lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iKSlTBexaF5UQQs7" Content-Disposition: inline In-Reply-To: <005DC196-6142-48CF-A82E-D532D6500597@lepiller.eu> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Tue, May 17, 2022 at 05:55:38PM +0200, Julien Lepiller wrote: > Thanks for fixing that anyway :) > > I was only interested in it because it made me unable to reconfigure my systems. I don't care to [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [31.210.180.235 listed in dnsbl.sorbs.net] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 55431-done Cc: 55431-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --iKSlTBexaF5UQQs7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 17, 2022 at 05:55:38PM +0200, Julien Lepiller wrote: > Thanks for fixing that anyway :) >=20 > I was only interested in it because it made me unable to reconfigure my s= ystems. I don't care too much about the --tune code, and I don't understand= what you suggest. Do you mean to create "x86 on x86_64" as a separate arch= itecture? Or as a --tune target? >=20 As part of the autotuning process. GCC internally groups i686 and x86_64 together when determining how to tune for --march=3Dnative, and I'm pretty sure I've added some i686 hardware for AMD when I was adding autotuning support for AMD CPUs. Its similar for aarch64 and armhf, there are armhf targets internally that accept armv8.X-a targets, so there's no need to limit armhf tuning to armv7. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --iKSlTBexaF5UQQs7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmKE4Q8ACgkQQarn3Mo9 g1GwGhAAn+e0qxapvSIPS+59MiRv5f/waAz+YXrYi1iHtn1rrj8uVBCh1/BuX8TS bOSCVSyVT46RGb7ZsOuuNWIif5V0D0/MHB1+jMrN1H1Klvt0R8KRFVRIPwf6DFnE fvKZjBeFrQW5gZROVlgj7l42/DTG6h15IAjmTSOisRJ5Eesom/IjYcPWWxCfxOo/ BuRdwgcajsqwh/meljwMYtfurdYxgXTw9yyqA7B4632QGY8vKjRbWlJVZ+W3V6Ky mn3Jg7CSHwY6Y+bR3PlujrawXX+qRt8GMJyxRqUkgmffVXcRDChpkRmN9zZh5tLx UvQwm6AszY+gj4s9yHOvY/bRKEzyxigas3MWyWyZqPqFJfQmhb++MIOCiuPwo2F1 nbUDNF18Lbq+GlK48TcCBjlpkf9gdOVbjVHSHKqiOaRXomZniFL8FYQlzy6DnJ46 UGpjOQV/xI4dw0NJNWxOHiAiysl0xXmLEIZ30HkzKSU8md0QLM/55MsCiD30kOa/ C/3peZEGwUr8FBsFUYNEhyg0dbKC+1iNm8xKQ2Nn7Uhr/PgIc2D9oeemwJ+dUwQL Bw2FNwbyjOvVO9sp0Xyr78fMgCIeJyHMImw3lDnOW6iN/mipEV6tpZQPBq40fMiv s5ATCUmanm6mHHxoUaCFDNfkmTREdfZVgJx63zJnLjrcmTkX31M= =CIYm -----END PGP SIGNATURE----- --iKSlTBexaF5UQQs7-- From unknown Thu Aug 14 18:33:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 16 Jun 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator