kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: mian-muhammad.hamayun@imag.fr
Cc: kvm@vger.kernel.org
Subject: Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?
Date: Thu, 26 Jul 2012 16:55:52 +0300	[thread overview]
Message-ID: <50114C68.1010602@redhat.com> (raw)
In-Reply-To: <50114898.5080402@imag.fr>

On 07/26/2012 04:39 PM, Mian M. Hamayun wrote:
>>
>> Can you share your reproducer?
> Actually its based on kvm-tool and I have integrated some code from
> qemu-kvm to add debug support to kvm-tool.
> I don't have a smaller example that could reproduce the same problem.

Then there's probably a bug there.

> 
> The thread 3 does actually receives the signal, but the order is not right.
> 
> As the BSP (Thread 2) starts, it locks the "qemu_global_mutex" and
> releases it only when it calls the "run_on_cpu" function and starts
> waiting on "qemu_work_cond".
> The AP (Thread 3) wakes-up due to the SIG_IPI signal from thread 2,
> acquires the lock on "qemu_global_mutex" and enters the guest mode.
> (This is the deadlock case)

Why would it enter guest mode?  Shouldn't it execute the function you
queued?

> 
> If we do not lock the "qemu_global_mutex" in each cpu thread at the
> beginning, and only lock it when we quit the guest mode, the problem
> seems to go away, as now we get the SIG_IPI when the Thread 3 is
> actually in the guest mode and it quits to user mode.
> But I am not sure if this is the right way to do it, as in qemu-kvm we
> _always_ start each cpu thread by locking the "qemu_global_mutex".

Do you call KVM_SET_SIGNAL_MASK to allow the signal?



-- 
error compiling committee.c: too many arguments to function



      reply	other threads:[~2012-07-26 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26  9:38 Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ? Mian M. Hamayun
2012-07-26 10:06 ` Avi Kivity
2012-07-26 10:34   ` Mian M. Hamayun
2012-07-26 10:43     ` Avi Kivity
2012-07-26 13:39       ` Mian M. Hamayun
2012-07-26 13:55         ` Avi Kivity [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=50114C68.1010602@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mian-muhammad.hamayun@imag.fr \
    /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.
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).