summary refs log tree commit diff
path: root/x86_64
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 /x86_64
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 'x86_64')
-rw-r--r--x86_64/src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs
index 640d886..de12a10 100644
--- a/x86_64/src/lib.rs
+++ b/x86_64/src/lib.rs
@@ -329,6 +329,8 @@ impl arch::LinuxArch for X8664arch {
             vcpus.push(vcpu);
         }
 
+        let vcpu_affinity = components.vcpu_affinity;
+
         let irq_chip = Self::create_irq_chip(&vm)?;
         let mut cmdline = Self::get_base_linux_cmdline();
 
@@ -376,6 +378,7 @@ impl arch::LinuxArch for X8664arch {
             stdio_serial,
             exit_evt,
             vcpus,
+            vcpu_affinity,
             irq_chip,
             io_bus,
             mmio_bus,