public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Elias Huhsovitz <e.huhsovitz@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu-server v4 4/4] cpu: add cpu binding
Date: Thu, 19 Nov 2026 18:08:48 +0100	[thread overview]
Message-ID: <00b7c303-d963-4c08-8341-01b1274f0253@proxmox.com> (raw)
In-Reply-To: <DMZ7RTV0A05E.30JMJODPRDFAL@proxmox.com>



On 11/19/26 2:16 PM, Elias Huhsovitz wrote:
> On Thu Nov 19, 2026 at 11:07 AM CET, Dominik Csapak wrote:
>>
>>
>> On 11/19/26 10:35 AM, Elias Huhsovitz wrote:
>>>>>         eval {
>>>>>             # With -blockdev, it is necessary to activate the volumes before generating the command line
>>>>>             # Plugins can safely deactivate already-active volumes here if needed
>>>>> @@ -5539,10 +5548,21 @@ sub vm_start_nolock {
>>>>>                 },
>>>>>             );
>>>>>     
>>>>> +        if ($conf->{'cpu-binding-mode'}) {
>>>>> +            $vcpu_binding_map = PVE::QemuServer::CPUBind::conf_to_vcpu_bindings($conf);
>>>> ... but here int he crate we don't do any cpu pinning
>>>>
>>>> we could also always do it in the crate
>>>>
>>>> then the taskset call would vanish here.
>>>>
>>>> we'd have to do
>>>>
>>>> my $binding = parse_cpu_binding($conf-{'pcu-
>>>>
>>> I am not quite sure what is meant by this.
>>>
>>> Do you mean that we simply hand all affinity related logic to the code
>>> responsible for the cpu pinning logic?
>>
>> yes, this. affinity only influences this one taskset call,
>> so having one place where we set this makes sense imo
> 
> But if you omitt the tasket for the qemu command, i.e., the
> 
> taskset -ac <qmu-cmd>
> 
> For a VM with only affinity set (no cpu pinning):
> * QEMU is not started with a specific affinity mask, since the cpu
>   pinning logic applies sched_setaffinity after qemu creates the vCPUs.
> * So the VM has to start in a frozen state to avoid vcpus being
>   scheduled on host cpus outside the affinity mask
> 
> IMO the best three solutions are:
> 1) Simply move the existing logic for the `taskset -ac <qmu-cmd>` to the
> new module. It's not that much code, so idk if this is really worth it.
> 2) Do not freeze the VM at all, but start qemu with the affinity mask
> applied to act as an upper bound until the pinning is applied.
> 3) The approach of this series: just expand the if statement: only
> When affinity=something, cpu-binding=none:
> 	start qemu with`taskset -ac <qmu-cmd>` (no freezing, current status
> 	quo)
> 
> When cpu-binding=one-to-one | numa:
> 	Do not start qemu with `taskset -ac <qmu-cmd>`
> 	Freeze the VM at startup
> 	Apply CPU Pinning
> 	Resume the VM
> 

mhmm maybe then it'd make sense to always do the taskset command
even when we have a binding ? the binding code can only narrow
it down anyway?

>>>
>>> Or do you mean that we should init qemu using taskset anyways and then
>>> later set the affinity of the vcpus again when it is time to pin?
>>> Since I chose to freeze the vm on startup, until pinning is applied, I
>>> figured the original taskset to be redundant.
> 





      reply	other threads:[~2026-11-19 17:08 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
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 [this message]

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=00b7c303-d963-4c08-8341-01b1274f0253@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=e.huhsovitz@proxmox.com \
    --cc=pve-devel@lists.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