summary refs log tree commit diff
path: root/arch/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2019-04-05 09:58:48 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-09 06:20:04 -0700
commit107edb3eec98a707118ae9a4a804a256e53892a0 (patch)
tree7f33cebb1a004e8380648ba4d7a67392f8051a21 /arch/src/lib.rs
parent1f9ae42c73c020ca77c7c0fbe2e09be3b90fe573 (diff)
downloadcrosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar.gz
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar.bz2
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar.lz
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar.xz
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.tar.zst
crosvm-107edb3eec98a707118ae9a4a804a256e53892a0.zip
main: add --cpu-affinity option to pin VCPUs
This allows setting the affinity of the VCPU threads to specific host
CPUs.  Note that each individual CPU has its affinity set to the full
set of CPUs specified, so the host kernel may still reschedule VCPU
threads on whichever host CPUs it sees fit (within the specified set).

BUG=chromium:909793
TEST=build_test

Change-Id: I09b893901caf91368b64f5329a6e9f39027fef23
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1554865
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'arch/src/lib.rs')
-rw-r--r--arch/src/lib.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/src/lib.rs b/arch/src/lib.rs
index 9cc55e1..1e55caf 100644
--- a/arch/src/lib.rs
+++ b/arch/src/lib.rs
@@ -38,6 +38,7 @@ use sys_util::{syslog, EventFd, GuestAddress, GuestMemory, GuestMemoryError};
 pub struct VmComponents {
     pub memory_mb: u64,
     pub vcpu_count: u32,
+    pub vcpu_affinity: Vec<usize>,
     pub kernel_image: File,
     pub android_fstab: Option<File>,
     pub initrd_image: Option<File>,
@@ -53,6 +54,7 @@ pub struct RunnableLinuxVm {
     pub stdio_serial: Arc<Mutex<Serial>>,
     pub exit_evt: EventFd,
     pub vcpus: Vec<Vcpu>,
+    pub vcpu_affinity: Vec<usize>,
     pub irq_chip: Option<File>,
     pub io_bus: Bus,
     pub mmio_bus: Bus,