From: Sergey Fedorov <serge.fdrv@gmail.com>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: "MTTCG Devel" <mttcg@listserver.greensocs.com>,
"KONRAD Frédéric" <fred.konrad@greensocs.com>,
"Alvise Rigo" <a.rigo@virtualopensystems.com>,
"Emilio G. Cota" <cota@braap.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: [Qemu-devel] exec: Safe work in quiescent state
Date: Fri, 10 Jun 2016 00:51:57 +0300 [thread overview]
Message-ID: <5759E4FD.5020608@gmail.com> (raw)
Hi,
For certain kinds of tasks we might need a quiescent state to perform an
operation safely. Quiescent state means no CPU thread executing, and
probably BQL held as well. The tasks could include:
- Translation buffer flush (user and system-mode)
- Cross-CPU TLB flush (system-mode)
- Exclusive operation emulation (user-mode)
If we use a single shared translation buffer which is not managed by RCU
and simply flushed when full, we'll need a quiescent state to flush it
safely.
In multi-threaded TCG, cross-CPU TLB flush from TCG helpers could
probably be made with async_run_on_cpu(). I suppose it is always the
guest system that needs to synchronise this operation properly. And as
soon as we request the target CPU to exit its execution loop for serving
the asynchronous work, we should probably be okay to continue execution
on the CPU requested the operation while the target CPU executing till
the end of its current TB before it actually flushed its TLB.
As of slow-path LL/SC emulation in multi-threaded TCG, cross-CPU TLB
flushes (actually TLB flushes on all CPUs) must me done synchronously
and thus might require quiescent state.
Exclusive operation emulation in user-mode is currently implemented in
this manner, see for start_exclusive(). It might change to some generic
mechanism of atomic/exclusive instruction emulation for system and
user-mode.
It looks like we need to implement a common mechanism to perform safe
work in a quiescent state which could work in both system and user-mode,
at least for safe translation bufferflush in user-mode and MTTCG. I'm
going to implement such a mechanism. I would appreciate any suggestions,
comments and remarks.
Thanks,
Sergey
next reply other threads:[~2016-06-09 21:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 21:51 Sergey Fedorov [this message]
2016-06-15 12:59 ` [Qemu-devel] exec: Safe work in quiescent state Sergey Fedorov
2016-06-15 14:16 ` alvise rigo
2016-06-15 14:51 ` Alex Bennée
2016-06-15 15:25 ` alvise rigo
2016-06-15 20:05 ` Sergey Fedorov
2016-06-15 14:56 ` Alex Bennée
2016-06-15 19:16 ` Sergey Fedorov
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=5759E4FD.5020608@gmail.com \
--to=serge.fdrv@gmail.com \
--cc=a.rigo@virtualopensystems.com \
--cc=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=fred.konrad@greensocs.com \
--cc=mttcg@listserver.greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.