Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call unstick_channels to mitigate the lost synic issue #376

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions vm/devices/vmbus/vmbus_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use mesh::RecvError;
use pal_async::task::Spawn;
use pal_async::task::Task;
use pal_event::Event;
use parking_lot::Mutex;
use ring::PAGE_SIZE;
use std::collections::HashMap;
use std::future::Future;
Expand Down Expand Up @@ -231,6 +232,8 @@ impl EventPort for ChannelEvent {
pub struct SavedState {
#[mesh(1)]
server: channels::SavedState,
#[mesh(2)]
lost_synic_bug_fixed: Option<bool>,
juantian8seattle marked this conversation as resolved.
Show resolved Hide resolved
}

const MESSAGE_CONNECTION_ID: u32 = 1;
Expand Down Expand Up @@ -837,6 +840,7 @@ impl ServerTask {

fn handle_request(&mut self, request: VmbusRequest) {
tracing::debug!(?request, "handle_request");
static IS_LOST_SYNIC_BUG_FIXED: Mutex<bool> = Mutex::new(false);
juantian8seattle marked this conversation as resolved.
Show resolved Hide resolved
match request {
VmbusRequest::Reset(Rpc((), done)) => {
assert!(self.inner.reset_done.is_none());
Expand Down Expand Up @@ -870,13 +874,23 @@ impl ServerTask {
.merge(&self.server.with_notifier(&mut self.inner));
});
}
VmbusRequest::Save(rpc) => rpc.handle_sync(|()| SavedState {
server: self.server.save(),
}),
VmbusRequest::Save(rpc) => {
// TODO: update to true once the save part fix in.
let lost_synic_bug_fixed = Some(false);
rpc.handle_sync(|()| SavedState {
server: self.server.save(),
lost_synic_bug_fixed,
})
}
VmbusRequest::Restore(rpc) => {
*IS_LOST_SYNIC_BUG_FIXED.lock() = rpc.0.lost_synic_bug_fixed.unwrap_or(false);
rpc.handle_sync(|state| self.server.restore(state.server))
juantian8seattle marked this conversation as resolved.
Show resolved Hide resolved
}
VmbusRequest::PostRestore(rpc) => {
if !*IS_LOST_SYNIC_BUG_FIXED.lock() {
tracing::info!("lost synic bug fix is not in yet, call unstick_channels to mitigate the issue.");
self.unstick_channels(false);
juantian8seattle marked this conversation as resolved.
Show resolved Hide resolved
}
rpc.handle_sync(|()| self.server.with_notifier(&mut self.inner).post_restore())
}
VmbusRequest::Stop(rpc) => rpc.handle_sync(|()| {
Expand Down