qemu-e2k/include/qemu
David Hildenbrand 7730f32c28 util: Introduce qemu_thread_set_affinity() and qemu_thread_get_affinity()
Usually, we let upper layers handle CPU pinning, because
pthread_setaffinity_np() (-> sched_setaffinity()) is blocked via
seccomp when starting QEMU with
    -sandbox enable=on,resourcecontrol=deny

However, we want to configure and observe the CPU affinity of threads
from QEMU directly in some cases when the sandbox option is either not
enabled or not active yet.

So let's add a way to configure CPU pinning via
qemu_thread_set_affinity() and obtain CPU affinity via
qemu_thread_get_affinity() and implement them under POSIX using
pthread_setaffinity_np() + pthread_getaffinity_np().

Implementation under Windows is possible using SetProcessAffinityMask()
+ GetProcessAffinityMask(), however, that is left as future work.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <20221014134720.168738-3-david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
2022-10-27 11:00:36 +02:00
..
accel.h gdbstub: move sstep flags probing into AccelClass 2022-10-06 11:53:41 +01:00
atomic128.h
atomic.h Use QEMU_SANITIZE_THREAD 2022-05-03 15:16:21 +04:00
base64.h
bcd.h
bitmap.h
bitops.h
bswap.h Move CPU softfloat unions to cpu-float.h 2022-04-06 14:31:43 +02:00
buffer.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
cacheflush.h
cacheinfo.h include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h 2022-02-21 13:30:20 +00:00
co-shared-resource.h
compiler.h compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD} 2022-04-21 17:08:52 +04:00
config-file.h remove -writeconfig 2022-04-28 08:51:56 +02:00
coroutine_int.h
coroutine-tls.h tls: add macros for coroutine-safe TLS variables 2022-03-04 18:14:40 +01:00
coroutine.h coroutine: remove incorrect coroutine_fn annotations 2022-10-07 12:11:40 +02:00
cpu-float.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
cpuid.h tcg/i386: Detect AVX512 2022-03-04 08:50:41 -10:00
crc32c.h
crc-ccitt.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
ctype.h
cutils.h cutils: Introduce bundle mechanism 2022-07-13 16:58:57 +02:00
datadir.h
dbus.h ui/dbus: add chardev backend & interface 2021-12-21 10:50:22 +04:00
drm.h
envlist.h
error-report.h Move error_printf_unless_qmp() with monitor unit 2022-04-21 17:09:09 +04:00
event_notifier.h event_notifier: add event_notifier_get_wfd() 2022-03-06 06:19:47 -05:00
fifo8.h
fifo32.h
filemonitor.h
futex.h
guest-random.h
hbitmap.h block: simplify handling of try to merge different sized bitmaps 2022-06-24 17:07:06 +02:00
help_option.h
help-texts.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
host-utils.h include/qemu/host-utils.h: Simplify the compiler check in mulu128() 2022-08-04 13:49:47 +02:00
hw-version.h include: Move hardware version declarations to new qemu/hw-version.h 2022-02-21 13:30:20 +00:00
id.h
int128.h host-utils: Implemented unsigned 256-by-128 division 2022-06-20 08:38:58 -03:00
iov.h
iova-tree.h util: accept iova_tree_remove_parameter by value 2022-09-02 10:22:39 +08:00
jhash.h
job.h job: remove unused functions 2022-10-07 12:11:41 +02:00
keyval.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
lockable.h
log-for-trace.h util/log: Drop return value from qemu_log 2022-04-20 10:51:11 -07:00
log.h util/log: Support per-thread log files 2022-04-20 10:51:11 -07:00
madvise.h include: Move qemu_madvise() and related #defines to new qemu/madvise.h 2022-02-21 13:30:20 +00:00
main-loop.h Revert "main-loop: Disable block backend global state assertion on Cocoa" 2022-09-23 14:36:33 +02:00
memalign.h osdep: Move memalign-related functions to their own header 2022-03-07 13:16:49 +00:00
memfd.h
mmap-alloc.h util/mmap-alloc: Remove qemu_mempath_getpagesize() 2022-08-26 13:34:21 +02:00
module.h modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
mprotect.h include: Move qemu_mprotect_*() to new qemu/mprotect.h 2022-02-21 13:30:20 +00:00
notify.h
nvdimm-utils.h
option_int.h
option.h include: add qemu/keyval.h 2022-04-21 17:03:51 +04:00
osdep.h util: Cleanup and rename os_mem_prealloc() 2022-10-27 11:00:28 +02:00
path.h
plugin-memory.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
plugin.h plugins: add [pre|post]fork helpers to linux-user 2022-10-06 11:53:41 +01:00
pmem.h
processor.h
progress_meter.h
qdist.h
qemu-options.h
qemu-plugin.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
qemu-print.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
qemu-progress.h include: move progress API to qemu-progress.h 2022-04-06 14:31:43 +02:00
qht.h
qsp.h
queue.h
range.h compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT 2022-03-22 14:40:51 +04:00
ratelimit.h
rcu_queue.h
rcu.h rcu: use coroutine TLS macros 2022-03-04 18:14:40 +01:00
readline.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
selfmap.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
seqlock.h
sockets.h oslib-posix: Introduce qemu_socketpair() 2022-09-29 14:38:05 +04:00
stats64.h
sys_membarrier.h
systemd.h
thread-posix.h thread-posix: implement Semaphore with QemuCond and QemuMutex 2022-04-06 14:31:56 +02:00
thread-win32.h
thread.h util: Introduce qemu_thread_set_affinity() and qemu_thread_get_affinity() 2022-10-27 11:00:36 +02:00
throttle-options.h
throttle.h
timed-average.h
timer.h Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
transactions.h
tsan.h
typedefs.h dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
unicode.h
units.h
uri.h
userfaultfd.h
uuid.h
vfio-helpers.h
vhost-user-server.h block/export: Fix vhost-user-blk shutdown with requests in flight 2022-02-01 13:49:15 +01:00
win_dump_defs.h include/qemu: add 32-bit Windows dump structures 2022-04-22 13:36:04 +04:00
xattr.h 9p: linux: Fix a couple Linux assumptions 2022-03-07 11:49:30 +01:00
xxhash.h
yank.h