From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 652B51FF0C0 for ; Wed, 18 Nov 2026 14:05:07 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1031F216B2; Wed, 18 Nov 2026 14:05:05 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 18 Nov 2026 14:05:00 +0100 Message-Id: From: "Elias Huhsovitz" To: "Thomas Lamprecht" , "Fiona Ebner" , "Dominik Csapak" , Subject: Re: [PATCH qemu-server-rs v4 1/4] cpu: add pve-qemu-server-cpu crate for vCPU binding X-Mailer: aerc 0.20.0 References: <20261111152027.260117-1-e.huhsovitz@proxmox.com> <20261111152027.260117-2-e.huhsovitz@proxmox.com> <4f5ed842-1699-45d6-895b-e5fb664bd195@proxmox.com> <7d82cab7-5941-42cf-a610-02e8cdb12bda@proxmox.com> <28a30f3c-f9bb-4d24-8150-a8d35ca81f30@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795007100575 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.412 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 77Q4TVOUHXHUFHS3M2AU6AASTTRXL5SO X-Message-ID-Hash: 77Q4TVOUHXHUFHS3M2AU6AASTTRXL5SO X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Wolfgang Bumiller X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed Nov 18, 2026 at 12:44 PM CET, Thomas Lamprecht wrote: > Am 18.11.26 um 12:17 schrieb Elias Huhsovitz: >>> I agree having it in the qemu-server repo directly would be nice. >> Noted, this just leaves me with one question, I would like to have >> answered before continuing with the new version: >>=20 >> What is the concensus on "rust vs perl" for this code? >>=20 >> I originally chose rust, because: >> * Type system >> * Better data structures > > sure, but that's just rust, not why rust for this haha =E2=80=93 but fair > enough! I guess the decision was more: "no perl for this", instead of "rust for this". (I don't mind writign this code in perl, I just have a strong feeling that a typed language makes maintainign this code easier in the future) > >> * Directly calling sched_setaffinity(2) so we don't have go use the >> taskset wrapper. > > > FWIW, that's a simple syscall and we can do syscalls in perl (else doing > stuff like opening files would be rather hard) i.e. add SYS_sched_setaffi= nity > constant mapping (which is needed mostly because 'syscall.ph' has some od= d > behavior, but easy to work around) PVE::Syscall in pve-common, then (unte= sted): > > sub sched_setaffinity($pid, @cpus) { > my $mask =3D "\0" x 128; # 1024 CPUs, same size as glibc's cpu_set_t > vec($mask, $_, 1) =3D 1 for @cpus; > > syscall(PVE::Syscall::sched_setaffinity, int($pid), length($mask), $f= ilter)) =3D=3D 0 > or die "sched_setaffinity failed - $!\n"; > } > Ok, fair point. > >> * Potential future optimizations where a low-level language might come >> in handy. > > As in? Mostly to find out where this would go too. I.e., should this > replace the CPUConfig.pm, CPUFlags.pm? What's the long term idea here? > As I'd like to go in with a longer term plan, or better said goal, we do > not need to then blindly follow it, but going in blindly from the start > (not saying you do) is most of the time worse. > Yes, the long-term vision was to to also replace CPUConfig.pm & CPUFlags.pm. IMO the code would benefit from being in a typed language (I am not a big a big fan of perl Hashes, in case it wasnt obvious :D )=20 >>From my point of view adding the CPU binding is a nearly a pure addition to the logic, so it seemed like the perfect opportunity to just write the code in rust. >> * v1/v2 was written in perl, but it quickly became very convoluted IMHO. >> (But I think I can design it in a more straightforward way this time >> around) >>=20 >> But I do acknowledge the downsides. Since, you are the Maintainers, I >> would love to hear your opinion =F0=9F=99=82 > > Maybe lets ripen then the qemu-server native rust code infra =E2=80=93 Wo= lfgang > might have a (hopefully strong) opinion here to avoid me having to review > this in-depth for a hard decision of mine. Ideally we get a good basic > approach that can be nicely extended without to much maintainer pain, > then we can do rust without thinking too much about how much churn it > will be, as it will be much more contained. It's IMO also almost always > easier to start in-tree with these things and then split them out when > the approaches and uses cases and issues and so on are clearer. Ok, seems sensible to me!