From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Elias Huhsovitz <e.huhsovitz@proxmox.com>,
Fiona Ebner <f.ebner@proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>,
pve-devel@lists.proxmox.com
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: Re: [PATCH qemu-server-rs v4 1/4] cpu: add pve-qemu-server-cpu crate for vCPU binding
Date: Wed, 18 Nov 2026 12:44:14 +0100 [thread overview]
Message-ID: <f848b08c-2f41-4bd0-8f56-3f7150890b8d@proxmox.com> (raw)
In-Reply-To: <DMYAMPKOIV23.2FXDD6QDDI3UN@proxmox.com>
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:
>
> What is the concensus on "rust vs perl" for this code?
>
> I originally chose rust, because:
> * Type system
> * Better data structures
sure, but that's just rust, not why rust for this haha – but fair
enough!
> * 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_setaffinity
constant mapping (which is needed mostly because 'syscall.ph' has some odd
behavior, but easy to work around) PVE::Syscall in pve-common, then (untested):
sub sched_setaffinity($pid, @cpus) {
my $mask = "\0" x 128; # 1024 CPUs, same size as glibc's cpu_set_t
vec($mask, $_, 1) = 1 for @cpus;
syscall(PVE::Syscall::sched_setaffinity, int($pid), length($mask), $filter)) == 0
or die "sched_setaffinity failed - $!\n";
}
> * 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.
> * 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)
>
> But I do acknowledge the downsides. Since, you are the Maintainers, I
> would love to hear your opinion 🙂
Maybe lets ripen then the qemu-server native rust code infra – Wolfgang
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.
next prev parent reply other threads:[~2026-11-18 11:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 15:20 [RFC proxmox-perl-rs/qemu-server/qemu-server-rs v4 0/4] vCPU binding for qemu guests Elias Huhsovitz
2026-11-11 15:20 ` [PATCH qemu-server-rs v4 1/4] cpu: add pve-qemu-server-cpu crate for vCPU binding Elias Huhsovitz
2026-11-17 16:28 ` Dominik Csapak
2026-11-19 9:16 ` Elias Huhsovitz
2026-11-19 10:06 ` Dominik Csapak
2026-11-17 17:20 ` Thomas Lamprecht
2026-11-18 7:47 ` Dominik Csapak
2026-11-18 8:32 ` Thomas Lamprecht
2026-11-18 10:14 ` Fiona Ebner
2026-11-18 11:17 ` Elias Huhsovitz
2026-11-18 11:44 ` Thomas Lamprecht [this message]
2026-11-18 13:05 ` Elias Huhsovitz
2026-11-11 15:20 ` [PATCH proxmox-perl-rs v4 2/4] pve: cpu: add binding for pve-qemu-server-cpu crate Elias Huhsovitz
2026-11-17 16:37 ` Dominik Csapak
2026-11-11 15:20 ` [PATCH qemu-server v4 3/4] helpers: return integer values for parse_number_sets Elias Huhsovitz
2026-11-17 16:39 ` Dominik Csapak
2026-11-11 15:20 ` [PATCH qemu-server v4 4/4] cpu: add cpu binding Elias Huhsovitz
2026-11-17 16:36 ` Dominik Csapak
2026-11-19 9:35 ` Elias Huhsovitz
2026-11-19 10:07 ` Dominik Csapak
2026-11-19 13:16 ` Elias Huhsovitz
2026-11-19 17:08 ` Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f848b08c-2f41-4bd0-8f56-3f7150890b8d@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=e.huhsovitz@proxmox.com \
--cc=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=w.bumiller@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox