All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: qemu-devel@nongnu.org, "Michal Privoznik" <mprivozn@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Stefan Weil" <sw@weilnetz.de>
Subject: Re: [PATCH v2 4/7] util: Add write-only "node-affinity" property for ThreadContext
Date: Wed, 12 Oct 2022 10:03:07 +0200	[thread overview]
Message-ID: <87zge1eaf8.fsf@pond.sub.org> (raw)
In-Reply-To: <f147185e-0cf4-2ba5-0adb-a07e56fd7c63@redhat.com> (David Hildenbrand's message of "Tue, 11 Oct 2022 09:34:44 +0200")

David Hildenbrand <david@redhat.com> writes:

> On 11.10.22 08:03, Markus Armbruster wrote:
>> David Hildenbrand <david@redhat.com> writes:
>> 
>>> Let's make it easier to pin threads created via a ThreadContext to
>>> all CPUs currently belonging to a given set of NUMA nodes -- which is the
>>> common case.
>>>
>>> "node-affinity" is simply a shortcut for setting "cpu-affinity" manually
>>> to the list of CPUs belonging to the set of nodes. This property can only
>>> be written.
>>>
>>> A simple QEMU example to set the CPU affinity to Node 1 on a system with
>>> two NUMA nodes, 24 CPUs each:
>>>      qemu-system-x86_64 -S \
>>>        -object thread-context,id=tc1,node-affinity=1
>>>
>>> And we can query the cpu-affinity via HMP/QMP:
>>>      (qemu) qom-get tc1 cpu-affinity
>>>      [
>>>          1,
>>>          3,
>>>          5,
>>>          7,
>>>          9,
>>>          11,
>>>          13,
>>>          15,
>>>          17,
>>>          19,
>>>          21,
>>>          23,
>>>          25,
>>>          27,
>>>          29,
>>>          31,
>>>          33,
>>>          35,
>>>          37,
>>>          39,
>>>          41,
>>>          43,
>>>          45,
>>>          47
>>>      ]
>> 
>> Double-checking my understanding: on this system, the even CPUs belong
>> to NUMA node 0, and the odd ones to node 1.  Setting node-affinity=1 is
>> therefore sugar for setting cpu-affinity to the set of even CPUs.
>> Correct?
>
> Yes!
>
> # lscpu
> ...
> NUMA:
>   NUMA node(s):          2
>   NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46
>   NUMA node1 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47

Thanks!

>>> We cannot query the node-affinity:
>>>      (qemu) qom-get tc1 node-affinity
>>>      Error: Insufficient permission to perform this operation
>> 
>> The error message is somewhat misleading.  "Insufficient permission"
>> suggests this could work if I had more "permission".  Not the case.  The
>> message comes from object_property_get(), i.e. it's not this patch's
>> fault.  I'll post a patch to improve it.
>
> I agree, thanks!

QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>



  reply	other threads:[~2022-10-12  8:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10  9:11 [PATCH v2 0/7] hostmem: NUMA-aware memory preallocation using ThreadContext David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 1/7] util: Cleanup and rename os_mem_prealloc() David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 2/7] util: Introduce qemu_thread_set_affinity() and qemu_thread_get_affinity() David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 3/7] util: Introduce ThreadContext user-creatable object David Hildenbrand
2022-10-11  5:47   ` Markus Armbruster
2022-10-11  7:53     ` David Hildenbrand
2022-10-12  8:02       ` Markus Armbruster
2022-10-12  8:19         ` David Hildenbrand
2022-10-12 10:23           ` Markus Armbruster
2022-10-12 12:27             ` David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 4/7] util: Add write-only "node-affinity" property for ThreadContext David Hildenbrand
2022-10-11  6:03   ` Markus Armbruster
2022-10-11  7:34     ` David Hildenbrand
2022-10-12  8:03       ` Markus Armbruster [this message]
2022-10-12  8:26         ` David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 5/7] util: Make qemu_prealloc_mem() optionally consume a ThreadContext David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 6/7] hostmem: Allow for specifying a ThreadContext for preallocation David Hildenbrand
2022-10-10  9:11 ` [PATCH v2 7/7] vl: Allow ThreadContext objects to be created before the sandbox option David Hildenbrand
2022-10-10 10:40 ` [PATCH v2 0/7] hostmem: NUMA-aware memory preallocation using ThreadContext Dr. David Alan Gilbert
2022-10-10 11:18   ` David Hildenbrand
2022-10-11  9:02     ` Dr. David Alan Gilbert

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=87zge1eaf8.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sw@weilnetz.de \
    /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.