diff options
author | Matt Delco <delco@google.com> | 2019-04-17 18:13:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-24 15:51:12 -0700 |
commit | 73e1e4e7b63e89fa6f879d368590623c7b6444c6 (patch) | |
tree | 046851f9b9579893dd8485d315884bfc5098912f /src/plugin | |
parent | e3fdadb8e18d567f7e2377613d875f12243b785a (diff) | |
download | crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar.gz crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar.bz2 crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar.lz crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar.xz crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.tar.zst crosvm-73e1e4e7b63e89fa6f879d368590623c7b6444c6.zip |
crosvm: only clear signal when needed
Only clear signal when EINTR is indicated, rather than doing it after each attempt to run the VM. BUG=None TEST=Local compile. Ran my diagnostic plugin and confirmed that pause can still be trigger. Ran my benchmarking plugin and saw the time used decrease by about 13%. The net reduction with 2 other changes is about 42%. Change-Id: I118e05c6c62d1251946dd6432d4c933a3b8504fc Signed-off-by: Matt Delco <delco@google.com> Reviewed-on: https://chromium-review.googlesource.com/1573219 Commit-Ready: Matt Delco <delco@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src/plugin')
-rw-r--r-- | src/plugin/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs index 82c686f..6fbb9e7 100644 --- a/src/plugin/mod.rs +++ b/src/plugin/mod.rs @@ -410,6 +410,7 @@ pub fn run_vcpus( error!("failed to initialize vcpu {}: {}", cpu_id, e); } else { loop { + let mut interrupted_by_signal = false; let run_res = vcpu.run(); match run_res { Ok(run) => match run { @@ -465,7 +466,8 @@ pub fn run_vcpus( r => warn!("unexpected vcpu exit: {:?}", r), }, Err(e) => match e.errno() { - EAGAIN | EINTR => {} + EINTR => interrupted_by_signal = true, + EAGAIN => {} _ => { error!("vcpu hit unknown error: {}", e); break; @@ -478,7 +480,10 @@ pub fn run_vcpus( // Try to clear the signal that we use to kick VCPU if it is // pending before attempting to handle pause requests. - clear_signal(SIGRTMIN() + 0).expect("failed to clear pending signal"); + if interrupted_by_signal { + clear_signal(SIGRTMIN() + 0) + .expect("failed to clear pending signal"); + } if let Err(e) = vcpu_plugin.pre_run(&vcpu) { error!("failed to process pause on vcpu {}: {}", cpu_id, e); |