public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Elias Huhsovitz" <e.huhsovitz@proxmox.com>
To: "Thomas Lamprecht" <t.lamprecht@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 14:05:00 +0100	[thread overview]
Message-ID: <DMYCWU0KJ4J7.1KFSZLVCJFU88@proxmox.com> (raw)
In-Reply-To: <f848b08c-2f41-4bd0-8f56-3f7150890b8d@proxmox.com>

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:
>> 
>> 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!

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_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";
> }
>

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 ) 

>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)
>> 
>> 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.

Ok, seems sensible to me!




  reply	other threads:[~2026-11-18 13:05 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
2026-11-18 13:05               ` Elias Huhsovitz [this message]
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=DMYCWU0KJ4J7.1KFSZLVCJFU88@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal