qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PULL 12/14] cpus: re-factor out handle_icount_deadline
Date: Mon, 31 Oct 2016 15:13:33 +0100	[thread overview]
Message-ID: <1477923215-30323-13-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1477923215-30323-1-git-send-email-pbonzini@redhat.com>

From: Alex Bennée <alex.bennee@linaro.org>

In preparation for adding a MTTCG thread we re-factor out a bit of what
will be common code to handle the QEMU_CLOCK_VIRTUAL expiration.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20161027151030.20863-18-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/cpus.c b/cpus.c
index cc49902..6f0dc1a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1076,6 +1076,18 @@ static int64_t tcg_get_icount_limit(void)
     }
 }
 
+static void handle_icount_deadline(void)
+{
+    if (use_icount) {
+        int64_t deadline =
+            qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
+
+        if (deadline == 0) {
+            qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
+        }
+    }
+}
+
 static int tcg_cpu_exec(CPUState *cpu)
 {
     int ret;
@@ -1198,13 +1210,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
         /* Pairs with smp_wmb in qemu_cpu_kick.  */
         atomic_mb_set(&exit_request, 0);
 
-        if (use_icount) {
-            int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
+        handle_icount_deadline();
 
-            if (deadline == 0) {
-                qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
-            }
-        }
         qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus));
         deal_with_unplugged_cpus();
     }
-- 
2.7.4

  parent reply	other threads:[~2016-10-31 14:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 14:13 [Qemu-devel] [PULL 00/14] MTTCG patches for 2016-10-31 Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 01/14] cpus: make all_vcpus_paused() return bool Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 02/14] translate_all: DEBUG_FLUSH -> DEBUG_TB_FLUSH Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 03/14] translate-all: add DEBUG_LOCKING asserts Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 04/14] cpu-exec: include cpu_index in CPU_LOG_EXEC messages Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 05/14] tcg: comment on which functions have to be called with tb_lock held Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 06/14] linux-user/elfload: ensure mmap_lock() held while setting up Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 07/14] translate-all: Add assert_(memory|tb)_lock annotations Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 08/14] tcg: protect translation related stuff with tb_lock Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 09/14] target-arm/arm-powerctl: wake up sleeping CPUs Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 10/14] tcg: move tcg_exec_all and helpers above thread fn Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 11/14] tcg: cpus rm tcg_exec_all() Paolo Bonzini
2016-10-31 14:13 ` Paolo Bonzini [this message]
2016-10-31 14:13 ` [Qemu-devel] [PULL 13/14] *_run_on_cpu: introduce run_on_cpu_data type Paolo Bonzini
2016-10-31 14:13 ` [Qemu-devel] [PULL 14/14] tcg: move locking for tb_invalidate_phys_page_range up Paolo Bonzini
2016-10-31 16:12 ` [Qemu-devel] [PULL 00/14] MTTCG patches for 2016-10-31 Peter Maydell

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=1477923215-30323-13-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.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.
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).