From: Dietmar Maurer <dietmar@proxmox.com>
To: Kevin Wolf <kwolf@redhat.com>, Stefan Reiter <s.reiter@proxmox.com>
Cc: vsementsov@virtuozzo.com, slp@redhat.com,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
mreitz@redhat.com, stefanha@redhat.com, jsnow@redhat.com
Subject: Re: qemu_coroutine_yield switches thread?
Date: Thu, 16 Apr 2020 12:09:34 +0200 (CEST) [thread overview]
Message-ID: <1548825935.27.1587031774908@webmail.proxmox.com> (raw)
In-Reply-To: <20200416082849.GA6014@linux.fritz.box>
> > quick question: Can a resume from a qemu_coroutine_yield happen in a
> > different thread?
> >
> > Well, it can, since I'm seeing it happen, but is that okay or a bug?
>
> Yes, it can happen. At least for devices like IDE where a request is
> started during a vmexit (MMIO or I/O port write), the coroutine will
> usually begin its life in the vcpu thread and then move to the main loop
> thread.
>
> This is not a problem because the vcpu thread holds the BQL while
> running the request coroutine.
Isn't that a problem when using QemuRecMutex, for example:
qemu_rec_mutex_lock(lock)
...
qemu_coroutine_yield() // wait for something
// we are now inside a different thread
qemu_rec_mutex_unlock(lock) // Crash - wrong thread!!
?
next prev parent reply other threads:[~2020-04-16 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 8:06 qemu_coroutine_yield switches thread? Stefan Reiter
2020-04-16 8:28 ` Kevin Wolf
2020-04-16 10:09 ` Dietmar Maurer [this message]
2020-04-16 11:04 ` Kevin Wolf
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=1548825935.27.1587031774908@webmail.proxmox.com \
--to=dietmar@proxmox.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=s.reiter@proxmox.com \
--cc=slp@redhat.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/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).