All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Jürgen Groß" <jgross@suse.com>
Cc: "Anthony PERARD" <anthony.perard@vates.tech>,
	"Dario Faggioli" <dfaggioli@suse.com>,
	"George Dunlap" <gwd@xenproject.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 0/3] Change XEN_DOMCTL_setvcpuaffinity interface
Date: Wed, 1 Jul 2026 15:48:35 +0200	[thread overview]
Message-ID: <ff6cf07f-bc82-41d2-8a14-80cdcea54af1@suse.com> (raw)
In-Reply-To: <f4623033-ec0f-4b91-8443-724701c79f37@suse.com>

On 01.07.2026 15:08, Jürgen Groß wrote:
> On 01.07.26 13:39, Jan Beulich wrote:
>> On 01.07.2026 13:16, Juergen Gross wrote:
>>> Today the XEN_DOMCTL_setvcpuaffinity hypercall will not only change the
>>> affinity settings of a vcpu, it will return the new effective settings,
>>> too.
>>>
>>> In case an error happens during this hypercall, the expectation of the
>>> caller is that the affinity of the vcpu didn't change. This isn't true,
>>> however, if passing the new effective affinity back to the user is
>>> failing.
>>
>> That'll be the caller's fault though. Any -EFAULT coming back are an
>> indication that the caller needs fixing.
>>
>>> Instead of making error handling in the hypervisor even more complex,
>>> just change the interface by NOT passing back the new affinity. It can
>>> easily be obtained by another XEN_DOMCTL_getvcpuaffinity call if
>>> needed.
>>
>> At the expense of further increasing the pressure on the domctl lock.
>> When making the recent error code change in this area, I was actually
>> wondering in how far these two sub-ops might also be candidates for
>> moving out of the locked region. Yet with vcpu_affinity_domctl() not
>> using any locking that didn't look entirely straightforward to answer.
> 
> The calling hierarchy for the XEN_DOMCTL_setvcpuaffinity case is:
> 
> vcpu_affinity_domctl()
>    vcpu_set_hard_affinity()
>      vcpu_set_affinity()
>    vcpu_set_affinity()
> 
> vcpu_set_affinity() does the correct locking (takes the unit lock).

But that's not sufficient: The two involved vcpu_set_affinity() calls
want to stay together, i.e. not race with another domctl.

Jan


  reply	other threads:[~2026-07-01 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 11:16 [PATCH 0/3] Change XEN_DOMCTL_setvcpuaffinity interface Juergen Gross
2026-07-01 11:16 ` [PATCH 1/3] tools/libxl: don't rely on xc_vcpu_setaffinity() returned cpumaps Juergen Gross
2026-07-01 11:16 ` [PATCH 2/3] xen: don't let XEN_DOMCTL_setvcpuaffinity return the new affinities Juergen Gross
2026-07-01 11:16 ` [PATCH 3/3] tools/libxenctrl: rename parameters of xc_vcpu_setaffinity() Juergen Gross
2026-07-01 11:39 ` [PATCH 0/3] Change XEN_DOMCTL_setvcpuaffinity interface Jan Beulich
2026-07-01 11:45   ` Andrew Cooper
2026-07-01 13:00     ` Jürgen Groß
2026-07-01 13:08   ` Jürgen Groß
2026-07-01 13:48     ` Jan Beulich [this message]
2026-07-01 14:19       ` Jürgen Groß
2026-07-01 15:34   ` Juergen Gross
2026-07-02  5:54     ` Jan Beulich
2026-07-02  6:13       ` Jürgen Groß
2026-07-02  6:25         ` Jan Beulich
2026-07-02  6:30           ` Juergen Gross

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=ff6cf07f-bc82-41d2-8a14-80cdcea54af1@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dfaggioli@suse.com \
    --cc=gwd@xenproject.org \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.