acrn-hypervisor/devicemodel/core
Shiqing Gao 5306d9e7db dm: update the `iothread` option to specify the CPU affinity
This patch updates the `iothread` option to specify the CPU affinity
of the iothread. Setting the iothread's CPU affinity could benefit the
Service VM's CPU utilization when Service VM owns limited dedicated CPUs.

It could be helpful to ensure the I/O mediator Quality of Service (QoS).
Once the performance tuning is done, the specific CPU affinity config could
pass to acrn-dm directly, letting the deployment more easily.

The format looks like below:
iothread=<num_iothread>@<cpu_affinity>
"@" is used to separate the following two settings:
 - the number of iothread instances
 - the CPU affinity settings for each iothread instance.

The format of `cpu_affinity` looks like below:
<cpu_affinity_0>/<cpu_affinity_1>/<cpu_affinity_2>/...
1. "/" is used to separate the CPU affinity setting for each iothread instance
   (sequentially).
2. char '*' can be used to skip the setting for the specific iothread instance.
3. the number of cpu_affinity_x vs. the number of iothread instances
   - If # of cpu_affinity_x is less than # of iothread instances,
     no CPU affinity settings for the last few iothread instances.
   - If # of cpu_affinity_x is more than # of iothread instances,
     the extra cpu_affinity_x are discarded.
4. ":" is used to separate different CPU cores for each CPU affinity setting.

Examples to specify the CPU affinity of the iothread:
1. iothread=3@0:1:2/0:1
   `add_virtual_device    9 virtio-blk iothread=3@0:1:2/0:1,mq=3,/dev/nvme1n1`
   a) 3 iothread instances are created.
   b) CPU affinity of iothread instances for this virtio-blk device:
      - 1st iothread instance <-> pins to Service VM CPU 0,1,2
      - 2nd iothread instance <-> pins to Service VM CPU 0,1
      - 3rd iothread instance <-> No CPU affinity settings

2. iothread=3@0/*/1
   `add_virtual_device    9 virtio-blk iothread=3@0/*/1,mq=3,/dev/nvme1n1`
   a) 3 iothread instances are created.
   b) CPU affinity of iothread instances for this virtio-blk device:
      - 1st iothread instance <-> pins to Service VM CPU 0
      - 2nd iothread instance <-> No CPU affinity settings
      - 3rd iothread instance <-> pins to Service VM CPU 1

v1 -> v2:
 * encapsulate one API in iothread.c to parse the iothread options, so that
   other BE can also use it.

v2 -> v3:
 * introduce one API iothread_free_options to free the elements that
   are allocated dynamically in iothread_parse_options().

Tracked-On: #8612

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2024-06-05 15:23:33 +08:00
..
cmd_monitor dm: vm_event: add vm_event support in cmd monitor 2024-02-01 17:01:31 +08:00
console.c DM: remove unused function console_ptr_event 2019-05-24 11:51:00 +08:00
hugetlb.c devicemodel: Fix spelling and grammar mistakes. 2023-09-08 08:01:13 +08:00
inout.c hv: dm: Use new I/O request data structures 2021-07-15 11:53:54 +08:00
iothread.c dm: update the `iothread` option to specify the CPU affinity 2024-06-05 15:23:33 +08:00
main.c dm: set iothread nice value to PRIO_MIN 2024-06-05 15:23:33 +08:00
mem.c hv: dm: Use new I/O request data structures 2021-07-15 11:53:54 +08:00
mevent.c devicemodel: Fix spelling and grammar mistakes. 2023-09-08 08:01:13 +08:00
monitor.c devicemodel: Fix spelling and grammar mistakes. 2023-10-23 08:57:53 +08:00
mptbl.c dm: fixed a bug where mptable failed to wake up CPU1# when adding acpi=off into User VM cmdline 2022-03-02 11:22:31 +08:00
pm.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
pm_vuart.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
post.c dm: refine 'assert' in inout.c and post.c 2019-06-20 08:55:44 +08:00
sbuf.c dm: vm_event: add sbuf code in dm 2024-02-01 17:01:31 +08:00
sw_load_bzimage.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sw_load_common.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sw_load_elf.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sw_load_ovmf.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sw_load_vsbl.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
timer.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vm_event.c dm: vm_event: add support for RTC change event 2024-02-01 17:01:31 +08:00
vmmapi.c asyncio: refine the setup ioctl 2022-11-25 10:43:34 +08:00
vrpmb.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00