From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mHbvFUT5V2fIHAEA62LTzQ:P1 (envelope-from ) for ; Tue, 10 Dec 2024 08:18:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id mHbvFUT5V2fIHAEA62LTzQ (envelope-from ) for ; Tue, 10 Dec 2024 09:18:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="gRph5/pG"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=mykdL7kj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733818692; a=rsa-sha256; cv=none; b=plO68C7iFR6Xb9q4ojWNz3ghFfxC2yiJRpZRqsbj5M+JiuwULzShl6p8cfGToAhuZmsx3x 3JIbexol8C2HS7F8+aFMWyr2xnpgTnPeiHVnSxSydWAVR4UqieAeHyM9pkSUkdxXXfixnE To3/d+K4qPdqaCLcYqNwYIr6hrXBK2V7wipEyPN+zYLoeo1PFHEKHGiYjiNLvtLGSspPyu a+X171hp8g9OHNcyFu2rFbCsQCOw66fxU4PIUtlbY6ekMepNSWpxMeFEneyHmpfSx7Z0t0 QatMMXUwtJ+FKBIJ/ngjLlZvw18usOLgtWanoOrCnCqfhC1kVX97rjqnylkSww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="gRph5/pG"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=mykdL7kj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733818692; 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: dkim-signature; bh=lr7clyJZFsfJa1u8BVfdkQA90KalzKcMmjl2QSeJ5dM=; b=avBrqbNO/Df9n6MEPrzpwdWeOaUOJcyc3e11lHN4Aq9AmTsXr5nB7up3JYxMa6/8CxfxZ+ +5jJi4zV8Wthc8wg0YdhiauqY392S941XyrLa7U1ldwrex173RxlCnQmbcml0cc/Qejgea ZVx6iIcko8UldSRnSlKuTac8P+Nj35vAyz5c+ywV7OO9GBDKV8FBIkoLO+5NKJEP8IRAwO dvAgvEWybbGQ0TkqiJ9mLTiiHEsmvaEwdpklcVUQYop/57cNC7+8/0z8ieCq923t9m8uf5 157/cfB0KXVdA60c1CsbWGedBvJ1tQAVgAYEvtjlP4UnoC0iUfxP0z+Nvk20jw== 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 928AA57A8B for ; Tue, 10 Dec 2024 09:18:11 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKvRV-00075u-Vf; Tue, 10 Dec 2024 03:18:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKvRT-00075C-8t for bug-guix@gnu.org; Tue, 10 Dec 2024 03:18:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKvRT-0000Z5-16 for bug-guix@gnu.org; Tue, 10 Dec 2024 03:18:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:MIME-Version:References:From:Date:To:Subject; bh=lr7clyJZFsfJa1u8BVfdkQA90KalzKcMmjl2QSeJ5dM=; b=gRph5/pGVuWt2yqhMczKwEoENoEwXrHOB7Wb2OC1w5QMi5rZ99NTn5yPYnlknHPfi2CI2ucGLJvFZPuWyHv6mSF58dza/PgVIVGeUCVlJ9d9G9tIz+ZWYYDJgKY2N1seD41q1uW1ykBZFRzAX7YCsIWmYGBSBRI0c0WJjd5Q7cvVniOHG4xGLTpBoM2I2umxvlhxs61onlmIIIc/f/OJg3UFFuizcyxZw9CO0Gk70vBmCmurdKW74qFH4j7rqRH+KsE7PK6WeNbcGwPII7h1Vsd/f9PIdJ2MZgfcJ1pgJpecUzM5sEOINqUr9RQ0A83RCBDIn9LSrBsVuCUWqReVZA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKvRS-00029O-7v for bug-guix@gnu.org; Tue, 10 Dec 2024 03:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#74731: guix/cpu should parse /sys/devices/system/cpu/modalias Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 10 Dec 2024 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74731 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 74731@debbugs.gnu.org Received: via spool by 74731-submit@debbugs.gnu.org id=B74731.17338186788240 (code B ref 74731); Tue, 10 Dec 2024 08:18:02 +0000 Received: (at 74731) by debbugs.gnu.org; 10 Dec 2024 08:17:58 +0000 Received: from localhost ([127.0.0.1]:56857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKvRI-00028f-4z for submit@debbugs.gnu.org; Tue, 10 Dec 2024 03:17:58 -0500 Received: from mail-wm1-f42.google.com ([209.85.128.42]:55469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKvRF-00028V-Fk for 74731@debbugs.gnu.org; Tue, 10 Dec 2024 03:17:50 -0500 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-432d86a3085so34531645e9.2 for <74731@debbugs.gnu.org>; Tue, 10 Dec 2024 00:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733818607; x=1734423407; darn=debbugs.gnu.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=lr7clyJZFsfJa1u8BVfdkQA90KalzKcMmjl2QSeJ5dM=; b=mykdL7kjVt+iNaJJRK4KqD0nw+052QVMBxRRSIvpK/OxdiG1Qzxty8EAMfvYuIpMrU AjfSBlEIP6dbPjOTKBKuv1YKHum9PFRszcO+Q+gm+0GHoYDoZfEBMjN/CfD1NPR9Q6iF Wevur0G3w81FExl+yjNkEpNpMUbj0MqS/JUEHEUopMnIOfYZnVI1RW48bW/MpdBC9ZH3 +wOASfkfz4q7TkmsjYA2UjtnEy7rbJZQNWfRsIHtuXO7iFLjpdcrmF0tEGn4ACnVo61+ FU9Id74qcnIWLKHY2pdzDB4HBQsNocY+TgVEhLdROtCMigHN19v03EWj82kxFFrasj50 tS/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733818607; x=1734423407; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lr7clyJZFsfJa1u8BVfdkQA90KalzKcMmjl2QSeJ5dM=; b=dctZ+AoHE856PBjEPEzGoGq3OjYeHAxr4UJQmFrae2oJav8JWwbqBDsI5wpacWzQfz mcIY8hUTK4ag9C+eb3yYm4h64cZgtrU38MiEjtqVTZtfTCkgMCy0d24ac5a/FkJqQ7cg emgQHoMJVDdnJDF8CkRemPzCGUkCdkSnBOQYo1ZZwy3SUsaHuPUt80KWNuIEBrAegMrx B+mgBy6iqr1cvgqgqy5Ih9mLqn5WSQRzwjAUZh0GNt2cqRKqHAJ7oS+9xN9g4eB+GLlP I3OTpokNECCamuKGth8fvK52Wxfz02x7htAjHQ8HhFjcJVJL6mOaqR8q+Q3V6x2sFcMU f2xQ== X-Gm-Message-State: AOJu0YylOfiQQX3o5HBXsbvvK/d3dVMxck1buPnOAIqCbTSjD65D+Xb4 BcA8z/Z9SsepGq1Z/7XFqoaWs7h6qsl/gyiArYBaZwDpkvyh0A0I X-Gm-Gg: ASbGncvTbm6JwTvjW6e5+64oFDrSjeghqMPvGz0clryldr2Qa2Mw09BOAcbOicPGLyz 3cJyLbZpGZ1hBnUVu6S4jb4A/Hy39nreVuDYvE5jAWEI+24mBZ7WFF+ZVDQ7Ej00QvQK4SSYXZ+ 6gRReJUZp/mXSTUPm6c6WngnmrXxGx//nxipkYVeGNTwrvw1YJaAp2Dxx8p7EKk1rN8dA6F5dc3 ftIYJg5UrcfPNvn/Yu42XLbbXqDR5dM/FUvuOc9Czq6HBN/Fxsipw== X-Google-Smtp-Source: AGHT+IEjLCEU8I86xmiuSlxvxtNOP54NldE3G7im/D0K6xpJ76y3UJ9k515dZOp1u+H346ZFyzx7+Q== X-Received: by 2002:a05:600c:83c3:b0:434:f230:f4f0 with SMTP id 5b1f17b1804b1-434fff3704fmr24040985e9.1.1733818607066; Tue, 10 Dec 2024 00:16:47 -0800 (PST) Received: from localhost ([31.210.180.118]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-435a3d54930sm5443635e9.0.2024.12.10.00.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 00:16:46 -0800 (PST) Date: Tue, 10 Dec 2024 10:16:44 +0200 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 74731@debbugs.gnu.org References: <87jzc8lpv1.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="w/OVG1VbdlyG0qaf" Content-Disposition: inline In-Reply-To: <87jzc8lpv1.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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 928AA57A8B X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -8.18 X-Spam-Score: -8.18 X-TUID: e0HJwSenA7ED --w/OVG1VbdlyG0qaf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 09, 2024 at 06:37:22PM +0100, Ludovic Court=C3=A8s wrote: > Hello, >=20 > Efraim Flashner skribis: >=20 > > I saw a post by Marcan=C2=B9 of Asahi Linux the other day about not par= sing > > /proc/cpuinfo and remembered that's what we're doing in (guix cpu). >=20 > I believe it initially mimicked what GCC does for =E2=80=98-march=3Dnativ= e=E2=80=99, but > it does seem to be less exhaustive than /sys/devices/cpu/modalias. >=20 > I wonder if there are version/portability issues with the latter. I've been thinking more about it over the past few days. I think ultimately we need to match both parts; the kernel interfaces with the hardware and knows (or at least should know) exactly what the hardware can support, and gcc (or the other compilers) need to support optimizing for those hardware bits specifically. Also, parsing /proc/cpuinfo is already reading what the kernel says it supports, except in an incomplete manner. Starting with x86_64 (and i686), I think we keep GCC's definition of what each sub-architecture is but parse the modalias file instead of parsing cpuinfo. I already have some code to parse modalias and some ideas for just reusing the math bits from the kernel (it looks like ((11*32)+28) for zen2) to adjust the if-flags to match the numerical equivalent of the feature. For x86_64 the kernel does have a policy of reusing flags if they've been deprecated and unused long enough, but hopefully that won't be a problem, even with some of our older LTS kernels. I think for the start it would make most sense to read modalias in addition to cpuinfo, sort based on the data in modialis, and then fallback to cpuinfo if it doesn't match. This helps for architectures without the modalias file (like riscv64), and I don't know what the Hurd provides, but I'd be surprised if it had the same modalias file for parsing. I'll try to work on it a bit over the coming days. --=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 --w/OVG1VbdlyG0qaf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmdX+OgACgkQQarn3Mo9 g1G2jRAAnYuWeGCFeYgO+WL1sNmFesRh+LiBqSHxeV4bftENKPBtD0VqR4VX3FtE hoUdgHl44b0hs8wpK6EW+ISQCMOSNyCooyviEUVA0KM7VAJ3ysuOb4YbbfZ+EYx0 TaCg0xFd+op2tpKzi7M/zmV4LHgmNi4G6ak+W1eLKe/mmj4Sv/BhbsRJy+z6h3Ai eA79OJYGWoYBZ0YvH0oZkTlUl/Hfp2ovEArLBYvCF6jhujcjgBi9opxG62iscMDV r5NCGMsW8cDTNhFSeNMgT6hG09CK84/4w1NI+b13lWTcKwwAP1RNntCH8Xp5pR8o ZVX4jkjdDh4xAmQBj07Cv2BYP+PHaazWUe6QVKMqO5SAnADA5v1KDFaKmkzuy0pu 3AvT77jwgC6LgVaLjgVrlnuyzSyYYB0hVsoW0NFzntU8l/jza+DXBGM+r6aKVUeU U4xnRYJ3NMhGVcIf2TbtjPfWa11IukptJxRkgrqMqpTLK3vuE4w5PRvVDkIX98I4 PdM/hZW0GQsxscIQCZMiFY1UJurG5WySHZS/GtI5Ec3tofyKJZhtA7eseogM/cwh pcowalrsjlLWenS69/UuYobfGCwgt6jPNhpRmXIM6LZ1Z728L9Ok3RJc7CCuNuM9 oFRTYcLt7Oh66Y7sm2u35llz37uSclnURBWb8HDVjo69vtHSmdA= =34Y0 -----END PGP SIGNATURE----- --w/OVG1VbdlyG0qaf--