From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QP11EAKeA2IjyAAAgWs5BA (envelope-from ) for ; Wed, 09 Feb 2022 11:57:06 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SHgZDQKeA2I5JAAAauVa8A (envelope-from ) for ; Wed, 09 Feb 2022 11:57:06 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D5A59193D9 for ; Wed, 9 Feb 2022 11:57:05 +0100 (CET) Received: from localhost ([::1]:41940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHkem-00056l-St for larch@yhetil.org; Wed, 09 Feb 2022 05:57:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHkcq-00055J-0o for guix-patches@gnu.org; Wed, 09 Feb 2022 05:55:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHkcp-0003uz-Md for guix-patches@gnu.org; Wed, 09 Feb 2022 05:55:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHkco-0000a5-GF for guix-patches@gnu.org; Wed, 09 Feb 2022 05:55:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53895] [PATCH 0/5] More CPU detection Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 10:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53895 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 53895@debbugs.gnu.org Received: via spool by 53895-submit@debbugs.gnu.org id=B53895.16444040972213 (code B ref 53895); Wed, 09 Feb 2022 10:55:02 +0000 Received: (at 53895) by debbugs.gnu.org; 9 Feb 2022 10:54:57 +0000 Received: from localhost ([127.0.0.1]:50033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHkci-0000Zd-Py for submit@debbugs.gnu.org; Wed, 09 Feb 2022 05:54:57 -0500 Received: from flashner.co.il ([178.62.234.194]:50714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHkch-0000ZM-8z for 53895@debbugs.gnu.org; Wed, 09 Feb 2022 05:54:55 -0500 Received: from localhost (unknown [37.46.46.251]) by flashner.co.il (Postfix) with ESMTPSA id 3B5E540297; Wed, 9 Feb 2022 10:54:49 +0000 (UTC) Date: Wed, 9 Feb 2022 12:54:14 +0200 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 53895@debbugs.gnu.org References: <878ruk8gmu.fsf_-_@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+CqTemkAamJsqjA2" Content-Disposition: inline In-Reply-To: <878ruk8gmu.fsf_-_@gnu.org> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644404225; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=H9xqrJrOqyvIzLAQAxWECBdq0GwBnP0awVRz3nH25y8=; b=LTtW892ImgH/0J37ZOsy2YlIUGQeE18pqBa8vq0W+CLOna8mWQHQTFBgnoRB0fHvWfLIqu AqLZo0rGvELTxaKxTNRzAKkB+ZC8flWyN4MsC0ZOlWC23mCiPufj8sWEWLVPJ+7UUn/+qu u8o2RctCWNfl49LRoCrg0dejsDTUctJ+SQ+keoSJTu9Dk96Emj9TvgBbv9bn3kA9weXDtR /Xzu5sESFqimx0z0M/1ZXLTh0az7xCBAMuwa/7r6mffmx9nxhBvh24nL6hexUT+MeadnJv 53LxMmKyK3ye7kqeQ5mSe7voLymEV4CgsJtQfTaCbtQZu9LR7mwnYwmiCMG+fg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644404225; a=rsa-sha256; cv=none; b=Lr7xLyl+LpQDvrUPlYmwrg2ZoQttc2zAFbUcMJCpVZ3ADTWQczhiKiv24cgdYkxQHUGGW/ Srsm/HAi/ADSnE3XdEKJx+EUU2DLdFuUjf149wMNDnMkIod06aJkq6rGTOjgrWZpUuNAzo EAJkG6IHuYjSyVmrvC/iCDdWomAEBu8YPhBa5iDYKqnTroAioj9EZNVJeL/Ep3usaAuYfT fuw0QJSemDnEtWTBvuRISqrHA2OnVBo6P7pWGQDsBHJ3emz7cjd5dg8hmHLuDfZSfg5f9I no3wCrc0yASRgq65wRpW8cBuBzErtJqBbVJlPK+9hsGl3zic3QhzFbZnQ1a7qA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.73 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D5A59193D9 X-Spam-Score: -4.73 X-Migadu-Scanner: scn1.migadu.com X-TUID: +i055kswHTBd --+CqTemkAamJsqjA2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 09, 2022 at 11:43:21AM +0100, Ludovic Court=C3=A8s wrote: > Efraim Flashner skribis: >=20 > > * guix/cpu.scm : Add vendor field. > > (current-cpu): Also fill in the 'vendor' field. > > (cpu->gcc-architecture): Add detection logic for AMD CPUs. >=20 > [...] >=20 > > + (and (equal? "AuthenticAMD" (cpu-vendor cpu)) >=20 > Isn=E2=80=99t that equivalent to (=3D (cpu-family cpu) some-value)? It looks to me like 'family' started as the prefix for iX86, so Intel is mostly using family 6, except when a couple of other processors slip in. I wasn't able to find a hard and fast rule for what family AMD typically uses, on my machine its 23. In driver-i386.c it's sort by vendor first: if (vendor =3D=3D VENDOR_AMD) > > + (letrec-syntax ((if-flags (syntax-rules (=3D>) > > + ((_) > > + #f) > > + ((_ (flags ... =3D> name) re= st ...) > > + (if (every (lambda (flag) > > + (set-contains?= (cpu-flags cpu) > > + = flag)) > > + '(flags ...)) > > + name > > + (if-flags rest ...)))))) > > + > > + (when (=3D 22 (cpu-family cpu)) > > + (if-flags ("movbe" =3D> "btver2"))) > > + (when (=3D 6 (cpu-family cpu)) > > + (if-flags ("3dnowp" =3D> "athalon"))) >=20 > This has no effect (because =E2=80=98if-flags=E2=80=99 returns a value th= at is ignored > since it=E2=80=99s not returned.) >=20 > What we could do is extend =E2=80=98if-flags=E2=80=99 so that it can opti= onally check > for a family number: >=20 > (if-flags ((family 22) "movbe" =3D> "btver2") > =E2=80=A6) That sounds like a good idea. > > + (if-flags ("vaes" =3D> "znver3") > > + ("clwb" =3D> "znver2") > > + ("clzero" =3D> "znver1") >=20 > However, the code in driver-i386.c seems to look at model IDs (the big > =E2=80=9Cswitch (processor)=E2=80=9D thing) and not feature flags. Or am= I overlooking > something? switch (processor) comes after all the AMD chips are sorted. It looks like all of Intel's i686 and x86_64 are PROCESSOR_PENTIUMPRO, while AMD has a separate processor per chip design. The AMD chips are sorted about 90 lines above the switch (processor) line > Thanks, > Ludo=E2=80=99. --=20 Efraim Flashner =D7=A8=D7=A0=D7=A9=D7=9C=D7=A4 = =D7=9D=D7=99=D7=A8=D7=A4=D7=90 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --+CqTemkAamJsqjA2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmIDnVUACgkQQarn3Mo9 g1EPkA//aRvEtiH93UgXHPFRgDQr/C4ayT3BntiIY+jQrXVZ9IsU/5HVqvA9fgug zgQNS1I/qyc4or46txbqZNGX+53RdxfgxopxxWbPzSe3P/89Cmq4uDPQMQelB3wP Q8Fl5Zl5JgBcFwQ6VhhTwZJOSmtmZuaU/v6uFckv2yTfmn2wB1DVFghwMWlEjh14 bz7n5IUPmqS+dGUSUSKZCIS3Lj83lcDySkyYB6BCFvsZ8JHI0FKE478nxbZuoCSm X9Ah3wUfDLzNqDoyg7AA+a44pvnd0kX4m2cDoVnT1L+VLLtY6lhF2c88uDs/66ML TmMeKQ4ZmmBYyB/3d7UfGR/DsFwL3Li6znRxpVF2kM1o0pseaRBvFpXZo8Eh1bzm IUOyN4vUdJ7wqocZMJLkZ8xfReuMlVsf8EZog7Lk/wDYk1HXWuG26va0fFHU5eep AbQC3I3MiHhMHgB9dhuhjggLagTeh4P3r/E6HMlbg2PBmaFYfhB8ZIp2NjRlk2dT s7KTc2GbP9GUo1/ORSUQ2h8lm3gK/vdk4yqk3UVnORkuv33KvKboHKQV+KJUDQcU jEcRqcBs8xg8OS+uvVDxRRmKy+tfbIeLxoRzpYLTv/q2Au/uTrgMlnV9b5WdACLn MRqEtPDUEsSxQ0mCoBSIWocf6s6g2L4v1QROYVR08PcJ+dmmqgw= =skvq -----END PGP SIGNATURE----- --+CqTemkAamJsqjA2--