From: Alyssa Ross <hi@alyssa.is>
To: Cole Helbling <cole.e.helbling@outlook.com>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH crosvm 2/2] crosvm: fix deadlock on early VmRequest
Date: Tue, 16 Jun 2020 09:39:25 +0000 [thread overview]
Message-ID: <877dw7qrhu.fsf@alyssa.is> (raw)
In-Reply-To: <CH2PR14MB357930F1707BB3BA2C869CE7B39D0@CH2PR14MB3579.namprd14.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2236 bytes --]
>> @@ -1667,6 +1668,45 @@ fn file_to_i64<P: AsRef<Path>>(path: P) ->
>> io::Result<i64> {
>> .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "empty file"))
>> }
>>
>> +/// Returns a boolean indicating whether the VM should be exited.
>> +fn do_vm_request(
>> + request: VmRequest,
>> + device_socket: Option<&UnixSeqpacket>,
>> + control_socket: &VmControlResponseSocket,
>> + run_mode_arc: &Arc<VcpuRunMode>,
>> + vcpu_handles: &mut Vec<JoinHandle<()>>,
>> + io_bus: &mut Bus,
>> +) -> MsgResult<bool> {
>> + let mut run_mode_opt = None;
>> + let response = request.execute(&mut run_mode_opt, device_socket);
>> + control_socket.send(&response)?;
>> + if let Some(run_mode) = run_mode_opt {
>> + info!("control socket changed run mode to {}", run_mode);
>> + match run_mode {
>> + VmRunMode::Exiting => Ok(true),
>> + VmRunMode::Running => {
>> + if let VmRunMode::Suspending = *run_mode_arc.mtx.lock() {
>> + io_bus.notify_resume();
>> + }
>> + run_mode_arc.set_and_notify(VmRunMode::Running);
>> + for handle in vcpu_handles {
>> + let _ = handle.kill(SIGRTMIN() + 0);
>
> I know this is essentially just moved (and probably isn't even something
> you wrote), but do you know why this is `+ 0`? Does this somehow coerce
> to the desired type or something? Maybe I'm overlooking something
> obvious here.
I have no idea! Had a look through the history but couldn't see
anything obvious. I remvoed a random + 0 I found, and nothing looked
like it went wrong.
As an aside, it looks like your MUA has stripped repeated whitespace in
the quote above. Makes the code rather difficult to read. :P You might
want to look into that.
> Either way, the above is just a nit. Good work on tracking this
> particular issue down!
>
> Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
Thanks for the review! Again, much appreciated even though I pushed
already, and I'll try to add it retrospectively as a git note.
It may interest you to know that this patch actually had a bug in it,
which I didn't notice either until I managed to crash crosvm because of
it. Here's the fix:
https://spectrum-os.org/git/crosvm/commit/?id=ca5bdd2ac3e473e9b082c44c2870f446b96323a2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2020-06-16 9:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-14 11:43 [PATCH crosvm 0/2] Fix " Alyssa Ross
2020-06-14 11:43 ` [PATCH crosvm 1/2] msg_socket: introduce UnixSeqpacketExt Alyssa Ross
2020-06-16 0:17 ` Cole Helbling
2020-06-16 9:32 ` Alyssa Ross
2020-06-22 22:06 ` Cole Helbling
2020-06-23 2:32 ` Alyssa Ross
2020-06-25 1:54 ` impaqt
2020-07-09 13:24 ` Alyssa Ross
2020-06-14 11:43 ` [PATCH crosvm 2/2] crosvm: fix deadlock on early VmRequest Alyssa Ross
2020-06-16 1:08 ` Cole Helbling
2020-06-16 9:39 ` Alyssa Ross [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dw7qrhu.fsf@alyssa.is \
--to=hi@alyssa.is \
--cc=cole.e.helbling@outlook.com \
--cc=devel@spectrum-os.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).